Allow versionCode to be used as the version for comparison (#1269)

This commit is contained in:
Imran Remtulla
2024-01-11 20:10:20 -05:00
parent 4fcad92e1d
commit e63c1399dd
19 changed files with 43 additions and 12 deletions

View File

@@ -287,6 +287,7 @@
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku is not running",
"useVersionCodeAsOSVersion": "Use app versionCode as OS-detected version",
"requestHeader": "Request header",
"removeAppQuestion": {
"one": "Želite li ukloniti aplikaciju?",

View File

@@ -287,6 +287,7 @@
"shizuku": "Shizuku",
"root": "Správce",
"shizukuBinderNotFound": "Shizuku neběží",
"useVersionCodeAsOSVersion": "Use app versionCode as OS-detected version",
"requestHeader": "Request header",
"removeAppQuestion": {
"one": "Odstranit Apku?",

View File

@@ -287,6 +287,7 @@
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku läuft nicht",
"useVersionCodeAsOSVersion": "Use app versionCode as OS-detected version",
"requestHeader": "Request header",
"removeAppQuestion": {
"one": "App entfernen?",

View File

@@ -289,6 +289,7 @@
"shizukuBinderNotFound": "Сompatible Shizuku service wasn't found",
"useSystemFont": "Use the system font",
"systemFontError": "Error loading the system font: {}",
"useVersionCodeAsOSVersion": "Use app versionCode as OS-detected version",
"requestHeader": "Request header",
"removeAppQuestion": {
"one": "Remove App?",

View File

@@ -287,6 +287,7 @@
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku no está operativo",
"useVersionCodeAsOSVersion": "Use app versionCode as OS-detected version",
"requestHeader": "Request header",
"removeAppQuestion": {
"one": "¿Eliminar Aplicación?",

View File

@@ -287,6 +287,7 @@
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku is not running",
"useVersionCodeAsOSVersion": "Use app versionCode as OS-detected version",
"requestHeader": "Request header",
"removeAppQuestion": {
"one": "برنامه حذف شود؟",

View File

@@ -287,6 +287,7 @@
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku is not running",
"useVersionCodeAsOSVersion": "Use app versionCode as OS-detected version",
"requestHeader": "Request header",
"removeAppQuestion": {
"one": "Supprimer l'application ?",

View File

@@ -287,6 +287,7 @@
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku is not running",
"useVersionCodeAsOSVersion": "Use app versionCode as OS-detected version",
"requestHeader": "Request header",
"removeAppQuestion": {
"one": "Eltávolítja az alkalmazást?",

View File

@@ -287,6 +287,7 @@
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku non è in esecuzione",
"useVersionCodeAsOSVersion": "Use app versionCode as OS-detected version",
"requestHeader": "Request header",
"removeAppQuestion": {
"one": "Rimuovere l'app?",

View File

@@ -287,6 +287,7 @@
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizukuが起動していません",
"useVersionCodeAsOSVersion": "Use app versionCode as OS-detected version",
"requestHeader": "Request header",
"removeAppQuestion": {
"one": "アプリを削除しますか?",

View File

@@ -287,6 +287,7 @@
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku is not running",
"useVersionCodeAsOSVersion": "Use app versionCode as OS-detected version",
"requestHeader": "Request header",
"removeAppQuestion": {
"one": "App verwijderen?",

View File

@@ -287,6 +287,7 @@
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku is not running",
"useVersionCodeAsOSVersion": "Use app versionCode as OS-detected version",
"requestHeader": "Request header",
"removeAppQuestion": {
"one": "Usunąć aplikację?",

View File

@@ -287,6 +287,7 @@
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku não está rodando",
"useVersionCodeAsOSVersion": "Use app versionCode as OS-detected version",
"requestHeader": "Request header",
"removeAppQuestion": {
"one": "Remover aplicativo?",

View File

@@ -289,6 +289,7 @@
"shizukuBinderNotFound": "Совместимый сервис Shizuku не найден",
"useSystemFont": "Использовать системный шрифт",
"systemFontError": "Ошибка загрузки системного шрифта: {}",
"useVersionCodeAsOSVersion": "Use app versionCode as OS-detected version",
"requestHeader": "Request header",
"removeAppQuestion": {
"one": "Удалить приложение?",

View File

@@ -273,6 +273,7 @@
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku is not running",
"useVersionCodeAsOSVersion": "Use app versionCode as OS-detected version",
"requestHeader": "Request header",
"removeAppQuestion": {
"one": "Ta Bort App?",

View File

@@ -287,6 +287,7 @@
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku is not running",
"useVersionCodeAsOSVersion": "Use app versionCode as OS-detected version",
"requestHeader": "Request header",
"removeAppQuestion": {
"one": "Uygulamayı Kaldır?",

View File

@@ -289,6 +289,7 @@
"shizukuBinderNotFound": "未发现兼容的 Shizuku 服务",
"useSystemFont": "使用系统字体",
"systemFontError": "加载系统字体出错:{}",
"useVersionCodeAsOSVersion": "Use app versionCode as OS-detected version",
"requestHeader": "Request header",
"removeAppQuestion": {
"one": "是否删除应用?",

View File

@@ -798,13 +798,17 @@ class AppsProvider with ChangeNotifier {
SourceProvider()
.getSource(app.app.url, overrideSource: app.app.overrideSource)
.naiveStandardVersionDetection;
String? realInstalledVersion =
app.app.additionalSettings['useVersionCodeAsOSVersion'] == true
? app.installedInfo?.versionCode.toString()
: app.installedInfo?.versionName;
return app.app.additionalSettings['trackOnly'] != true &&
app.app.additionalSettings['versionDetection'] !=
'releaseDateAsVersion' &&
app.installedInfo?.versionName != null &&
realInstalledVersion != null &&
app.app.installedVersion != null &&
(reconcileVersionDifferences(app.installedInfo!.versionName!,
app.app.installedVersion!) !=
(reconcileVersionDifferences(
realInstalledVersion, app.app.installedVersion!) !=
null ||
naiveStandardVersionDetection);
}
@@ -823,30 +827,33 @@ class AppsProvider with ChangeNotifier {
SourceProvider()
.getSource(app.url, overrideSource: app.overrideSource)
.naiveStandardVersionDetection;
String? realInstalledVersion =
app.additionalSettings['useVersionCodeAsOSVersion'] == true
? installedInfo?.versionCode.toString()
: installedInfo?.versionName;
// 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
app.installedVersion = null;
modded = true;
} else if (installedInfo?.versionName != null &&
app.installedVersion == null) {
// App says it's not installed but really is - set to installed and use real package versionName
app.installedVersion = installedInfo!.versionName;
} else if (realInstalledVersion != null && app.installedVersion == null) {
// App says it's not installed but really is - set to installed and use real package versionName (or versionCode if chosen)
app.installedVersion = realInstalledVersion;
modded = true;
}
// SECOND, RECONCILE DIFFERENCES BETWEEN THE APP'S REPORTED AND REAL INSTALLED VERSIONS, WHERE NEITHER IS NULL
if (installedInfo?.versionName != null &&
installedInfo!.versionName != app.installedVersion &&
if (realInstalledVersion != null &&
realInstalledVersion != app.installedVersion &&
versionDetectionIsStandard) {
// App's reported version and real version don't match (and it uses standard version detection)
// If they share a standard format (and are still different under it), update the reported version accordingly
var correctedInstalledVersion = reconcileVersionDifferences(
installedInfo.versionName!, app.installedVersion!);
realInstalledVersion, app.installedVersion!);
if (correctedInstalledVersion?.key == false) {
app.installedVersion = correctedInstalledVersion!.value;
modded = true;
} else if (naiveStandardVersionDetection) {
app.installedVersion = installedInfo.versionName;
app.installedVersion = realInstalledVersion;
modded = true;
}
}
@@ -1291,8 +1298,11 @@ class AppsProvider with ChangeNotifier {
await Future.delayed(const Duration(microseconds: 1));
}
for (App a in importedApps) {
var installedInfo = await getInstalledInfo(a.id, printErr: false);
a.installedVersion =
(await getInstalledInfo(a.id, printErr: false))?.versionName;
a.additionalSettings['useVersionCodeAsOSVersion'] == true
? installedInfo?.versionCode.toString()
: installedInfo?.versionName;
}
await saveApps(importedApps, onlyIfExists: false);
notifyListeners();

View File

@@ -485,6 +485,10 @@ abstract class AppSource {
label: tr('versionDetection'),
defaultValue: 'standardVersionDetection')
],
[
GeneratedFormSwitch('useVersionCodeAsOSVersion',
label: tr('useVersionCodeAsOSVersion'), defaultValue: false)
],
[
GeneratedFormTextField('apkFilterRegEx',
label: tr('filterAPKsByRegEx'),