Don't replace / in versions (#1023)
Fix HTML version extraction (#1021)
Update check only for installed apps (#1012)
This commit is contained in:
Imran Remtulla
2023-10-18 19:42:15 -04:00
parent 6ead8d261c
commit 2518c70ec8
19 changed files with 79 additions and 16 deletions

View File

@@ -274,6 +274,7 @@
"downloadingXNotifChannel": "Preuzimanje {}", "downloadingXNotifChannel": "Preuzimanje {}",
"completeAppInstallationNotifChannel": "Dovršite instalaciju aplikacije", "completeAppInstallationNotifChannel": "Dovršite instalaciju aplikacije",
"checkingForUpdatesNotifChannel": "Tražim moguće nadogradnje", "checkingForUpdatesNotifChannel": "Tražim moguće nadogradnje",
"onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates",
"removeAppQuestion": { "removeAppQuestion": {
"one": "Želite li ukloniti aplikaciju?", "one": "Želite li ukloniti aplikaciju?",
"other": "Želite li ukloniti aplikacije?" "other": "Želite li ukloniti aplikacije?"

View File

@@ -274,6 +274,7 @@
"downloadingXNotifChannel": "download {}", "downloadingXNotifChannel": "download {}",
"completeAppInstallationNotifChannel": "Dokončit instalaci aplikace", "completeAppInstallationNotifChannel": "Dokončit instalaci aplikace",
"checkingForUpdatesNotifChannel": "Zkontrolovat aktualizace", "checkingForUpdatesNotifChannel": "Zkontrolovat aktualizace",
"onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates",
"removeAppQuestion": { "removeAppQuestion": {
"one": "Odstranit Apku?", "one": "Odstranit Apku?",
"other": "Odstranit Apky?" "other": "Odstranit Apky?"

View File

@@ -274,6 +274,7 @@
"downloadingXNotifChannel": "Lade {} herunter", "downloadingXNotifChannel": "Lade {} herunter",
"completeAppInstallationNotifChannel": "App Installation abschließen", "completeAppInstallationNotifChannel": "App Installation abschließen",
"checkingForUpdatesNotifChannel": "Nach Aktualisierungen suchen", "checkingForUpdatesNotifChannel": "Nach Aktualisierungen suchen",
"onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates",
"removeAppQuestion": { "removeAppQuestion": {
"one": "App entfernen?", "one": "App entfernen?",
"other": "Apps entfernen?" "other": "Apps entfernen?"

View File

@@ -274,6 +274,7 @@
"downloadingXNotifChannel": "Downloading {}", "downloadingXNotifChannel": "Downloading {}",
"completeAppInstallationNotifChannel": "Complete App Installation", "completeAppInstallationNotifChannel": "Complete App Installation",
"checkingForUpdatesNotifChannel": "Checking for Updates", "checkingForUpdatesNotifChannel": "Checking for Updates",
"onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates",
"removeAppQuestion": { "removeAppQuestion": {
"one": "Remove App?", "one": "Remove App?",
"other": "Remove Apps?" "other": "Remove Apps?"

View File

@@ -274,6 +274,7 @@
"downloadingXNotifChannel": "Descargando {}", "downloadingXNotifChannel": "Descargando {}",
"completeAppInstallationNotifChannel": "Instalación Completa de la Aplicación", "completeAppInstallationNotifChannel": "Instalación Completa de la Aplicación",
"checkingForUpdatesNotifChannel": "Buscando Actualizaciones", "checkingForUpdatesNotifChannel": "Buscando Actualizaciones",
"onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates",
"removeAppQuestion": { "removeAppQuestion": {
"one": "¿Eliminar Aplicación?", "one": "¿Eliminar Aplicación?",
"other": "¿Eliminar Aplicaciones?" "other": "¿Eliminar Aplicaciones?"

View File

@@ -274,6 +274,7 @@
"downloadingXNotifChannel": "در حال دانلود {}", "downloadingXNotifChannel": "در حال دانلود {}",
"completeAppInstallationNotifChannel": "نصب کامل برنامه", "completeAppInstallationNotifChannel": "نصب کامل برنامه",
"checkingForUpdatesNotifChannel": "بررسی به‌روزرسانی‌ها", "checkingForUpdatesNotifChannel": "بررسی به‌روزرسانی‌ها",
"onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates",
"removeAppQuestion": { "removeAppQuestion": {
"one": "برنامه حذف شود؟", "one": "برنامه حذف شود؟",
"other": "برنامه ها حذف شوند؟" "other": "برنامه ها حذف شوند؟"

View File

@@ -274,6 +274,7 @@
"downloadingXNotifChannel": "Téléchargement {}", "downloadingXNotifChannel": "Téléchargement {}",
"completeAppInstallationNotifChannel": "Installation complète de l'application", "completeAppInstallationNotifChannel": "Installation complète de l'application",
"checkingForUpdatesNotifChannel": "Vérification des mises à jour", "checkingForUpdatesNotifChannel": "Vérification des mises à jour",
"onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates",
"removeAppQuestion": { "removeAppQuestion": {
"one": "Supprimer l'application ?", "one": "Supprimer l'application ?",
"other": "Supprimer les applications ?" "other": "Supprimer les applications ?"

View File

@@ -274,6 +274,7 @@
"downloadingXNotifChannel": "{} letöltés", "downloadingXNotifChannel": "{} letöltés",
"completeAppInstallationNotifChannel": "Teljes app telepítés", "completeAppInstallationNotifChannel": "Teljes app telepítés",
"checkingForUpdatesNotifChannel": "Frissítések keresése", "checkingForUpdatesNotifChannel": "Frissítések keresése",
"onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates",
"removeAppQuestion": { "removeAppQuestion": {
"one": "Eltávolítja az alkalmazást?", "one": "Eltávolítja az alkalmazást?",
"other": "Eltávolítja az alkalmazást?" "other": "Eltávolítja az alkalmazást?"

View File

@@ -274,6 +274,7 @@
"downloadingXNotifChannel": "Scaricamento di {} in corso", "downloadingXNotifChannel": "Scaricamento di {} in corso",
"completeAppInstallationNotifChannel": "Completa l'installazione dell'app", "completeAppInstallationNotifChannel": "Completa l'installazione dell'app",
"checkingForUpdatesNotifChannel": "Controllo degli aggiornamenti in corso", "checkingForUpdatesNotifChannel": "Controllo degli aggiornamenti in corso",
"onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates",
"removeAppQuestion": { "removeAppQuestion": {
"one": "Rimuovere l'app?", "one": "Rimuovere l'app?",
"other": "Rimuovere le app?" "other": "Rimuovere le app?"

View File

@@ -274,6 +274,7 @@
"downloadingXNotifChannel": "{} をダウンロード中", "downloadingXNotifChannel": "{} をダウンロード中",
"completeAppInstallationNotifChannel": "アプリのインストールを完了する", "completeAppInstallationNotifChannel": "アプリのインストールを完了する",
"checkingForUpdatesNotifChannel": "アップデートを確認中", "checkingForUpdatesNotifChannel": "アップデートを確認中",
"onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates",
"removeAppQuestion": { "removeAppQuestion": {
"one": "アプリを削除しますか?", "one": "アプリを削除しますか?",
"other": "アプリを削除しますか?" "other": "アプリを削除しますか?"

View File

@@ -274,6 +274,7 @@
"downloadingXNotifChannel": "Pobieranie aplikacji", "downloadingXNotifChannel": "Pobieranie aplikacji",
"completeAppInstallationNotifChannel": "Ukończenie instalacji aplikacji", "completeAppInstallationNotifChannel": "Ukończenie instalacji aplikacji",
"checkingForUpdatesNotifChannel": "Sprawdzanie dostępności aktualizacji", "checkingForUpdatesNotifChannel": "Sprawdzanie dostępności aktualizacji",
"onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates",
"removeAppQuestion": { "removeAppQuestion": {
"one": "Usunąć aplikację?", "one": "Usunąć aplikację?",
"few": "Usunąć aplikacje?", "few": "Usunąć aplikacje?",

View File

@@ -274,6 +274,7 @@
"downloadingXNotifChannel": "Baixando {}", "downloadingXNotifChannel": "Baixando {}",
"completeAppInstallationNotifChannel": "Instalação completa do App", "completeAppInstallationNotifChannel": "Instalação completa do App",
"checkingForUpdatesNotifChannel": "Checando por Atualizações", "checkingForUpdatesNotifChannel": "Checando por Atualizações",
"onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates",
"removeAppQuestion": { "removeAppQuestion": {
"one": "Remover App?", "one": "Remover App?",
"other": "Remover Apps?" "other": "Remover Apps?"

View File

@@ -274,6 +274,7 @@
"downloadingXNotifChannel": "Загрузка {}", "downloadingXNotifChannel": "Загрузка {}",
"completeAppInstallationNotifChannel": "Завершение установки приложения", "completeAppInstallationNotifChannel": "Завершение установки приложения",
"checkingForUpdatesNotifChannel": "Проверка обновлений", "checkingForUpdatesNotifChannel": "Проверка обновлений",
"onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates",
"removeAppQuestion": { "removeAppQuestion": {
"one": "Удалить приложение?", "one": "Удалить приложение?",
"other": "Удалить приложения?" "other": "Удалить приложения?"

View File

@@ -274,6 +274,7 @@
"downloadingXNotifChannel": "正在下载{}", "downloadingXNotifChannel": "正在下载{}",
"completeAppInstallationNotifChannel": "完成应用安装", "completeAppInstallationNotifChannel": "完成应用安装",
"checkingForUpdatesNotifChannel": "正在检查更新", "checkingForUpdatesNotifChannel": "正在检查更新",
"onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates",
"removeAppQuestion": { "removeAppQuestion": {
"one": "是否删除应用?", "one": "是否删除应用?",
"other": "是否删除应用?" "other": "是否删除应用?"

View File

@@ -219,7 +219,9 @@ class HTML extends AppSource {
additionalSettings['versionExtractionRegEx'] as String?; additionalSettings['versionExtractionRegEx'] as String?;
if (versionExtractionRegEx?.isNotEmpty == true) { if (versionExtractionRegEx?.isNotEmpty == true) {
var match = RegExp(versionExtractionRegEx!).allMatches( 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) { if (match.isEmpty) {
throw NoVersionError(); throw NoVersionError();
} }

View File

@@ -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, height32,
Text( Text(
tr('sourceSpecific'), tr('sourceSpecific'),
@@ -535,7 +552,8 @@ class _SettingsPageState extends State<SettingsPage> {
onPressed: () { onPressed: () {
context.read<LogsProvider>().get().then((logs) { context.read<LogsProvider>().get().then((logs) {
if (logs.isEmpty) { if (logs.isEmpty) {
showMessage(ObtainiumError(tr('noLogs')), context); showMessage(
ObtainiumError(tr('noLogs')), context);
} else { } else {
showDialog( showDialog(
context: context, context: context,

View File

@@ -281,7 +281,8 @@ class AppsProvider with ChangeNotifier {
'${downloadedFile.parent.path}/${app.id}-${downloadUrl.hashCode}.${downloadedFile.path.split('.').last}'); '${downloadedFile.parent.path}/${app.id}-${downloadUrl.hashCode}.${downloadedFile.path.split('.').last}');
if (apps[originalAppId] != null) { if (apps[originalAppId] != null) {
await removeApps([originalAppId]); await removeApps([originalAppId]);
await saveApps([app], onlyIfExists: !isTempIdBool && !idChangeWasAllowed); await saveApps([app],
onlyIfExists: !isTempIdBool && !idChangeWasAllowed);
} }
} }
} else if (isTempIdBool) { } else if (isTempIdBool) {
@@ -716,9 +717,11 @@ class AppsProvider with ChangeNotifier {
if (app?.app == null) { if (app?.app == null) {
return false; return false;
} }
var naiveStandardVersionDetection = SourceProvider() var naiveStandardVersionDetection =
.getSource(app!.app.url, overrideSource: app.app.overrideSource) app!.app.additionalSettings['naiveStandardVersionDetection'] == true ||
.naiveStandardVersionDetection; SourceProvider()
.getSource(app.app.url, overrideSource: app.app.overrideSource)
.naiveStandardVersionDetection;
return app.app.additionalSettings['trackOnly'] != true && return app.app.additionalSettings['trackOnly'] != true &&
app.app.additionalSettings['versionDetection'] != app.app.additionalSettings['versionDetection'] !=
'releaseDateAsVersion' && 'releaseDateAsVersion' &&
@@ -739,9 +742,11 @@ class AppsProvider with ChangeNotifier {
var versionDetectionIsStandard = var versionDetectionIsStandard =
app.additionalSettings['versionDetection'] == app.additionalSettings['versionDetection'] ==
'standardVersionDetection'; 'standardVersionDetection';
var naiveStandardVersionDetection = SourceProvider() var naiveStandardVersionDetection =
.getSource(app.url, overrideSource: app.overrideSource) app.additionalSettings['naiveStandardVersionDetection'] == true ||
.naiveStandardVersionDetection; SourceProvider()
.getSource(app.url, overrideSource: app.overrideSource)
.naiveStandardVersionDetection;
// FIRST, COMPARE THE APP'S REPORTED AND REAL INSTALLED VERSIONS, WHERE ONE IS NULL // FIRST, COMPARE THE APP'S REPORTED AND REAL INSTALLED VERSIONS, WHERE ONE IS NULL
if (installedInfo == null && app.installedVersion != null && !trackOnly) { 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 // 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<String> getAppsSortedByUpdateCheckTime( List<String> getAppsSortedByUpdateCheckTime(
{DateTime? ignoreAppsCheckedAfter}) { {DateTime? ignoreAppsCheckedAfter,
bool onlyCheckInstalledOrTrackOnlyApps = false}) {
List<String> appIds = apps.values List<String> appIds = apps.values
.where((app) => .where((app) =>
app.app.lastUpdateCheck == null || app.app.lastUpdateCheck == null ||
ignoreAppsCheckedAfter == null || ignoreAppsCheckedAfter == null ||
app.app.lastUpdateCheck!.isBefore(ignoreAppsCheckedAfter)) 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) .map((e) => e.app.id)
.toList(); .toList();
appIds.sort((a, b) => appIds.sort((a, b) =>
@@ -1073,14 +1087,18 @@ class AppsProvider with ChangeNotifier {
Future<List<App>> checkUpdates( Future<List<App>> checkUpdates(
{DateTime? ignoreAppsCheckedAfter, {DateTime? ignoreAppsCheckedAfter,
bool throwErrorsForRetry = false, bool throwErrorsForRetry = false,
List<String>? specificIds}) async { List<String>? specificIds,
SettingsProvider? sp}) async {
SettingsProvider settingsProvider = sp ?? this.settingsProvider;
List<App> updates = []; List<App> updates = [];
MultiAppMultiError errors = MultiAppMultiError(); MultiAppMultiError errors = MultiAppMultiError();
if (!gettingUpdates) { if (!gettingUpdates) {
gettingUpdates = true; gettingUpdates = true;
try { try {
List<String> appIds = getAppsSortedByUpdateCheckTime( List<String> appIds = getAppsSortedByUpdateCheckTime(
ignoreAppsCheckedAfter: ignoreAppsCheckedAfter); ignoreAppsCheckedAfter: ignoreAppsCheckedAfter,
onlyCheckInstalledOrTrackOnlyApps:
settingsProvider.onlyCheckInstalledOrTrackOnlyApps);
if (specificIds != null) { if (specificIds != null) {
appIds = appIds.where((aId) => specificIds.contains(aId)).toList(); 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)) entry['key'] as String, entry['value'] as int))
.toList() ?? .toList() ??
appsProvider appsProvider
.getAppsSortedByUpdateCheckTime() .getAppsSortedByUpdateCheckTime(
onlyCheckInstalledOrTrackOnlyApps: appsProvider
.settingsProvider.onlyCheckInstalledOrTrackOnlyApps)
.map((e) => MapEntry(e, 0))) .map((e) => MapEntry(e, 0)))
]; ];
List<MapEntry<String, int>> toInstall = <MapEntry<String, int>>[ 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 // Check for updates
notificationsProvider.notify(notif, cancelExisting: true); notificationsProvider.notify(notif, cancelExisting: true);
updates = await appsProvider.checkUpdates( updates = await appsProvider.checkUpdates(
specificIds: toCheck.map((e) => e.key).toList()); specificIds: toCheck.map((e) => e.key).toList(),
sp: appsProvider.settingsProvider);
} catch (e) { } catch (e) {
// If there were errors, group them into toRetry and toThrow based on max retry count per app // If there were errors, group them into toRetry and toThrow based on max retry count per app
if (e is Map) { if (e is Map) {

View File

@@ -406,4 +406,13 @@ class SettingsProvider with ChangeNotifier {
prefs?.setBool('autoExportOnChanges', val); prefs?.setBool('autoExportOnChanges', val);
notifyListeners(); notifyListeners();
} }
bool get onlyCheckInstalledOrTrackOnlyApps {
return prefs?.getBool('onlyCheckInstalledOrTrackOnlyApps') ?? false;
}
set onlyCheckInstalledOrTrackOnlyApps(bool val) {
prefs?.setBool('onlyCheckInstalledOrTrackOnlyApps', val);
notifyListeners();
}
} }

View File

@@ -676,7 +676,6 @@ class SourceProvider {
} }
} }
} }
String apkVersion = apk.version.replaceAll('/', '-');
var name = currentApp != null ? currentApp.name.trim() : ''; var name = currentApp != null ? currentApp.name.trim() : '';
name = name.isNotEmpty ? name : apk.names.name; name = name.isNotEmpty ? name : apk.names.name;
App finalApp = App( App finalApp = App(
@@ -691,7 +690,7 @@ class SourceProvider {
apk.names.author, apk.names.author,
name, name,
currentApp?.installedVersion, currentApp?.installedVersion,
apkVersion, apk.version,
apk.apkUrls, apk.apkUrls,
apk.apkUrls.length - 1 >= 0 ? apk.apkUrls.length - 1 : 0, apk.apkUrls.length - 1 >= 0 ? apk.apkUrls.length - 1 : 0,
additionalSettings, additionalSettings,