Added update all button + Obtainium added by default

This commit is contained in:
Imran Remtulla
2022-08-25 14:26:15 -04:00
parent aeada9635d
commit 0362cdf8ac
4 changed files with 82 additions and 46 deletions

View File

@@ -132,6 +132,15 @@ class AppsProvider with ChangeNotifier {
return appsDir;
}
Future<void> deleteSavedAPKs() async {
(await getExternalStorageDirectory())
?.listSync()
.where((element) => element.path.endsWith('.apk'))
.forEach((element) {
element.deleteSync();
});
}
Future<void> loadApps() async {
loadingApps = true;
notifyListeners();
@@ -186,7 +195,7 @@ class AppsProvider with ChangeNotifier {
return null;
}
Future<List<App>> getUpdates() async {
Future<List<App>> checkUpdates() async {
List<App> updates = [];
if (!gettingUpdates) {
gettingUpdates = true;
@@ -203,14 +212,16 @@ class AppsProvider with ChangeNotifier {
return updates;
}
Future<void> installUpdates() async {
List<String> getExistingUpdates() {
List<String> updateAppIds = [];
List<String> appIds = apps.keys.toList();
for (int i = 0; i < appIds.length; i++) {
App? app = apps[appIds[i]]!.app;
if (app.installedVersion != app.latestVersion) {
await downloadAndInstallLatestApp(app.id);
updateAppIds.add(app.id);
}
}
return updateAppIds;
}
@override