fix: Add missing confirmation dialog

This commit is contained in:
oSumAtrIX 2023-12-23 21:11:24 +01:00
parent 48a739c94e
commit 7a1ba9dabf
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
2 changed files with 28 additions and 3 deletions

View File

@ -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",

View File

@ -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: <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'),
),
],
),
);
}
}
}