Attempt to disable ver. det. in bg if needed

This commit is contained in:
Imran Remtulla
2022-12-12 20:53:42 -05:00
parent a00cfa2ba6
commit f3b1ca4541
3 changed files with 19 additions and 11 deletions

View File

@@ -21,7 +21,7 @@ import 'package:easy_localization/src/easy_localization_controller.dart';
// ignore: implementation_imports // ignore: implementation_imports
import 'package:easy_localization/src/localization.dart'; import 'package:easy_localization/src/localization.dart';
const String currentVersion = '0.8.9'; const String currentVersion = '0.8.10';
const String currentReleaseTag = const String currentReleaseTag =
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES 'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES

View File

@@ -427,6 +427,10 @@ class AppsProvider with ChangeNotifier {
return null; return null;
} }
Future<bool> 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 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 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) // If that fails, just set it to the actual version string (all we can do at that point)
@@ -550,6 +554,7 @@ class AppsProvider with ChangeNotifier {
} }
loadingApps = false; loadingApps = false;
notifyListeners(); notifyListeners();
if (await doesInstalledAppsPluginWork()) {
List<App> modifiedApps = []; List<App> modifiedApps = [];
for (var app in apps.values) { for (var app in apps.values) {
var moddedApp = var moddedApp =
@@ -562,9 +567,12 @@ class AppsProvider with ChangeNotifier {
await saveApps(modifiedApps, attemptToCorrectInstallStatus: false); await saveApps(modifiedApps, attemptToCorrectInstallStatus: false);
} }
} }
}
Future<void> saveApps(List<App> apps, Future<void> saveApps(List<App> apps,
{bool attemptToCorrectInstallStatus = true}) async { {bool attemptToCorrectInstallStatus = true}) async {
attemptToCorrectInstallStatus =
attemptToCorrectInstallStatus && (await doesInstalledAppsPluginWork());
for (var app in apps) { for (var app in apps) {
AppInfo? info = await getInstalledInfo(app.id); AppInfo? info = await getInstalledInfo(app.id);
app.name = info?.name ?? app.name; app.name = info?.name ?? app.name;

View File

@@ -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 # 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 # 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. # 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: environment:
sdk: '>=2.18.2 <3.0.0' sdk: '>=2.18.2 <3.0.0'