mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
fix: Fix apps reassess on root
This commit is contained in:
parent
257fd46e27
commit
ae801a2918
@ -182,11 +182,14 @@ class ManagerAPI {
|
||||
List<PatchedApplication> patchedApps,
|
||||
) async {
|
||||
List<PatchedApplication> unsavedApps = [];
|
||||
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||
if (hasRootPermissions) {
|
||||
List<String> installedApps = await _rootAPI.getInstalledApps();
|
||||
for (String packageName in installedApps) {
|
||||
if (!patchedApps.any((app) => app.packageName == packageName)) {
|
||||
ApplicationWithIcon? application =
|
||||
await DeviceApps.getApp(packageName, true) as ApplicationWithIcon?;
|
||||
await DeviceApps.getApp(packageName, true)
|
||||
as ApplicationWithIcon?;
|
||||
if (application != null) {
|
||||
unsavedApps.add(
|
||||
PatchedApplication(
|
||||
@ -202,6 +205,7 @@ class ManagerAPI {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
List<Application> userApps = await DeviceApps.getInstalledApplications(
|
||||
includeSystemApps: false,
|
||||
includeAppIcons: false,
|
||||
@ -227,7 +231,6 @@ class ManagerAPI {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return unsavedApps;
|
||||
}
|
||||
|
||||
@ -260,14 +263,15 @@ class ManagerAPI {
|
||||
|
||||
Future<bool> isAppUninstalled(PatchedApplication app) async {
|
||||
bool existsRoot = false;
|
||||
bool existsNonRoot = await DeviceApps.isAppInstalled(app.packageName);
|
||||
if (app.isRooted) {
|
||||
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||
if (hasRootPermissions) {
|
||||
existsRoot = await _rootAPI.isAppInstalled(app.packageName);
|
||||
}
|
||||
return !existsRoot || !existsNonRoot;
|
||||
}
|
||||
bool existsNonRoot = await DeviceApps.isAppInstalled(app.packageName);
|
||||
return !existsRoot && !existsNonRoot;
|
||||
return !existsNonRoot;
|
||||
}
|
||||
|
||||
Future<bool> hasAppUpdates(String packageName, DateTime patchDate) async {
|
||||
|
@ -58,16 +58,7 @@ class RootAPI {
|
||||
cmd: 'ls "$_managerDirPath"',
|
||||
);
|
||||
if (res != null) {
|
||||
List<String> apps = res.split('\n');
|
||||
List<String> toRemove = [];
|
||||
for (String packageName in apps) {
|
||||
bool isInstalled = await isAppInstalled(packageName);
|
||||
if (!isInstalled) {
|
||||
toRemove.add(packageName);
|
||||
}
|
||||
}
|
||||
apps.removeWhere((a) => toRemove.contains(a));
|
||||
return apps;
|
||||
return res.split('\n').map((pack) => pack.trim()).toList();
|
||||
}
|
||||
} on Exception {
|
||||
return List.empty();
|
||||
|
Loading…
Reference in New Issue
Block a user