From f3b1ca4541b1d28930920a77a9d9b4fddacc9c3a Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Mon, 12 Dec 2022 20:53:42 -0500 Subject: [PATCH] Attempt to disable ver. det. in bg if needed --- lib/main.dart | 2 +- lib/providers/apps_provider.dart | 26 +++++++++++++++++--------- pubspec.yaml | 2 +- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index dfc3603..31a4ba1 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -21,7 +21,7 @@ import 'package:easy_localization/src/easy_localization_controller.dart'; // ignore: implementation_imports import 'package:easy_localization/src/localization.dart'; -const String currentVersion = '0.8.9'; +const String currentVersion = '0.8.10'; const String currentReleaseTag = 'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES diff --git a/lib/providers/apps_provider.dart b/lib/providers/apps_provider.dart index c06e1d9..03c66a4 100644 --- a/lib/providers/apps_provider.dart +++ b/lib/providers/apps_provider.dart @@ -427,6 +427,10 @@ class AppsProvider with ChangeNotifier { return null; } + Future doesInstalledAppsPluginWork() async { + return (await InstalledApps.getAppInfo(obtainiumId)).versionName != null; + } + // If the App says it is installed but installedInfo is null, set it to not installed // If there is any other mismatch between installedInfo and installedVersion, try reconciling them intelligently // If that fails, just set it to the actual version string (all we can do at that point) @@ -550,21 +554,25 @@ class AppsProvider with ChangeNotifier { } loadingApps = false; notifyListeners(); - List modifiedApps = []; - for (var app in apps.values) { - var moddedApp = - getCorrectedInstallStatusAppIfPossible(app.app, app.installedInfo); - if (moddedApp != null) { - modifiedApps.add(moddedApp); + if (await doesInstalledAppsPluginWork()) { + List modifiedApps = []; + for (var app in apps.values) { + var moddedApp = + getCorrectedInstallStatusAppIfPossible(app.app, app.installedInfo); + if (moddedApp != null) { + modifiedApps.add(moddedApp); + } + } + if (modifiedApps.isNotEmpty) { + await saveApps(modifiedApps, attemptToCorrectInstallStatus: false); } - } - if (modifiedApps.isNotEmpty) { - await saveApps(modifiedApps, attemptToCorrectInstallStatus: false); } } Future saveApps(List apps, {bool attemptToCorrectInstallStatus = true}) async { + attemptToCorrectInstallStatus = + attemptToCorrectInstallStatus && (await doesInstalledAppsPluginWork()); for (var app in apps) { AppInfo? info = await getInstalledInfo(app.id); app.name = info?.name ?? app.name; diff --git a/pubspec.yaml b/pubspec.yaml index 66e086a..cbdc5c7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 0.8.9+72 # When changing this, update the tag in main() accordingly +version: 0.8.10+73 # When changing this, update the tag in main() accordingly environment: sdk: '>=2.18.2 <3.0.0'