Skip to content

Commit

Permalink
fix: Add missing confirmation dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Dec 23, 2023
1 parent 48a739c commit 7a1ba9d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
1 change: 1 addition & 0 deletions assets/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
30 changes: 27 additions & 3 deletions lib/ui/widgets/appInfoView/app_info_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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();
},
Expand All @@ -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: <Widget>[
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'),
),
],
),
);
}
}
}
Expand Down

0 comments on commit 7a1ba9d

Please sign in to comment.