mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-10-26 11:13:46 +01:00
Use onlyIfExists flag
This commit is contained in:
@@ -787,8 +787,10 @@ class AppsProvider with ChangeNotifier {
|
|||||||
if (attemptToCorrectInstallStatus) {
|
if (attemptToCorrectInstallStatus) {
|
||||||
app = getCorrectedInstallStatusAppIfPossible(app, info) ?? app;
|
app = getCorrectedInstallStatusAppIfPossible(app, info) ?? app;
|
||||||
}
|
}
|
||||||
File('${(await getAppsDir()).path}/${app.id}.json')
|
if (!onlyIfExists || this.apps.containsKey(app.id)) {
|
||||||
.writeAsStringSync(jsonEncode(app.toJson()));
|
File('${(await getAppsDir()).path}/${app.id}.json')
|
||||||
|
.writeAsStringSync(jsonEncode(app.toJson()));
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
this.apps.update(
|
this.apps.update(
|
||||||
app.id, (value) => AppInMemory(app, value.downloadProgress, info),
|
app.id, (value) => AppInMemory(app, value.downloadProgress, info),
|
||||||
@@ -902,7 +904,7 @@ class AppsProvider with ChangeNotifier {
|
|||||||
if (currentApp.preferredApkIndex < newApp.apkUrls.length) {
|
if (currentApp.preferredApkIndex < newApp.apkUrls.length) {
|
||||||
newApp.preferredApkIndex = currentApp.preferredApkIndex;
|
newApp.preferredApkIndex = currentApp.preferredApkIndex;
|
||||||
}
|
}
|
||||||
if (apps.containsKey(appId)) await saveApps([newApp]);
|
await saveApps([newApp]);
|
||||||
return newApp.latestVersion != currentApp.latestVersion ? newApp : null;
|
return newApp.latestVersion != currentApp.latestVersion ? newApp : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user