mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2026-01-11 13:46:17 +00:00
refactor: Simplify uninstallApp code
This commit is contained in:
@@ -25,20 +25,16 @@ class AppInfoViewModel extends BaseViewModel {
|
|||||||
PatchedApplication app,
|
PatchedApplication app,
|
||||||
bool onlyUnpatch,
|
bool onlyUnpatch,
|
||||||
) async {
|
) async {
|
||||||
bool isUninstalled = true;
|
var isUninstalled = onlyUnpatch;
|
||||||
if (app.isRooted) {
|
|
||||||
final bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
if (!onlyUnpatch) {
|
||||||
if (hasRootPermissions) {
|
|
||||||
await _rootAPI.uninstall(
|
|
||||||
app.packageName,
|
|
||||||
);
|
|
||||||
if (!onlyUnpatch) {
|
|
||||||
await DeviceApps.uninstallApp(app.packageName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
isUninstalled = await DeviceApps.uninstallApp(app.packageName);
|
isUninstalled = await DeviceApps.uninstallApp(app.packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isUninstalled && app.isRooted && await _rootAPI.hasRootPermissions()) {
|
||||||
|
await _rootAPI.uninstall(app.packageName);
|
||||||
|
}
|
||||||
|
|
||||||
if (isUninstalled) {
|
if (isUninstalled) {
|
||||||
await _managerAPI.deletePatchedApp(app);
|
await _managerAPI.deletePatchedApp(app);
|
||||||
locator<HomeViewModel>().initialize(context);
|
locator<HomeViewModel>().initialize(context);
|
||||||
|
|||||||
Reference in New Issue
Block a user