diff --git a/assets/translations/bs.json b/assets/translations/bs.json index acca651..d3bf65a 100644 --- a/assets/translations/bs.json +++ b/assets/translations/bs.json @@ -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?" diff --git a/assets/translations/cs.json b/assets/translations/cs.json index df3be45..b4b052e 100644 --- a/assets/translations/cs.json +++ b/assets/translations/cs.json @@ -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?" diff --git a/assets/translations/de.json b/assets/translations/de.json index b8a39ad..f25949f 100644 --- a/assets/translations/de.json +++ b/assets/translations/de.json @@ -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?" diff --git a/assets/translations/en.json b/assets/translations/en.json index 6d8311c..4e4626a 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -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?" diff --git a/assets/translations/es.json b/assets/translations/es.json index a73970b..481838a 100644 --- a/assets/translations/es.json +++ b/assets/translations/es.json @@ -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?" diff --git a/assets/translations/fa.json b/assets/translations/fa.json index f051b48..013ee34 100644 --- a/assets/translations/fa.json +++ b/assets/translations/fa.json @@ -274,6 +274,7 @@ "downloadingXNotifChannel": "در حال دانلود {}", "completeAppInstallationNotifChannel": "نصب کامل برنامه", "checkingForUpdatesNotifChannel": "بررسی به‌روزرسانی‌ها", + "onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates", "removeAppQuestion": { "one": "برنامه حذف شود؟", "other": "برنامه ها حذف شوند؟" diff --git a/assets/translations/fr.json b/assets/translations/fr.json index 649b0ff..e5d3bba 100644 --- a/assets/translations/fr.json +++ b/assets/translations/fr.json @@ -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 ?" diff --git a/assets/translations/hu.json b/assets/translations/hu.json index b41dfb4..12a288f 100644 --- a/assets/translations/hu.json +++ b/assets/translations/hu.json @@ -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?" diff --git a/assets/translations/it.json b/assets/translations/it.json index 3a0f8a8..e00c0b8 100644 --- a/assets/translations/it.json +++ b/assets/translations/it.json @@ -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?" diff --git a/assets/translations/ja.json b/assets/translations/ja.json index 596669d..385de2d 100644 --- a/assets/translations/ja.json +++ b/assets/translations/ja.json @@ -274,6 +274,7 @@ "downloadingXNotifChannel": "{} をダウンロード中", "completeAppInstallationNotifChannel": "アプリのインストールを完了する", "checkingForUpdatesNotifChannel": "アップデートを確認中", + "onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates", "removeAppQuestion": { "one": "アプリを削除しますか?", "other": "アプリを削除しますか?" diff --git a/assets/translations/pl.json b/assets/translations/pl.json index 9aa9f31..bb55a51 100644 --- a/assets/translations/pl.json +++ b/assets/translations/pl.json @@ -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?", diff --git a/assets/translations/pt.json b/assets/translations/pt.json index 047b9f8..9611468 100644 --- a/assets/translations/pt.json +++ b/assets/translations/pt.json @@ -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?" diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 1f9d373..f02a7da 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -274,6 +274,7 @@ "downloadingXNotifChannel": "Загрузка {}", "completeAppInstallationNotifChannel": "Завершение установки приложения", "checkingForUpdatesNotifChannel": "Проверка обновлений", + "onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates", "removeAppQuestion": { "one": "Удалить приложение?", "other": "Удалить приложения?" diff --git a/assets/translations/zh.json b/assets/translations/zh.json index b6580ce..d1e64e8 100644 --- a/assets/translations/zh.json +++ b/assets/translations/zh.json @@ -274,6 +274,7 @@ "downloadingXNotifChannel": "正在下载{}", "completeAppInstallationNotifChannel": "完成应用安装", "checkingForUpdatesNotifChannel": "正在检查更新", + "onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates", "removeAppQuestion": { "one": "是否删除应用?", "other": "是否删除应用?" diff --git a/lib/app_sources/html.dart b/lib/app_sources/html.dart index 91911e7..a2dacdb 100644 --- a/lib/app_sources/html.dart +++ b/lib/app_sources/html.dart @@ -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(); } diff --git a/lib/main.dart b/lib/main.dart index b353775..1ca5444 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -19,7 +19,7 @@ import 'package:easy_localization/src/easy_localization_controller.dart'; // ignore: implementation_imports import 'package:easy_localization/src/localization.dart'; -const String currentVersion = '0.14.30'; +const String currentVersion = '0.14.31'; const String currentReleaseTag = 'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES diff --git a/lib/pages/settings.dart b/lib/pages/settings.dart index 265be4e..c36c958 100644 --- a/lib/pages/settings.dart +++ b/lib/pages/settings.dart @@ -310,6 +310,23 @@ class _SettingsPageState extends State { }) ], ), + 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 { onPressed: () { context.read().get().then((logs) { if (logs.isEmpty) { - showMessage(ObtainiumError(tr('noLogs')), context); + showMessage( + ObtainiumError(tr('noLogs')), context); } else { showDialog( context: context, diff --git a/lib/providers/apps_provider.dart b/lib/providers/apps_provider.dart index 3ef8e73..d4085d6 100644 --- a/lib/providers/apps_provider.dart +++ b/lib/providers/apps_provider.dart @@ -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,9 +717,11 @@ class AppsProvider with ChangeNotifier { if (app?.app == null) { return false; } - var naiveStandardVersionDetection = SourceProvider() - .getSource(app!.app.url, overrideSource: app.app.overrideSource) - .naiveStandardVersionDetection; + 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'] != 'releaseDateAsVersion' && @@ -739,9 +742,11 @@ class AppsProvider with ChangeNotifier { var versionDetectionIsStandard = app.additionalSettings['versionDetection'] == 'standardVersionDetection'; - var naiveStandardVersionDetection = SourceProvider() - .getSource(app.url, overrideSource: app.overrideSource) - .naiveStandardVersionDetection; + 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 if (installedInfo == null && app.installedVersion != null && !trackOnly) { // App says it's installed but isn't really (and isn't track only) - set to not installed @@ -1055,12 +1060,21 @@ class AppsProvider with ChangeNotifier { } List getAppsSortedByUpdateCheckTime( - {DateTime? ignoreAppsCheckedAfter}) { + {DateTime? ignoreAppsCheckedAfter, + bool onlyCheckInstalledOrTrackOnlyApps = false}) { List 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> checkUpdates( {DateTime? ignoreAppsCheckedAfter, bool throwErrorsForRetry = false, - List? specificIds}) async { + List? specificIds, + SettingsProvider? sp}) async { + SettingsProvider settingsProvider = sp ?? this.settingsProvider; List updates = []; MultiAppMultiError errors = MultiAppMultiError(); if (!gettingUpdates) { gettingUpdates = true; try { List 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 bgUpdateCheck(int taskId, Map? params) async { entry['key'] as String, entry['value'] as int)) .toList() ?? appsProvider - .getAppsSortedByUpdateCheckTime() + .getAppsSortedByUpdateCheckTime( + onlyCheckInstalledOrTrackOnlyApps: appsProvider + .settingsProvider.onlyCheckInstalledOrTrackOnlyApps) .map((e) => MapEntry(e, 0))) ]; List> toInstall = >[ @@ -1446,7 +1466,8 @@ Future bgUpdateCheck(int taskId, Map? 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) { diff --git a/lib/providers/settings_provider.dart b/lib/providers/settings_provider.dart index 2085168..d72fd8d 100644 --- a/lib/providers/settings_provider.dart +++ b/lib/providers/settings_provider.dart @@ -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(); + } } diff --git a/lib/providers/source_provider.dart b/lib/providers/source_provider.dart index 0285aa7..e5ea114 100644 --- a/lib/providers/source_provider.dart +++ b/lib/providers/source_provider.dart @@ -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, diff --git a/pubspec.lock b/pubspec.lock index 39e4c03..52d0c32 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -118,10 +118,10 @@ packages: dependency: "direct main" description: name: connectivity_plus - sha256: "94d51c6f1299133a2baa4c5c3d2c11ec7d7fb4768dee5c52a56f7d7522fcf70e" + sha256: b502a681ba415272ecc41400bd04fe543ed1a62632137dc84d25a91e7746f55f url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "5.0.1" connectivity_plus_platform_interface: dependency: transitive description: @@ -182,10 +182,10 @@ packages: dependency: "direct main" description: name: device_info_plus - sha256: "86add5ef97215562d2e090535b0a16f197902b10c369c558a100e74ea06e8659" + sha256: "7035152271ff67b072a211152846e9f1259cf1be41e34cd3e0b5463d2d6b8419" url: "https://pub.dev" source: hosted - version: "9.0.3" + version: "9.1.0" device_info_plus_platform_interface: dependency: transitive description: @@ -198,10 +198,10 @@ packages: dependency: "direct main" description: name: dynamic_color - sha256: "96bff3df72e3d428bda2b874c7a521e8c86f592cae626ea594922fcc8d166e0c" + sha256: "8b8bd1d798bd393e11eddeaa8ae95b12ff028bf7d5998fc5d003488cd5f4ce2f" url: "https://pub.dev" source: hosted - version: "1.6.7" + version: "1.6.8" easy_localization: dependency: "direct main" description: @@ -283,10 +283,10 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 + sha256: ad76540d21c066228ee3f9d1dad64a9f7e46530e8bb7c85011a88bc1fd874bc5 url: "https://pub.dev" source: hosted - version: "2.0.3" + version: "3.0.0" flutter_local_notifications: dependency: "direct main" description: @@ -418,10 +418,10 @@ packages: dependency: transitive description: name: lints - sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "3.0.0" markdown: dependency: transitive description: @@ -618,18 +618,18 @@ packages: dependency: "direct main" description: name: share_plus - sha256: "6cec740fa0943a826951223e76218df002804adb588235a8910dc3d6b0654e11" + sha256: f74fc3f1cbd99f39760182e176802f693fa0ec9625c045561cfad54681ea93dd url: "https://pub.dev" source: hosted - version: "7.1.0" + version: "7.2.1" share_plus_platform_interface: dependency: transitive description: name: share_plus_platform_interface - sha256: "357412af4178d8e11d14f41723f80f12caea54cf0d5cd29af9dcdab85d58aea7" + sha256: df08bc3a07d01f5ea47b45d03ffcba1fa9cd5370fb44b3f38c70e42cced0f956 url: "https://pub.dev" source: hosted - version: "3.3.0" + version: "3.3.1" shared_preferences: dependency: "direct main" description: @@ -707,6 +707,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" sqflite: dependency: "direct main" description: @@ -855,10 +863,10 @@ packages: dependency: transitive description: name: uuid - sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" + sha256: b715b8d3858b6fa9f68f87d20d98830283628014750c2b09b6f516c1da4af2a7 url: "https://pub.dev" source: hosted - version: "3.0.7" + version: "4.1.0" vector_math: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 2d61b0a..9f61728 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.14.30+222 # When changing this, update the tag in main() accordingly +version: 0.14.31+223 # When changing this, update the tag in main() accordingly environment: sdk: '>=3.0.0 <4.0.0' @@ -77,7 +77,7 @@ dev_dependencies: # activated in the `analysis_options.yaml` file located at the root of your # package. See that file for information about deactivating specific lint # rules and activating additional ones. - flutter_lints: ^2.0.1 + flutter_lints: ^3.0.0 flutter_launcher_icons: android: "ic_launcher"