mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-10-31 05:23:28 +01:00 
			
		
		
		
	Bugfixes
Don't replace / in versions (#1023) Fix HTML version extraction (#1021) Update check only for installed apps (#1012)
This commit is contained in:
		| @@ -274,6 +274,7 @@ | ||||
|     "downloadingXNotifChannel": "Preuzimanje {}", | ||||
|     "completeAppInstallationNotifChannel": "Dovršite instalaciju aplikacije", | ||||
|     "checkingForUpdatesNotifChannel": "Tražim moguće nadogradnje", | ||||
|     "onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Želite li ukloniti aplikaciju?", | ||||
|         "other": "Želite li ukloniti aplikacije?" | ||||
|   | ||||
| @@ -274,6 +274,7 @@ | ||||
|     "downloadingXNotifChannel": "download {}", | ||||
|     "completeAppInstallationNotifChannel": "Dokončit instalaci aplikace", | ||||
|     "checkingForUpdatesNotifChannel": "Zkontrolovat aktualizace", | ||||
|     "onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Odstranit Apku?", | ||||
|         "other": "Odstranit Apky?" | ||||
|   | ||||
| @@ -274,6 +274,7 @@ | ||||
|     "downloadingXNotifChannel": "Lade {} herunter", | ||||
|     "completeAppInstallationNotifChannel": "App Installation abschließen", | ||||
|     "checkingForUpdatesNotifChannel": "Nach Aktualisierungen suchen", | ||||
|     "onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "App entfernen?", | ||||
|         "other": "Apps entfernen?" | ||||
|   | ||||
| @@ -274,6 +274,7 @@ | ||||
|     "downloadingXNotifChannel": "Downloading {}", | ||||
|     "completeAppInstallationNotifChannel": "Complete App Installation", | ||||
|     "checkingForUpdatesNotifChannel": "Checking for Updates", | ||||
|     "onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Remove App?", | ||||
|         "other": "Remove Apps?" | ||||
|   | ||||
| @@ -274,6 +274,7 @@ | ||||
|     "downloadingXNotifChannel": "Descargando {}", | ||||
|     "completeAppInstallationNotifChannel": "Instalación Completa de la Aplicación", | ||||
|     "checkingForUpdatesNotifChannel": "Buscando Actualizaciones", | ||||
|     "onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "¿Eliminar Aplicación?", | ||||
|         "other": "¿Eliminar Aplicaciones?" | ||||
|   | ||||
| @@ -274,6 +274,7 @@ | ||||
|     "downloadingXNotifChannel": "در حال دانلود {}", | ||||
|     "completeAppInstallationNotifChannel": "نصب کامل برنامه", | ||||
|     "checkingForUpdatesNotifChannel": "بررسی بهروزرسانیها", | ||||
|     "onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "برنامه حذف شود؟", | ||||
|         "other": "برنامه ها حذف شوند؟" | ||||
|   | ||||
| @@ -274,6 +274,7 @@ | ||||
|     "downloadingXNotifChannel": "Téléchargement {}", | ||||
|     "completeAppInstallationNotifChannel": "Installation complète de l'application", | ||||
|     "checkingForUpdatesNotifChannel": "Vérification des mises à jour", | ||||
|     "onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Supprimer l'application ?", | ||||
|         "other": "Supprimer les applications ?" | ||||
|   | ||||
| @@ -274,6 +274,7 @@ | ||||
|     "downloadingXNotifChannel": "{} letöltés", | ||||
|     "completeAppInstallationNotifChannel": "Teljes app telepítés", | ||||
|     "checkingForUpdatesNotifChannel": "Frissítések keresése", | ||||
|     "onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Eltávolítja az alkalmazást?", | ||||
|         "other": "Eltávolítja az alkalmazást?" | ||||
|   | ||||
| @@ -274,6 +274,7 @@ | ||||
|     "downloadingXNotifChannel": "Scaricamento di {} in corso", | ||||
|     "completeAppInstallationNotifChannel": "Completa l'installazione dell'app", | ||||
|     "checkingForUpdatesNotifChannel": "Controllo degli aggiornamenti in corso", | ||||
|     "onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Rimuovere l'app?", | ||||
|         "other": "Rimuovere le app?" | ||||
|   | ||||
| @@ -274,6 +274,7 @@ | ||||
|     "downloadingXNotifChannel": "{} をダウンロード中", | ||||
|     "completeAppInstallationNotifChannel": "アプリのインストールを完了する", | ||||
|     "checkingForUpdatesNotifChannel": "アップデートを確認中", | ||||
|     "onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "アプリを削除しますか?", | ||||
|         "other": "アプリを削除しますか?" | ||||
|   | ||||
| @@ -274,6 +274,7 @@ | ||||
|     "downloadingXNotifChannel": "Pobieranie aplikacji", | ||||
|     "completeAppInstallationNotifChannel": "Ukończenie instalacji aplikacji", | ||||
|     "checkingForUpdatesNotifChannel": "Sprawdzanie dostępności aktualizacji", | ||||
|     "onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Usunąć aplikację?", | ||||
|         "few": "Usunąć aplikacje?", | ||||
|   | ||||
| @@ -274,6 +274,7 @@ | ||||
|     "downloadingXNotifChannel": "Baixando {}", | ||||
|     "completeAppInstallationNotifChannel": "Instalação completa do App", | ||||
|     "checkingForUpdatesNotifChannel": "Checando por Atualizações", | ||||
|     "onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Remover App?", | ||||
|         "other": "Remover Apps?" | ||||
|   | ||||
| @@ -274,6 +274,7 @@ | ||||
|     "downloadingXNotifChannel": "Загрузка {}", | ||||
|     "completeAppInstallationNotifChannel": "Завершение установки приложения", | ||||
|     "checkingForUpdatesNotifChannel": "Проверка обновлений", | ||||
|     "onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Удалить приложение?", | ||||
|         "other": "Удалить приложения?" | ||||
|   | ||||
| @@ -274,6 +274,7 @@ | ||||
|     "downloadingXNotifChannel": "正在下载{}", | ||||
|     "completeAppInstallationNotifChannel": "完成应用安装", | ||||
|     "checkingForUpdatesNotifChannel": "正在检查更新", | ||||
|     "onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "是否删除应用?", | ||||
|         "other": "是否删除应用?" | ||||
|   | ||||
| @@ -219,7 +219,9 @@ class HTML extends AppSource { | ||||
|           additionalSettings['versionExtractionRegEx'] as String?; | ||||
|       if (versionExtractionRegEx?.isNotEmpty == true) { | ||||
|         var match = RegExp(versionExtractionRegEx!).allMatches( | ||||
|             res.body.split('\r\n').join('\n').split('\n').join('\\n')); | ||||
|             additionalSettings['versionExtractWholePage'] == true | ||||
|                 ? res.body.split('\r\n').join('\n').split('\n').join('\\n') | ||||
|                 : rel); | ||||
|         if (match.isEmpty) { | ||||
|           throw NoVersionError(); | ||||
|         } | ||||
|   | ||||
| @@ -310,6 +310,23 @@ class _SettingsPageState extends State<SettingsPage> { | ||||
|                                     }) | ||||
|                               ], | ||||
|                             ), | ||||
|                             height16, | ||||
|                             Row( | ||||
|                               mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||||
|                               children: [ | ||||
|                                 Flexible( | ||||
|                                     child: Text(tr( | ||||
|                                         'onlyCheckInstalledOrTrackOnlyApps'))), | ||||
|                                 Switch( | ||||
|                                     value: settingsProvider | ||||
|                                         .onlyCheckInstalledOrTrackOnlyApps, | ||||
|                                     onChanged: (value) { | ||||
|                                       settingsProvider | ||||
|                                               .onlyCheckInstalledOrTrackOnlyApps = | ||||
|                                           value; | ||||
|                                     }) | ||||
|                               ], | ||||
|                             ), | ||||
|                             height32, | ||||
|                             Text( | ||||
|                               tr('sourceSpecific'), | ||||
| @@ -535,7 +552,8 @@ class _SettingsPageState extends State<SettingsPage> { | ||||
|                         onPressed: () { | ||||
|                           context.read<LogsProvider>().get().then((logs) { | ||||
|                             if (logs.isEmpty) { | ||||
|                               showMessage(ObtainiumError(tr('noLogs')), context); | ||||
|                               showMessage( | ||||
|                                   ObtainiumError(tr('noLogs')), context); | ||||
|                             } else { | ||||
|                               showDialog( | ||||
|                                   context: context, | ||||
|   | ||||
| @@ -281,7 +281,8 @@ class AppsProvider with ChangeNotifier { | ||||
|             '${downloadedFile.parent.path}/${app.id}-${downloadUrl.hashCode}.${downloadedFile.path.split('.').last}'); | ||||
|         if (apps[originalAppId] != null) { | ||||
|           await removeApps([originalAppId]); | ||||
|           await saveApps([app], onlyIfExists: !isTempIdBool && !idChangeWasAllowed); | ||||
|           await saveApps([app], | ||||
|               onlyIfExists: !isTempIdBool && !idChangeWasAllowed); | ||||
|         } | ||||
|       } | ||||
|     } else if (isTempIdBool) { | ||||
| @@ -716,8 +717,10 @@ class AppsProvider with ChangeNotifier { | ||||
|     if (app?.app == null) { | ||||
|       return false; | ||||
|     } | ||||
|     var naiveStandardVersionDetection = SourceProvider() | ||||
|         .getSource(app!.app.url, overrideSource: app.app.overrideSource) | ||||
|     var naiveStandardVersionDetection = | ||||
|         app!.app.additionalSettings['naiveStandardVersionDetection'] == true || | ||||
|             SourceProvider() | ||||
|                 .getSource(app.app.url, overrideSource: app.app.overrideSource) | ||||
|                 .naiveStandardVersionDetection; | ||||
|     return app.app.additionalSettings['trackOnly'] != true && | ||||
|         app.app.additionalSettings['versionDetection'] != | ||||
| @@ -739,7 +742,9 @@ class AppsProvider with ChangeNotifier { | ||||
|     var versionDetectionIsStandard = | ||||
|         app.additionalSettings['versionDetection'] == | ||||
|             'standardVersionDetection'; | ||||
|     var naiveStandardVersionDetection = SourceProvider() | ||||
|     var naiveStandardVersionDetection = | ||||
|         app.additionalSettings['naiveStandardVersionDetection'] == true || | ||||
|             SourceProvider() | ||||
|                 .getSource(app.url, overrideSource: app.overrideSource) | ||||
|                 .naiveStandardVersionDetection; | ||||
|     // FIRST, COMPARE THE APP'S REPORTED AND REAL INSTALLED VERSIONS, WHERE ONE IS NULL | ||||
| @@ -1055,12 +1060,21 @@ class AppsProvider with ChangeNotifier { | ||||
|   } | ||||
|  | ||||
|   List<String> getAppsSortedByUpdateCheckTime( | ||||
|       {DateTime? ignoreAppsCheckedAfter}) { | ||||
|       {DateTime? ignoreAppsCheckedAfter, | ||||
|       bool onlyCheckInstalledOrTrackOnlyApps = false}) { | ||||
|     List<String> appIds = apps.values | ||||
|         .where((app) => | ||||
|             app.app.lastUpdateCheck == null || | ||||
|             ignoreAppsCheckedAfter == null || | ||||
|             app.app.lastUpdateCheck!.isBefore(ignoreAppsCheckedAfter)) | ||||
|         .where((app) { | ||||
|           if (!onlyCheckInstalledOrTrackOnlyApps) { | ||||
|             return true; | ||||
|           } else { | ||||
|             return app.app.installedVersion != null || | ||||
|                 app.app.additionalSettings['trackOnly'] == true; | ||||
|           } | ||||
|         }) | ||||
|         .map((e) => e.app.id) | ||||
|         .toList(); | ||||
|     appIds.sort((a, b) => | ||||
| @@ -1073,14 +1087,18 @@ class AppsProvider with ChangeNotifier { | ||||
|   Future<List<App>> checkUpdates( | ||||
|       {DateTime? ignoreAppsCheckedAfter, | ||||
|       bool throwErrorsForRetry = false, | ||||
|       List<String>? specificIds}) async { | ||||
|       List<String>? specificIds, | ||||
|       SettingsProvider? sp}) async { | ||||
|     SettingsProvider settingsProvider = sp ?? this.settingsProvider; | ||||
|     List<App> updates = []; | ||||
|     MultiAppMultiError errors = MultiAppMultiError(); | ||||
|     if (!gettingUpdates) { | ||||
|       gettingUpdates = true; | ||||
|       try { | ||||
|         List<String> appIds = getAppsSortedByUpdateCheckTime( | ||||
|             ignoreAppsCheckedAfter: ignoreAppsCheckedAfter); | ||||
|             ignoreAppsCheckedAfter: ignoreAppsCheckedAfter, | ||||
|             onlyCheckInstalledOrTrackOnlyApps: | ||||
|                 settingsProvider.onlyCheckInstalledOrTrackOnlyApps); | ||||
|         if (specificIds != null) { | ||||
|           appIds = appIds.where((aId) => specificIds.contains(aId)).toList(); | ||||
|         } | ||||
| @@ -1362,7 +1380,9 @@ Future<void> bgUpdateCheck(int taskId, Map<String, dynamic>? params) async { | ||||
|                 entry['key'] as String, entry['value'] as int)) | ||||
|             .toList() ?? | ||||
|         appsProvider | ||||
|             .getAppsSortedByUpdateCheckTime() | ||||
|             .getAppsSortedByUpdateCheckTime( | ||||
|                 onlyCheckInstalledOrTrackOnlyApps: appsProvider | ||||
|                     .settingsProvider.onlyCheckInstalledOrTrackOnlyApps) | ||||
|             .map((e) => MapEntry(e, 0))) | ||||
|   ]; | ||||
|   List<MapEntry<String, int>> toInstall = <MapEntry<String, int>>[ | ||||
| @@ -1446,7 +1466,8 @@ Future<void> bgUpdateCheck(int taskId, Map<String, dynamic>? params) async { | ||||
|       // Check for updates | ||||
|       notificationsProvider.notify(notif, cancelExisting: true); | ||||
|       updates = await appsProvider.checkUpdates( | ||||
|           specificIds: toCheck.map((e) => e.key).toList()); | ||||
|           specificIds: toCheck.map((e) => e.key).toList(), | ||||
|           sp: appsProvider.settingsProvider); | ||||
|     } catch (e) { | ||||
|       // If there were errors, group them into toRetry and toThrow based on max retry count per app | ||||
|       if (e is Map) { | ||||
|   | ||||
| @@ -406,4 +406,13 @@ class SettingsProvider with ChangeNotifier { | ||||
|     prefs?.setBool('autoExportOnChanges', val); | ||||
|     notifyListeners(); | ||||
|   } | ||||
|  | ||||
|   bool get onlyCheckInstalledOrTrackOnlyApps { | ||||
|     return prefs?.getBool('onlyCheckInstalledOrTrackOnlyApps') ?? false; | ||||
|   } | ||||
|  | ||||
|   set onlyCheckInstalledOrTrackOnlyApps(bool val) { | ||||
|     prefs?.setBool('onlyCheckInstalledOrTrackOnlyApps', val); | ||||
|     notifyListeners(); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -676,7 +676,6 @@ class SourceProvider { | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|     String apkVersion = apk.version.replaceAll('/', '-'); | ||||
|     var name = currentApp != null ? currentApp.name.trim() : ''; | ||||
|     name = name.isNotEmpty ? name : apk.names.name; | ||||
|     App finalApp = App( | ||||
| @@ -691,7 +690,7 @@ class SourceProvider { | ||||
|         apk.names.author, | ||||
|         name, | ||||
|         currentApp?.installedVersion, | ||||
|         apkVersion, | ||||
|         apk.version, | ||||
|         apk.apkUrls, | ||||
|         apk.apkUrls.length - 1 >= 0 ? apk.apkUrls.length - 1 : 0, | ||||
|         additionalSettings, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user