diff --git a/assets/translations/de.json b/assets/translations/de.json index 87ecd2d..06c1337 100644 --- a/assets/translations/de.json +++ b/assets/translations/de.json @@ -235,6 +235,7 @@ "checkOnStart": "Überprüfe einmalig beim Start", "tryInferAppIdFromCode": "Try inferring App ID from source code", "removeOnExternalUninstall": "Automatically remove externally uninstalled Apps", + "pickHighestVersionCode": "Auto-select highest version code APK", "removeAppQuestion": { "one": "App entfernen?", "other": "Apps entfernen?" diff --git a/assets/translations/en.json b/assets/translations/en.json index 8bed92b..e06e460 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -235,6 +235,7 @@ "checkOnStart": "Check Once on Start", "tryInferAppIdFromCode": "Try inferring App ID from source code", "removeOnExternalUninstall": "Automatically remove externally uninstalled Apps", + "pickHighestVersionCode": "Auto-select highest version code APK", "removeAppQuestion": { "one": "Remove App?", "other": "Remove Apps?" diff --git a/assets/translations/es.json b/assets/translations/es.json index 3f05649..4e53acc 100644 --- a/assets/translations/es.json +++ b/assets/translations/es.json @@ -235,6 +235,7 @@ "checkOnStart": "Check Once on Start", "tryInferAppIdFromCode": "Try inferring App ID from source code", "removeOnExternalUninstall": "Automatically remove externally uninstalled Apps", + "pickHighestVersionCode": "Auto-select highest version code APK", "removeAppQuestion": { "one": "¿Eliminar Aplicación?", "other": "¿Eliminar Aplicaciones?" diff --git a/assets/translations/fa.json b/assets/translations/fa.json index 1673f7b..0f3c621 100644 --- a/assets/translations/fa.json +++ b/assets/translations/fa.json @@ -235,6 +235,7 @@ "checkOnStart": "بررسی در شروع", "tryInferAppIdFromCode": "شناسه برنامه را از کد منبع استنباط کنید", "removeOnExternalUninstall": "Automatically remove externally uninstalled Apps", + "pickHighestVersionCode": "Auto-select highest version code APK", "removeAppQuestion": { "one": "برنامه حذف شود؟", "other": "برنامه ها حذف شوند؟" diff --git a/assets/translations/fr.json b/assets/translations/fr.json index 6a804b6..315f3d4 100644 --- a/assets/translations/fr.json +++ b/assets/translations/fr.json @@ -235,6 +235,7 @@ "checkOnStart": "Check Once on Start", "tryInferAppIdFromCode": "Try inferring App ID from source code", "removeOnExternalUninstall": "Automatically remove externally uninstalled Apps", + "pickHighestVersionCode": "Auto-select highest version code APK", "removeAppQuestion": { "one": "Supprimer l'application ?", "other": "Supprimer les applications ?" diff --git a/assets/translations/hu.json b/assets/translations/hu.json index c6ebc55..9927e40 100644 --- a/assets/translations/hu.json +++ b/assets/translations/hu.json @@ -234,6 +234,7 @@ "checkOnStart": "Egyszer az indításkor", "tryInferAppIdFromCode": "Próbálja kikövetkeztetni az app azonosítót a forráskódból", "removeOnExternalUninstall": "Automatically remove externally uninstalled Apps", + "pickHighestVersionCode": "Auto-select highest version code APK", "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 c06180b..6450895 100644 --- a/assets/translations/it.json +++ b/assets/translations/it.json @@ -235,6 +235,7 @@ "checkOnStart": "Controlla una volta all'avvio", "tryInferAppIdFromCode": "Prova a dedurre l'ID dell'app dal codice sorgente", "removeOnExternalUninstall": "Automatically remove externally uninstalled Apps", + "pickHighestVersionCode": "Auto-select highest version code APK", "removeAppQuestion": { "one": "Rimuovere l'app?", "other": "Rimuovere le app?" diff --git a/assets/translations/ja.json b/assets/translations/ja.json index 270e3a2..00f4412 100644 --- a/assets/translations/ja.json +++ b/assets/translations/ja.json @@ -235,6 +235,7 @@ "checkOnStart": "Check Once on Start", "tryInferAppIdFromCode": "Try inferring App ID from source code", "removeOnExternalUninstall": "Automatically remove externally uninstalled Apps", + "pickHighestVersionCode": "Auto-select highest version code APK", "removeAppQuestion": { "one": "アプリを削除しますか?", "other": "アプリを削除しますか?" diff --git a/assets/translations/pl.json b/assets/translations/pl.json index 2837709..0885008 100644 --- a/assets/translations/pl.json +++ b/assets/translations/pl.json @@ -239,6 +239,7 @@ "checkOnStart": "Sprawdź raz przy starcie", "tryInferAppIdFromCode": "Spróbuj wywnioskować identyfikator aplikacji z kodu źródłowego", "removeOnExternalUninstall": "Automatically remove externally uninstalled Apps", + "pickHighestVersionCode": "Auto-select highest version code APK", "removeAppQuestion": { "one": "Usunąć aplikację?", "other": "Usunąć aplikacje?" diff --git a/assets/translations/ru.json b/assets/translations/ru.json index d036167..2e8da04 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -235,6 +235,7 @@ "checkOnStart": "Проверить один раз при запуске", "tryInferAppIdFromCode": "Попытаться определить ID приложения из исходного кода", "removeOnExternalUninstall": "Automatically remove externally uninstalled Apps", + "pickHighestVersionCode": "Auto-select highest version code APK", "removeAppQuestion": { "one": "Удалить приложение?", "other": "Удалить приложения?" diff --git a/assets/translations/zh.json b/assets/translations/zh.json index 81179e9..0439230 100644 --- a/assets/translations/zh.json +++ b/assets/translations/zh.json @@ -235,6 +235,7 @@ "checkOnStart": "启动时进行一次检查", "tryInferAppIdFromCode": "尝试从源代码推断应用 ID", "removeOnExternalUninstall": "Automatically remove externally uninstalled Apps", + "pickHighestVersionCode": "Auto-select highest version code APK", "removeAppQuestion": { "one": "是否删除应用?", "other": "是否删除应用?" diff --git a/lib/app_sources/fdroidrepo.dart b/lib/app_sources/fdroidrepo.dart index 9bf2931..31f8435 100644 --- a/lib/app_sources/fdroidrepo.dart +++ b/lib/app_sources/fdroidrepo.dart @@ -14,6 +14,10 @@ class FDroidRepo extends AppSource { label: tr('appIdOrName'), hint: tr('reposHaveMultipleApps'), required: true) + ], + [ + GeneratedFormSwitch('pickHighestVersionCode', + label: tr('pickHighestVersionCode'), defaultValue: false) ] ]; } @@ -24,6 +28,7 @@ class FDroidRepo extends AppSource { Map additionalSettings, ) async { String? appIdOrName = additionalSettings['appIdOrName']; + bool pickHighestVersionCode = additionalSettings['pickHighestVersionCode']; if (appIdOrName == null) { throw NoReleasesError(); } @@ -62,10 +67,19 @@ class FDroidRepo extends AppSource { if (latestVersion == null) { throw NoVersionError(); } - List apkUrls = releases + var latestVersionReleases = releases .where((element) => element.querySelector('version')?.innerHtml == latestVersion && element.querySelector('apkname') != null) + .toList(); + if (latestVersionReleases.length > 1 && pickHighestVersionCode) { + latestVersionReleases.sort((e1, e2) { + return int.parse(e2.querySelector('versioncode')!.innerHtml) + .compareTo(int.parse(e1.querySelector('versioncode')!.innerHtml)); + }); + latestVersionReleases = [latestVersionReleases[0]]; + } + List apkUrls = latestVersionReleases .map((e) => '$standardUrl/${e.querySelector('apkname')!.innerHtml}') .toList(); return APKDetails(latestVersion, getApkUrlsFromUrls(apkUrls),