Skip App loading on return to foreground

This commit is contained in:
Imran Remtulla
2023-05-22 12:10:58 -04:00
parent ca1371260c
commit 4136734a60
2 changed files with 9 additions and 2 deletions

View File

@@ -116,7 +116,7 @@ class AppsProvider with ChangeNotifier {
foregroundStream = FGBGEvents.stream.asBroadcastStream();
foregroundSubscription = foregroundStream?.listen((event) async {
isForeground = event == FGBGType.foreground;
if (isForeground) await loadApps();
if (isForeground) await refreshInstallStatuses();
});
() async {
// Load Apps into memory (in background, this is done later instead of in the constructor)
@@ -747,6 +747,10 @@ class AppsProvider with ChangeNotifier {
}
loadingApps = false;
notifyListeners();
refreshInstallStatuses();
}
Future<void> refreshInstallStatuses() async {
if (await doesInstalledAppsPluginWork()) {
List<App> modifiedApps = [];
for (var app in apps.values) {