mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-11-04 07:13:28 +01:00 
			
		
		
		
	Compare commits
	
		
			4 Commits
		
	
	
		
			v0.8.8-bet
			...
			v0.8.10-be
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					481204665c | ||
| 
						 | 
					317b5ac83a | ||
| 
						 | 
					f3b1ca4541 | ||
| 
						 | 
					a00cfa2ba6 | 
@@ -170,6 +170,7 @@
 | 
			
		||||
    "pleaseAllowInstallPerm": "Please allow Obtainium to install Apps",
 | 
			
		||||
    "trackOnly": "Track-Only",
 | 
			
		||||
    "errorWithHttpStatusCode": "Error {}",
 | 
			
		||||
    "versionCorrectionDisabled": "Version correction disabled (plugin doesn't seem to work)",
 | 
			
		||||
    "tooManyRequestsTryAgainInMinutes": {
 | 
			
		||||
        "one": "Too many requests (rate limited) - try again in {} minute",
 | 
			
		||||
        "other": "Too many requests (rate limited) - try again in {} minutes"
 | 
			
		||||
 
 | 
			
		||||
@@ -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.8';
 | 
			
		||||
const String currentVersion = '0.8.10';
 | 
			
		||||
const String currentReleaseTag =
 | 
			
		||||
    'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
 | 
			
		||||
 | 
			
		||||
@@ -85,7 +85,7 @@ Future<void> bgUpdateCheck(int taskId, Map<String, dynamic>? params) async {
 | 
			
		||||
      if (e is RateLimitError || e is SocketException) {
 | 
			
		||||
        var remainingMinutes = e is RateLimitError ? e.remainingMinutes : 15;
 | 
			
		||||
        logs.add(plural('bgUpdateGotErrorRetryInMinutes', remainingMinutes,
 | 
			
		||||
            args: [e.runtimeType.toString()]));
 | 
			
		||||
            args: [e.runtimeType.toString(), remainingMinutes.toString()]));
 | 
			
		||||
        AndroidAlarmManager.oneShot(Duration(minutes: remainingMinutes),
 | 
			
		||||
            Random().nextInt(pow(2, 31) as int), bgUpdateCheck, params: {
 | 
			
		||||
          'ignoreAfterMicroseconds': nextIgnoreAfter.microsecondsSinceEpoch
 | 
			
		||||
 
 | 
			
		||||
@@ -427,6 +427,19 @@ class AppsProvider with ChangeNotifier {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Future<bool> doesInstalledAppsPluginWork() async {
 | 
			
		||||
    bool res = false;
 | 
			
		||||
    try {
 | 
			
		||||
      res = (await InstalledApps.getAppInfo(obtainiumId)).versionName != null;
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
      //
 | 
			
		||||
    }
 | 
			
		||||
    if (!res) {
 | 
			
		||||
      logs.add(tr('versionCorrectionDisabled'));
 | 
			
		||||
    }
 | 
			
		||||
    return res;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 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 +563,25 @@ class AppsProvider with ChangeNotifier {
 | 
			
		||||
    }
 | 
			
		||||
    loadingApps = false;
 | 
			
		||||
    notifyListeners();
 | 
			
		||||
    List<App> modifiedApps = [];
 | 
			
		||||
    for (var app in apps.values) {
 | 
			
		||||
      var moddedApp =
 | 
			
		||||
          getCorrectedInstallStatusAppIfPossible(app.app, app.installedInfo);
 | 
			
		||||
      if (moddedApp != null) {
 | 
			
		||||
        modifiedApps.add(moddedApp);
 | 
			
		||||
    if (await doesInstalledAppsPluginWork()) {
 | 
			
		||||
      List<App> 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<void> saveApps(List<App> 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;
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,7 @@ class UpdateNotification extends ObtainiumNotification {
 | 
			
		||||
        : updates.length == 1
 | 
			
		||||
            ? tr('xHasAnUpdate', args: [updates[0].name])
 | 
			
		||||
            : plural('xAndNMoreUpdatesAvailable', updates.length - 1,
 | 
			
		||||
                args: [updates[0].name]);
 | 
			
		||||
                args: [updates[0].name, (updates.length - 1).toString()]);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -48,7 +48,7 @@ class SilentUpdateNotification extends ObtainiumNotification {
 | 
			
		||||
        ? tr('xWasUpdatedToY',
 | 
			
		||||
            args: [updates[0].name, updates[0].latestVersion])
 | 
			
		||||
        : plural('xAndNMoreUpdatesInstalled', updates.length - 1,
 | 
			
		||||
            args: [updates[0].name]);
 | 
			
		||||
            args: [updates[0].name, (updates.length - 1).toString()]);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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.8+71 # When changing this, update the tag in main() accordingly
 | 
			
		||||
version: 0.8.10+74 # When changing this, update the tag in main() accordingly
 | 
			
		||||
 | 
			
		||||
environment:
 | 
			
		||||
  sdk: '>=2.18.2 <3.0.0'
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user