Merge pull request #1024 from ImranR98/dev

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:47:34 -04:00
committed by GitHub
22 changed files with 106 additions and 35 deletions

View File

@@ -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?"

View File

@@ -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?"

View File

@@ -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?"

View File

@@ -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?"

View File

@@ -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?"

View File

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

View File

@@ -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 ?"

View File

@@ -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?"

View File

@@ -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?"

View File

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

View File

@@ -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?",

View File

@@ -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?"

View File

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

View File

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

View File

@@ -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();
}

View File

@@ -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

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,
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,

View File

@@ -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<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) {

View File

@@ -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();
}
}

View File

@@ -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,

View File

@@ -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:

View File

@@ -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"