mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 04:37:37 +02:00
fix: Improve root installations management to fix patching of already patched apps
This commit is contained in:
@ -19,10 +19,13 @@ class AppInfoViewModel extends BaseViewModel {
|
||||
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||
final RootAPI _rootAPI = RootAPI();
|
||||
|
||||
void uninstallApp(PatchedApplication app) {
|
||||
Future<void> uninstallApp(PatchedApplication app) async {
|
||||
if (app.isRooted) {
|
||||
_rootAPI.deleteApp(app.packageName, app.apkFilePath);
|
||||
_managerAPI.deletePatchedApp(app);
|
||||
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||
if (hasRootPermissions) {
|
||||
_rootAPI.deleteApp(app.packageName, app.apkFilePath);
|
||||
_managerAPI.deletePatchedApp(app);
|
||||
}
|
||||
} else {
|
||||
DeviceApps.uninstallApp(app.packageName);
|
||||
_managerAPI.deletePatchedApp(app);
|
||||
@ -41,22 +44,24 @@ class AppInfoViewModel extends BaseViewModel {
|
||||
BuildContext context,
|
||||
PatchedApplication app,
|
||||
) async {
|
||||
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||
if (app.isRooted && !hasRootPermissions) {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('appInfoView.rootDialogTitle'),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: I18nText('appInfoView.rootDialogText'),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
if (app.isRooted) {
|
||||
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||
if (!hasRootPermissions) {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('appInfoView.rootDialogTitle'),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: I18nText('appInfoView.rootDialogText'),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return showDialog(
|
||||
context: context,
|
||||
|
Reference in New Issue
Block a user