mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
fix: add back saving patched apps after clearing data.
This commit is contained in:
parent
6c1845e246
commit
3f9d7c9cc0
@ -256,6 +256,35 @@ class ManagerAPI {
|
|||||||
return unsavedApps;
|
return unsavedApps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> reAssessSavedApps() async {
|
||||||
|
List<PatchedApplication> patchedApps = getPatchedApps();
|
||||||
|
List<PatchedApplication> unsavedApps = await getUnsavedApps(patchedApps);
|
||||||
|
patchedApps.addAll(unsavedApps);
|
||||||
|
List<PatchedApplication> toRemove = await getAppsToRemove(patchedApps);
|
||||||
|
patchedApps.removeWhere((a) => toRemove.contains(a));
|
||||||
|
for (PatchedApplication app in patchedApps) {
|
||||||
|
app.hasUpdates =
|
||||||
|
await hasAppUpdates(app.originalPackageName, app.patchDate);
|
||||||
|
app.changelog =
|
||||||
|
await getAppChangelog(app.originalPackageName, app.patchDate);
|
||||||
|
if (!app.hasUpdates) {
|
||||||
|
String? currentInstalledVersion =
|
||||||
|
(await DeviceApps.getApp(app.packageName))?.versionName;
|
||||||
|
if (currentInstalledVersion != null) {
|
||||||
|
String currentSavedVersion = app.version;
|
||||||
|
int currentInstalledVersionInt = int.parse(
|
||||||
|
currentInstalledVersion.replaceAll(RegExp('[^0-9]'), ''));
|
||||||
|
int currentSavedVersionInt =
|
||||||
|
int.parse(currentSavedVersion.replaceAll(RegExp('[^0-9]'), ''));
|
||||||
|
if (currentInstalledVersionInt > currentSavedVersionInt) {
|
||||||
|
app.hasUpdates = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await setPatchedApps(patchedApps);
|
||||||
|
}
|
||||||
|
|
||||||
Future<bool> isAppUninstalled(PatchedApplication app) async {
|
Future<bool> isAppUninstalled(PatchedApplication app) async {
|
||||||
bool existsRoot = false;
|
bool existsRoot = false;
|
||||||
bool existsNonRoot = await DeviceApps.isAppInstalled(app.packageName);
|
bool existsNonRoot = await DeviceApps.isAppInstalled(app.packageName);
|
||||||
|
@ -49,6 +49,7 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
_toast.show('homeView.noConnection');
|
_toast.show('homeView.noConnection');
|
||||||
}
|
}
|
||||||
_getPatchedApps();
|
_getPatchedApps();
|
||||||
|
_managerAPI.reAssessSavedApps().then((_) => _getPatchedApps());
|
||||||
}
|
}
|
||||||
|
|
||||||
void navigateToAppInfo(PatchedApplication app) {
|
void navigateToAppInfo(PatchedApplication app) {
|
||||||
|
Loading…
Reference in New Issue
Block a user