mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-14 02:48:10 +02:00
Fix installed version bug when importing apps (#1179)
This commit is contained in:
@@ -740,12 +740,15 @@ class AppsProvider with ChangeNotifier {
|
|||||||
return appsDir;
|
return appsDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<PackageInfo?> getInstalledInfo(String? packageName) async {
|
Future<PackageInfo?> getInstalledInfo(String? packageName,
|
||||||
|
{bool printErr = true}) async {
|
||||||
if (packageName != null) {
|
if (packageName != null) {
|
||||||
try {
|
try {
|
||||||
return await pm.getPackageInfo(packageName: packageName);
|
return await pm.getPackageInfo(packageName: packageName);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(e); // OK
|
if (printErr) {
|
||||||
|
print(e); // OK
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -1253,9 +1256,8 @@ class AppsProvider with ChangeNotifier {
|
|||||||
await Future.delayed(const Duration(microseconds: 1));
|
await Future.delayed(const Duration(microseconds: 1));
|
||||||
}
|
}
|
||||||
for (App a in importedApps) {
|
for (App a in importedApps) {
|
||||||
if (apps[a.id]?.app.installedVersion != null) {
|
a.installedVersion =
|
||||||
a.installedVersion = apps[a.id]?.app.installedVersion;
|
(await getInstalledInfo(a.id, printErr: false))?.versionName;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
await saveApps(importedApps, onlyIfExists: false);
|
await saveApps(importedApps, onlyIfExists: false);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
Reference in New Issue
Block a user