From 7a1ba9dabfc8fb59d6b351f034b4e1d5a9802370 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sat, 23 Dec 2023 21:11:24 +0100 Subject: [PATCH] fix: Add missing confirmation dialog --- assets/i18n/en_US.json | 1 + .../appInfoView/app_info_viewmodel.dart | 30 +++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/assets/i18n/en_US.json b/assets/i18n/en_US.json index dde2237a00..2edee78e73 100644 --- a/assets/i18n/en_US.json +++ b/assets/i18n/en_US.json @@ -308,6 +308,7 @@ "rootDialogTitle": "Error", "unpatchDialogText": "Are you sure you want to unpatch this app?", + "uninstallDialogText": "Are you sure you want to uninstall this app?", "rootDialogText": "App was installed with superuser permissions, but currently ReVanced Manager has no permissions.\nPlease grant superuser permissions first.", "packageNameLabel": "Package name", diff --git a/lib/ui/widgets/appInfoView/app_info_viewmodel.dart b/lib/ui/widgets/appInfoView/app_info_viewmodel.dart index 89069966d2..e5b7bb0c68 100644 --- a/lib/ui/widgets/appInfoView/app_info_viewmodel.dart +++ b/lib/ui/widgets/appInfoView/app_info_viewmodel.dart @@ -28,6 +28,7 @@ class AppInfoViewModel extends BaseViewModel { var isUninstalled = onlyUnpatch; if (!onlyUnpatch) { + // TODO(Someone): Wait for the app to uninstall successfully. isUninstalled = await DeviceApps.uninstallApp(app.packageName); } @@ -91,7 +92,7 @@ class AppInfoViewModel extends BaseViewModel { ), FilledButton( onPressed: () { - uninstallApp(context, app, onlyUnpatch); + uninstallApp(context, app, true); Navigator.of(context).pop(); Navigator.of(context).pop(); }, @@ -101,8 +102,31 @@ class AppInfoViewModel extends BaseViewModel { ), ); } else { - uninstallApp(context, app, onlyUnpatch); - Navigator.of(context).pop(); + return showDialog( + context: context, + builder: (context) => AlertDialog( + title: I18nText( + 'appInfoView.uninstallButton', + ), + content: I18nText( + 'appInfoView.uninstallDialogText', + ), + actions: [ + TextButton( + onPressed: () => Navigator.of(context).pop(), + child: I18nText('noButton'), + ), + FilledButton( + onPressed: () { + uninstallApp(context, app, false); + Navigator.of(context).pop(); + Navigator.of(context).pop(); + }, + child: I18nText('yesButton'), + ), + ], + ), + ); } } }