mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-10-30 21:13:28 +01: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())); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     for (var app in apps.values) { |  | ||||||
|     // Get install status and other OS info for each App (slow) |     // Get install status and other OS info for each App (slow) | ||||||
|       apps[app.app.id]?.installedInfo = await getInstalledInfo(app.app.id); |     await Future.wait(apps.values.map((app) { | ||||||
|       apps[app.app.id]?.icon = |       return updateInstallStatusInMemory(app); | ||||||
|           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(); |     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