π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Migrate use of WillPopScope to PopScope (#1473)
Ashildac0ddf41c96
diff --git a/mobile/lib/ui/account/recovery_page.dart b/mobile/lib/ui/account/recovery_page.dartindex 4b3d499955..881b0792dd 100644--- a/mobile/lib/ui/account/recovery_page.dart+++ b/mobile/lib/ui/account/recovery_page.dart@@ -59,9 +59,9 @@ class _RecoveryPageState extends State<RecoveryPage> {Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (BuildContext context) {- return WillPopScope(- onWillPop: () async => false,- child: const PasswordEntryPage(+ return const PopScope(+ canPop: false,+ child: PasswordEntryPage(mode: PasswordEntryMode.reset,),);diff --git a/mobile/lib/ui/common/linear_progress_dialog.dart b/mobile/lib/ui/common/linear_progress_dialog.dartindex 3bd2f70fea..375eebe48c 100644--- a/mobile/lib/ui/common/linear_progress_dialog.dart+++ b/mobile/lib/ui/common/linear_progress_dialog.dart@@ -27,8 +27,8 @@ class LinearProgressDialogState extends State<LinearProgressDialog> {@overrideWidget build(BuildContext context) {- return WillPopScope(- onWillPop: () async => false,+ return PopScope(+ canPop: false,child: AlertDialog(title: Text(widget.message,diff --git a/mobile/lib/ui/common/progress_dialog.dart b/mobile/lib/ui/common/progress_dialog.dartindex 61f8d4ca17..f08d7cdbcf 100644--- a/mobile/lib/ui/common/progress_dialog.dart+++ b/mobile/lib/ui/common/progress_dialog.dart@@ -155,8 +155,8 @@ class ProgressDialog {barrierColor: _barrierColor,builder: (BuildContext context) {_dismissingContext = context;- return WillPopScope(- onWillPop: () async => _barrierDismissible,+ return PopScope(+ canPop: _barrierDismissible,child: Dialog(backgroundColor: _backgroundColor,insetAnimationCurve: _insetAnimCurve,diff --git a/mobile/lib/ui/payment/payment_web_page.dart b/mobile/lib/ui/payment/payment_web_page.dartindex cbe55f671e..c6c0c83d01 100644--- a/mobile/lib/ui/payment/payment_web_page.dart+++ b/mobile/lib/ui/payment/payment_web_page.dart@@ -52,8 +52,15 @@ class _PaymentWebPageState extends State<PaymentWebPage> {if (initPaymentUrl == null) {return const EnteLoadingWidget();}- return WillPopScope(- onWillPop: (() async => _buildPageExitWidget(context)),+ return PopScope(+ canPop: false,+ onPopInvoked: (didPop) async {+ if (didPop) return;+ final shouldPop = await _buildPageExitWidget(context);+ if (shouldPop) {+ Navigator.of(context).pop();+ }+ },child: Scaffold(appBar: AppBar(title: Text(S.of(context).subscription),diff --git a/mobile/lib/ui/settings/app_update_dialog.dart b/mobile/lib/ui/settings/app_update_dialog.dartindex 8038b7fa58..c9e612201a 100644--- a/mobile/lib/ui/settings/app_update_dialog.dart+++ b/mobile/lib/ui/settings/app_update_dialog.dart@@ -83,8 +83,8 @@ class _AppUpdateDialogState extends State<AppUpdateDialog> {);final shouldForceUpdate =UpdateService.instance.shouldForceUpdate(widget.latestVersionInfo!);- return WillPopScope(- onWillPop: () async => !shouldForceUpdate,+ return PopScope(+ canPop: !shouldForceUpdate,child: AlertDialog(key: const ValueKey("updateAppDialog"),title: Column(diff --git a/mobile/lib/ui/tabs/home_widget.dart b/mobile/lib/ui/tabs/home_widget.dartindex 6745aaaa6f..4b2c38ce58 100644--- a/mobile/lib/ui/tabs/home_widget.dart+++ b/mobile/lib/ui/tabs/home_widget.dart@@ -315,7 +315,23 @@ class _HomeWidgetState extends State<HomeWidget> {final enableDrawer = LocalSyncService.instance.hasCompletedFirstImport();final action = AppLifecycleService.instance.mediaExtensionAction.action;return UserDetailsStateWidget(- child: WillPopScope(+ child: PopScope(+ canPop: false,+ onPopInvoked: (didPop) async {+ if (didPop) return;+ if (_selectedTabIndex == 0) {+ if (isSettingsOpen) {+ Navigator.pop(context);+ } else if (Platform.isAndroid && action == IntentAction.main) {+ unawaited(MoveToBackground.moveTaskToBack());+ } else {+ Navigator.pop(context);+ }+ } else {+ Bus.instance+ .fire(TabChangedEvent(0, TabChangedEventSource.backButton));+ }+ },child: Scaffold(drawerScrimColor: getEnteColorScheme(context).strokeFainter,drawerEnableOpenDragGesture: false,@@ -341,24 +357,6 @@ class _HomeWidgetState extends State<HomeWidget> {),resizeToAvoidBottomInset: false,),- onWillPop: () async {- if (_selectedTabIndex == 0) {- if (isSettingsOpen) {- Navigator.pop(context);- return false;- }- if (Platform.isAndroid && action == IntentAction.main) {- unawaited(MoveToBackground.moveTaskToBack());- return false;- } else {- return true;- }- } else {- Bus.instance- .fire(TabChangedEvent(0, TabChangedEventSource.backButton));- return false;- }- },),);}diff --git a/mobile/lib/ui/tools/app_lock.dart b/mobile/lib/ui/tools/app_lock.dartindex 1fbc1678e5..c27555df0a 100644--- a/mobile/lib/ui/tools/app_lock.dart+++ b/mobile/lib/ui/tools/app_lock.dart@@ -137,9 +137,9 @@ class _AppLockState extends State<AppLock> with WidgetsBindingObserver {}Widget get _lockScreen {- return WillPopScope(+ return PopScope(+ canPop: false,child: this.widget.lockScreen,- onWillPop: () => Future.value(false),);}diff --git a/mobile/lib/ui/tools/editor/image_editor_page.dart b/mobile/lib/ui/tools/editor/image_editor_page.dartindex ca36db002a..4830df9523 100644--- a/mobile/lib/ui/tools/editor/image_editor_page.dart+++ b/mobile/lib/ui/tools/editor/image_editor_page.dart@@ -63,14 +63,14 @@ class _ImageEditorPageState extends State<ImageEditorPage> {@overrideWidget build(BuildContext context) {- return WillPopScope(- onWillPop: () async {+ return PopScope(+ canPop: false,+ onPopInvoked: (didPop) async {if (_hasBeenEdited()) {await _showExitConfirmationDialog(context);} else {replacePage(context, DetailPage(widget.detailPageConfig));}- return false;},child: Scaffold(appBar: AppBar(