mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-14 02:48:10 +02:00
Improve loading time (parallelize version detection)
This commit is contained in:
@@ -917,6 +917,17 @@ class AppsProvider with ChangeNotifier {
|
|||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> updateInstallStatusInMemory(AppInMemory app) async {
|
||||||
|
apps[app.app.id]?.installedInfo = await getInstalledInfo(app.app.id);
|
||||||
|
apps[app.app.id]?.icon =
|
||||||
|
await apps[app.app.id]?.installedInfo?.applicationInfo?.getAppIcon();
|
||||||
|
apps[app.app.id]?.app.name = await (apps[app.app.id]
|
||||||
|
?.installedInfo
|
||||||
|
?.applicationInfo
|
||||||
|
?.getAppLabel()) ??
|
||||||
|
app.name;
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> loadApps({String? singleId}) async {
|
Future<void> loadApps({String? singleId}) async {
|
||||||
while (loadingApps) {
|
while (loadingApps) {
|
||||||
await Future.delayed(const Duration(microseconds: 1));
|
await Future.delayed(const Duration(microseconds: 1));
|
||||||
@@ -965,19 +976,11 @@ class AppsProvider with ChangeNotifier {
|
|||||||
NotificationsProvider().notify(
|
NotificationsProvider().notify(
|
||||||
AppsRemovedNotification(errors.map((e) => [e[1], e[2]]).toList()));
|
AppsRemovedNotification(errors.map((e) => [e[1], e[2]]).toList()));
|
||||||
}
|
}
|
||||||
|
// Get install status and other OS info for each App (slow)
|
||||||
for (var app in apps.values) {
|
await Future.wait(apps.values.map((app) {
|
||||||
// Get install status and other OS info for each App (slow)
|
return updateInstallStatusInMemory(app);
|
||||||
apps[app.app.id]?.installedInfo = await getInstalledInfo(app.app.id);
|
}));
|
||||||
apps[app.app.id]?.icon =
|
notifyListeners();
|
||||||
await apps[app.app.id]?.installedInfo?.applicationInfo?.getAppIcon();
|
|
||||||
apps[app.app.id]?.app.name = await (apps[app.app.id]
|
|
||||||
?.installedInfo
|
|
||||||
?.applicationInfo
|
|
||||||
?.getAppLabel()) ??
|
|
||||||
app.name;
|
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
// Reconcile version differences
|
// Reconcile version differences
|
||||||
List<App> modifiedApps = [];
|
List<App> modifiedApps = [];
|
||||||
for (var app in apps.values) {
|
for (var app in apps.values) {
|
||||||
@@ -1000,7 +1003,6 @@ class AppsProvider with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadingApps = false;
|
loadingApps = false;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user