Bugfix - update checking on app load was broken

This commit is contained in:
Imran Remtulla
2022-08-28 18:17:03 -04:00
parent 285da7545b
commit c2a7e4a0d2
2 changed files with 21 additions and 10 deletions

View File

@@ -39,14 +39,26 @@ class AppsProvider with ChangeNotifier {
late Stream<FGBGType> foregroundStream;
late StreamSubscription<FGBGType> foregroundSubscription;
AppsProvider({bool bg = false}) {
AppsProvider(
{bool shouldLoadApps = false,
bool shouldCheckUpdatesAfterLoad = false,
bool shouldDeleteAPKs = false}) {
// Subscribe to changes in the app foreground status
foregroundStream = FGBGEvents.stream.asBroadcastStream();
foregroundSubscription = foregroundStream.listen((event) async {
isForeground = event == FGBGType.foreground;
if (isForeground) await loadApps();
});
loadApps();
if (shouldDeleteAPKs) {
deleteSavedAPKs();
}
if (shouldLoadApps) {
loadApps().then((_) {
if (shouldCheckUpdatesAfterLoad) {
checkUpdates();
}
});
}
}
Future<ApkFile> downloadApp(String apkUrl, String appId) async {