Compare commits

...

30 Commits

Author SHA1 Message Date
3c61735706 Merge pull request #309 from ImranR98/dev
Release Filter Support for APKMirror (#307) + UI Bugfix (#303)
2023-02-19 18:50:12 -05:00
a2879f5bfa Increment version, update package 2023-02-19 18:48:21 -05:00
b57f023739 Added prev. rel. and regex title filter support to APKMirror 2023-02-19 18:46:30 -05:00
c376a7abec Longer version names bugfix for apps list UI 2023-02-19 18:20:28 -05:00
31c6cc3f6f Merge pull request #305 from atilluF/ita
Update Italian translation
2023-02-19 17:54:53 -05:00
8de8438aeb Merge pull request #302 from bluefly000/japanese-translation
Update Japanese translation
2023-02-19 17:54:47 -05:00
2b0225dd5b Merge pull request #306 from gidano/main
Update hu.json
2023-02-19 17:54:41 -05:00
f6af3a7998 Update hu.json 2023-02-19 15:12:06 +01:00
bd29d7bc10 Update it.json 2023-02-19 12:44:31 +01:00
ffb3516a4b Update Japanese translation 2023-02-19 15:41:14 +09:00
6a5e7942ee Merge pull request #301 from ImranR98/dev
App edit bugfixes
2023-02-18 21:39:55 -05:00
859158e84a App edit bugfixes 2023-02-18 21:39:26 -05:00
435116e10b Merge pull request #300 from ImranR98/dev
Release Date Support for Some Sources (#210 + #298) + UI Changes (#274) + Bugfix (#299)
2023-02-18 21:24:36 -05:00
a788d9d7cd Increment version 2023-02-18 21:22:36 -05:00
4be3478b97 Added release date support to APKMirror 2023-02-18 21:16:28 -05:00
fe0126095a Added release date support to third part f-droid repos 2023-02-18 21:03:22 -05:00
d5fdf28a98 Added release date support to Codeberg 2023-02-18 20:58:08 -05:00
f06d245e20 Added release date support to GitLab 2023-02-18 20:55:23 -05:00
2b4f94b407 Date sort bugfix 2023-02-18 20:49:45 -05:00
5f7e342e6b Added rel. date sort 2023-02-18 20:47:29 -05:00
191776d0d5 Initial release date support 2023-02-18 20:37:30 -05:00
ea81b0e66e Bugfix for different ID same URL Apps (#299) 2023-02-18 18:31:42 -05:00
86131ae3ce Merge pull request #297 from ImranR98/dev
Bugfixes (#292 and #293)
2023-02-16 22:40:38 -05:00
64ded1d720 Updated packages 2023-02-16 22:39:35 -05:00
a11c2f1d37 Increment version 2023-02-16 22:37:17 -05:00
890787f87f Fixed type errors and HTML APK filter 2023-02-16 22:36:53 -05:00
c5ff1de950 Merge pull request #291 from ImranR98/dev
Bugfixes (#286, #289)
2023-02-15 21:27:30 -05:00
56658abd60 Increment version 2023-02-15 21:26:55 -05:00
b60622e2cb Steam bugfix 2023-02-15 21:26:05 -05:00
e149f0b225 HTML Source bugfix 2023-02-15 21:05:14 -05:00
24 changed files with 412 additions and 179 deletions

View File

@ -213,6 +213,10 @@
"removeFromObtainium": "Remove from Obtainium",
"uninstallFromDevice": "Uninstall from Device",
"onlyWorksWithNonVersionDetectApps": "Only works for Apps with version detection disabled.",
"useReleaseDateAsVersion": "Use Release Date as Version",
"releaseDateAsVersionExplanation": "This option should only be used for Apps where version detection does not work correctly, but a release date is available.",
"changes": "Changes",
"releaseDate": "Release Date",
"removeAppQuestion": {
"one": "App entfernen?",
"other": "App entfernen?"

View File

@ -213,6 +213,10 @@
"removeFromObtainium": "Remove from Obtainium",
"uninstallFromDevice": "Uninstall from Device",
"onlyWorksWithNonVersionDetectApps": "Only works for Apps with version detection disabled.",
"useReleaseDateAsVersion": "Use Release Date as Version",
"releaseDateAsVersionExplanation": "This option should only be used for Apps where version detection does not work correctly, but a release date is available.",
"changes": "Changes",
"releaseDate": "Release Date",
"removeAppQuestion": {
"one": "Remove App?",
"other": "Remove Apps?"

View File

@ -213,6 +213,10 @@
"removeFromObtainium": "از Obtainium حذف کنید",
"uninstallFromDevice": "حذف نصب از دستگاه",
"onlyWorksWithNonVersionDetectApps": "فقط برای برنامه‌هایی کار می‌کند که تشخیص نسخه غیرفعال است.",
"useReleaseDateAsVersion": "Use Release Date as Version",
"releaseDateAsVersionExplanation": "This option should only be used for Apps where version detection does not work correctly, but a release date is available.",
"changes": "Changes",
"releaseDate": "Release Date",
"removeAppQuestion": {
"one": "برنامه حذف شود؟",
"other": "برنامه ها حذف شوند؟"

View File

@ -34,7 +34,7 @@
"githubStarredRepos": "GitHub Csillagos Repo-k",
"uname": "Felh.név",
"wrongArgNum": "Rossz számú argumentumot adott meg",
"xIsTrackOnly": "A(z) {} csak nyomkövethető",
"xIsTrackOnly": "A(z) {} csak nyomonkövethető",
"source": "Forrás",
"app": "App",
"appsFromSourceAreTrackOnly": "Az ebből a forrásból származó alkalmazások 'Csak nyomon követhetőek'.",
@ -78,7 +78,7 @@
"no": "Nem",
"yes": "Igen",
"markSelectedAppsUpdated": "Jelölje meg a kiválasztott appokat frissítettként",
"pinToTop": "Rögzítés a felülre",
"pinToTop": "Rögzítés felülre",
"unpinFromTop": "Eltávolít felülről",
"resetInstallStatusForSelectedAppsQuestion": "Visszaállítja a kiválasztott appok telepítési állapotát?",
"installStatusOfXWillBeResetExplanation": "A kiválasztott appok telepítési állapota visszaáll.\n\nEz akkor segíthet, ha az Obtainiumban megjelenített app verzió hibás, frissítések vagy egyéb problémák miatt.",
@ -212,6 +212,10 @@
"removeFromObtainium": "Eltávolítás az Obtainiumból",
"uninstallFromDevice": "Eltávolítás a készülékről",
"onlyWorksWithNonVersionDetectApps": "Csak azoknál az alkalmazásoknál működik, amelyeknél a verzióérzékelés le van tiltva.",
"useReleaseDateAsVersion": "Használja a Kiadás dátumát, mint verziót",
"releaseDateAsVersionExplanation": "Ezt a beállítást csak olyan alkalmazásoknál szabad használni, ahol a verzió érzékelése nem működik megfelelően, de elérhető a kiadás dátuma.",
"changes": "Változtatások",
"releaseDate": "Kiadás dátuma",
"removeAppQuestion": {
"one": "Eltávolítja az alkalmazást?",
"other": "Eltávolítja az alkalmazást?"

View File

@ -56,9 +56,9 @@
"appsString": "App",
"noApps": "Nessuna App",
"noAppsForFilter": "Nessuna App per i filtri selezionati",
"byX": "Da {}",
"byX": "Di {}",
"percentProgress": "Progresso: {}%",
"pleaseWait": "Attendere prego",
"pleaseWait": "In attesa",
"updateAvailable": "Aggiornamento disponibile",
"estimateInBracketsShort": "(prev.)",
"notInstalled": "Non installato",
@ -94,7 +94,7 @@
"author": "Autore",
"upToDateApps": "App aggiornate",
"nonInstalledApps": "App non installate",
"importExport": "Importa - Esporta",
"importExport": "Importa/Esporta",
"settings": "Impostazioni",
"exportedTo": "Esportato in {}",
"obtainiumExport": "Esporta da Obtainium",
@ -213,6 +213,10 @@
"removeFromObtainium": "Rimuovi da Obtainium",
"uninstallFromDevice": "Disinstalla dal dispositivo",
"onlyWorksWithNonVersionDetectApps": "Funziona solo per le App con il rilevamento della versione disattivato.",
"useReleaseDateAsVersion": "Usa data di rilascio come versione",
"releaseDateAsVersionExplanation": "Questa opzione dovrebbe essere usata solo per le App in cui il rilevamento della versione non funziona correttamente, ma è disponibile una data di rilascio.",
"changes": "Novità",
"releaseDate": "Data di rilascio",
"removeAppQuestion": {
"one": "Rimuovere l'App?",
"other": "Rimuovere le App?"

View File

@ -213,6 +213,10 @@
"removeFromObtainium": "Obtainiumから削除する",
"uninstallFromDevice": "デバイスからアンインストールする",
"onlyWorksWithNonVersionDetectApps": "バージョン検出を無効にしているアプリにのみ動作します。",
"useReleaseDateAsVersion": "リリース日をバージョンとして使用する",
"releaseDateAsVersionExplanation": "このオプションは、バージョン検出が正しく機能しないアプリで、リリース日が利用可能な場合にのみ使用する必要があります。",
"changes": "変更点",
"releaseDate": "リリース日",
"removeAppQuestion": {
"one": "アプリを削除しますか?",
"other": "アプリを削除しますか?"

View File

@ -213,6 +213,10 @@
"filterAPKsByRegEx": "Filter APKs by Regular Expression",
"removeFromObtainium": "Remove from Obtainium",
"uninstallFromDevice": "Uninstall from Device",
"useReleaseDateAsVersion": "Use Release Date as Version",
"releaseDateAsVersionExplanation": "This option should only be used for Apps where version detection does not work correctly, but a release date is available.",
"changes": "Changes",
"releaseDate": "Release Date",
"removeAppQuestion": {
"one": "删除应用?",
"other": "删除应用?"

View File

@ -1,5 +1,9 @@
import 'dart:io';
import 'package:easy_localization/easy_localization.dart';
import 'package:html/parser.dart';
import 'package:http/http.dart';
import 'package:obtainium/components/generated_form.dart';
import 'package:obtainium/custom_errors.dart';
import 'package:obtainium/providers/source_provider.dart';
@ -7,6 +11,23 @@ class APKMirror extends AppSource {
APKMirror() {
host = 'apkmirror.com';
enforceTrackOnly = true;
additionalSourceAppSpecificSettingFormItems = [
[
GeneratedFormSwitch('fallbackToOlderReleases',
label: tr('fallbackToOlderReleases'), defaultValue: true)
],
[
GeneratedFormTextField('filterReleaseTitlesByRegEx',
label: tr('filterReleaseTitlesByRegEx'),
required: false,
additionalValidators: [
(value) {
return regExValidator(value);
}
])
]
];
}
@override
@ -28,12 +49,38 @@ class APKMirror extends AppSource {
String standardUrl,
Map<String, dynamic> additionalSettings,
) async {
bool fallbackToOlderReleases =
additionalSettings['fallbackToOlderReleases'] == true;
String? regexFilter =
(additionalSettings['filterReleaseTitlesByRegEx'] as String?)
?.isNotEmpty ==
true
? additionalSettings['filterReleaseTitlesByRegEx']
: null;
Response res = await get(Uri.parse('$standardUrl/feed'));
if (res.statusCode == 200) {
String? titleString = parse(res.body)
.querySelector('item')
?.querySelector('title')
?.innerHtml;
var items = parse(res.body).querySelectorAll('item');
dynamic targetRelease;
for (int i = 0; i < items.length; i++) {
if (!fallbackToOlderReleases && i > 0) break;
String? nameToFilter = items[i].querySelector('title')?.innerHtml;
if (regexFilter != null &&
nameToFilter != null &&
!RegExp(regexFilter).hasMatch(nameToFilter.trim())) {
continue;
}
targetRelease = items[i];
break;
}
String? titleString = targetRelease?.querySelector('title')?.innerHtml;
String? dateString = targetRelease
?.querySelector('pubDate')
?.innerHtml
.split(' ')
.sublist(0, 5)
.join(' ');
DateTime? releaseDate =
dateString != null ? HttpDate.parse('$dateString GMT') : null;
String? version = titleString
?.substring(RegExp('[0-9]').firstMatch(titleString)?.start ?? 0,
RegExp(' by ').firstMatch(titleString)?.start ?? 0)
@ -44,7 +91,8 @@ class APKMirror extends AppSource {
if (version == null || version.isEmpty) {
throw NoVersionError();
}
return APKDetails(version, [], getAppNames(standardUrl));
return APKDetails(version, [], getAppNames(standardUrl),
releaseDate: releaseDate);
} else {
throw getObtainiumHttpError(res);
}

View File

@ -54,9 +54,9 @@ class Codeberg extends AppSource {
String standardUrl,
Map<String, dynamic> additionalSettings,
) async {
bool includePrereleases = additionalSettings['includePrereleases'];
bool includePrereleases = additionalSettings['includePrereleases'] == true;
bool fallbackToOlderReleases =
additionalSettings['fallbackToOlderReleases'];
additionalSettings['fallbackToOlderReleases'] == true;
String? regexFilter =
(additionalSettings['filterReleaseTitlesByRegEx'] as String?)
?.isNotEmpty ==
@ -112,11 +112,15 @@ class Codeberg extends AppSource {
throw NoReleasesError();
}
String? version = targetRelease['tag_name'];
DateTime? releaseDate = targetRelease['published_at'] != null
? DateTime.parse(targetRelease['published_at'])
: null;
if (version == null) {
throw NoVersionError();
}
return APKDetails(version, targetRelease['apkUrls'] as List<String>,
getAppNames(standardUrl));
getAppNames(standardUrl),
releaseDate: releaseDate);
} else {
throw getObtainiumHttpError(res);
}

View File

@ -69,6 +69,8 @@ class FDroidRepo extends AppSource {
foundApps[0].querySelector('name')?.innerHtml ?? appIdOrName;
var releases = foundApps[0].querySelectorAll('package');
String? latestVersion = releases[0].querySelector('version')?.innerHtml;
String? added = releases[0].querySelector('added')?.innerHtml;
DateTime? releaseDate = added != null ? DateTime.parse(added) : null;
if (latestVersion == null) {
throw NoVersionError();
}
@ -78,7 +80,8 @@ class FDroidRepo extends AppSource {
element.querySelector('apkname') != null)
.map((e) => '$standardUrl/${e.querySelector('apkname')!.innerHtml}')
.toList();
return APKDetails(latestVersion, apkUrls, AppNames(authorName, appName));
return APKDetails(latestVersion, apkUrls, AppNames(authorName, appName),
releaseDate: releaseDate);
} else {
throw getObtainiumHttpError(res);
}

View File

@ -101,9 +101,9 @@ class GitHub extends AppSource {
String standardUrl,
Map<String, dynamic> additionalSettings,
) async {
bool includePrereleases = additionalSettings['includePrereleases'];
bool includePrereleases = additionalSettings['includePrereleases'] == true;
bool fallbackToOlderReleases =
additionalSettings['fallbackToOlderReleases'];
additionalSettings['fallbackToOlderReleases'] == true;
String? regexFilter =
(additionalSettings['filterReleaseTitlesByRegEx'] as String?)
?.isNotEmpty ==
@ -154,11 +154,15 @@ class GitHub extends AppSource {
throw NoReleasesError();
}
String? version = targetRelease['tag_name'];
DateTime? releaseDate = targetRelease['published_at'] != null
? DateTime.parse(targetRelease['published_at'])
: null;
if (version == null) {
throw NoVersionError();
}
return APKDetails(version, targetRelease['apkUrls'] as List<String>,
getAppNames(standardUrl));
getAppNames(standardUrl),
releaseDate: releaseDate);
} else {
rateLimitErrorCheck(res);
throw getObtainiumHttpError(res);

View File

@ -54,10 +54,14 @@ class GitLab extends AppSource {
var entryId = entry?.querySelector('id')?.innerHtml;
var version =
entryId == null ? null : Uri.parse(entryId).pathSegments.last;
var releaseDateString = entry?.querySelector('updated')?.innerHtml;
DateTime? releaseDate =
releaseDateString != null ? DateTime.parse(releaseDateString) : null;
if (version == null) {
throw NoVersionError();
}
return APKDetails(version, apkUrls, GitHub().getAppNames(standardUrl));
return APKDetails(version, apkUrls, GitHub().getAppNames(standardUrl),
releaseDate: releaseDate);
} else {
throw getObtainiumHttpError(res);
}

View File

@ -27,6 +27,10 @@ class HTML extends AppSource {
.where((element) => element.toLowerCase().endsWith('.apk'))
.toList();
links.sort((a, b) => a.split('/').last.compareTo(b.split('/').last));
if (additionalSettings['apkFilterRegEx'] != null) {
var reg = RegExp(additionalSettings['apkFilterRegEx']);
links = links.where((element) => reg.hasMatch(element)).toList();
}
if (links.isEmpty) {
throw NoReleasesError();
}
@ -37,7 +41,9 @@ class HTML extends AppSource {
.map((e) => e.toLowerCase().startsWith('http://') ||
e.toLowerCase().startsWith('https://')
? e
: '${uri.origin}/$e')
: e.startsWith('/')
? '${uri.origin}/$e'
: '${uri.origin}/${uri.path}/$e')
.toList();
return APKDetails(version, apkUrls, AppNames(uri.host, tr('app')));
} else {

View File

@ -10,7 +10,10 @@ class SteamMobile extends AppSource {
host = 'store.steampowered.com';
name = tr('steam');
additionalSourceAppSpecificSettingFormItems = [
[GeneratedFormDropdown('app', apks.entries.toList(), label: tr('app'))]
[
GeneratedFormDropdown('app', apks.entries.toList(),
label: tr('app'), defaultValue: apks.entries.toList()[0].key)
]
];
}
@ -35,7 +38,8 @@ class SteamMobile extends AppSource {
if (apkNamePrefix == null) {
throw NoReleasesError();
}
String apkInURLRegexPattern = '/$apkNamePrefix-[^/]+\\.apk\$';
String apkInURLRegexPattern =
'/$apkNamePrefix-([0-9]+\\.)*[0-9]+\\.apk\$';
var links = parse(res.body)
.querySelectorAll('a')
.map((e) => e.attributes['href'] ?? '')

View File

@ -21,7 +21,7 @@ import 'package:easy_localization/src/easy_localization_controller.dart';
// ignore: implementation_imports
import 'package:easy_localization/src/localization.dart';
const String currentVersion = '0.10.10';
const String currentVersion = '0.11.1';
const String currentReleaseTag =
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES

View File

@ -73,6 +73,8 @@ class _AddAppPageState extends State<AddAppPage> {
var userPickedTrackOnly = additionalSettings['trackOnly'] == true;
var userPickedNoVersionDetection =
additionalSettings['noVersionDetection'] == true;
var userPickedReleaseDateAsVersion =
additionalSettings['releaseDateAsVersion'] == true;
var cont = true;
if ((userPickedTrackOnly || pickedSource!.enforceTrackOnly) &&
// ignore: use_build_context_synchronously
@ -93,7 +95,22 @@ class _AddAppPageState extends State<AddAppPage> {
null) {
cont = false;
}
if (userPickedNoVersionDetection &&
if (userPickedReleaseDateAsVersion && // ignore: use_build_context_synchronously
// ignore: use_build_context_synchronously
await showDialog(
context: context,
builder: (BuildContext ctx) {
return GeneratedFormModal(
title: tr('useReleaseDateAsVersion'),
items: const [],
message: tr('releaseDateAsVersionExplanation'),
);
}) ==
null) {
cont = false;
}
if (!userPickedReleaseDateAsVersion &&
userPickedNoVersionDetection &&
// ignore: use_build_context_synchronously
await showDialog(
context: context,
@ -113,12 +130,13 @@ class _AddAppPageState extends State<AddAppPage> {
App app = await sourceProvider.getApp(
pickedSource!, userInput, additionalSettings,
trackOnlyOverride: trackOnly,
noVersionDetectionOverride: userPickedNoVersionDetection);
noVersionDetectionOverride: userPickedNoVersionDetection,
releaseDateAsVersionOverride: userPickedReleaseDateAsVersion);
if (!trackOnly) {
await settingsProvider.getInstallPermission();
}
// Only download the APK here if you need to for the package ID
if (sourceProvider.isTempId(app.id) &&
if (sourceProvider.isTempId(app) &&
app.additionalSettings['trackOnly'] != true) {
// ignore: use_build_context_synchronously
var apkUrl = await appsProvider.confirmApkUrl(app, context);

View File

@ -113,7 +113,7 @@ class _AppPageState extends State<AppPage> {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: 150),
const SizedBox(height: 125),
app?.installedInfo != null
? Row(mainAxisAlignment: MainAxisAlignment.center, children: [
Image.memory(
@ -136,6 +136,21 @@ class _AppPageState extends State<AppPage> {
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.headlineMedium,
),
const SizedBox(
height: 8,
),
Text(
app?.app.id ?? '',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.labelSmall,
),
app?.app.releaseDate == null
? const SizedBox.shrink()
: Text(
app!.app.releaseDate.toString(),
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.labelSmall,
),
const SizedBox(
height: 32,
),
@ -268,19 +283,53 @@ class _AppPageState extends State<AppPage> {
);
}).then((values) {
if (app != null && values != null) {
var changedApp = app.app;
changedApp.additionalSettings =
values;
Map<String, dynamic>
originalSettings =
app.app.additionalSettings;
app.app.additionalSettings = values;
if (source.enforceTrackOnly) {
changedApp.additionalSettings[
app.app.additionalSettings[
'trackOnly'] = true;
showError(
tr('appsFromSourceAreTrackOnly'),
context);
}
appsProvider.saveApps(
[changedApp]).then((value) {
getUpdate(changedApp.id);
if (app.app.additionalSettings[
'releaseDateAsVersion'] ==
true) {
app.app.additionalSettings[
'noVersionDetection'] = true;
if (originalSettings[
'releaseDateAsVersion'] !=
true) {
if (app.app.releaseDate != null) {
bool isUpdated =
app.app.installedVersion ==
app.app.latestVersion;
app.app.latestVersion = app
.app
.releaseDate!
.microsecondsSinceEpoch
.toString();
if (isUpdated) {
app.app.installedVersion =
app.app.latestVersion;
}
}
}
} else if (originalSettings[
'releaseDateAsVersion'] ==
true) {
app.app.additionalSettings[
'noVersionDetection'] = false;
app.app.installedVersion = app
.installedInfo
?.versionName ??
app.app.installedVersion;
}
appsProvider.saveApps([app.app]).then(
(value) {
getUpdate(app.app.id);
});
}
});

View File

@ -54,12 +54,12 @@ class AppsPageState extends State<AppsPage> {
Widget build(BuildContext context) {
var appsProvider = context.watch<AppsProvider>();
var settingsProvider = context.watch<SettingsProvider>();
var sortedApps = appsProvider.apps.values.toList();
var listedApps = appsProvider.apps.values.toList();
var currentFilterIsUpdatesOnly =
filter.isIdenticalTo(updatesOnlyFilter, settingsProvider);
selectedApps = selectedApps
.where((element) => sortedApps.map((e) => e.app).contains(element))
.where((element) => listedApps.map((e) => e.app).contains(element))
.toSet();
toggleAppSelected(App app) {
@ -72,7 +72,7 @@ class AppsPageState extends State<AppsPage> {
});
}
sortedApps = sortedApps.where((app) {
listedApps = listedApps.where((app) {
if (app.app.installedVersion == app.app.latestVersion &&
!(filter.includeUptodate)) {
return false;
@ -111,7 +111,7 @@ class AppsPageState extends State<AppsPage> {
return true;
}).toList();
sortedApps.sort((a, b) {
listedApps.sort((a, b) {
var nameA = a.installedInfo?.name ?? a.app.name;
var nameB = b.installedInfo?.name ?? b.app.name;
int result = 0;
@ -119,25 +119,30 @@ class AppsPageState extends State<AppsPage> {
result = (a.app.author + nameA).compareTo(b.app.author + nameB);
} else if (settingsProvider.sortColumn == SortColumnSettings.nameAuthor) {
result = (nameA + a.app.author).compareTo(nameB + b.app.author);
} else if (settingsProvider.sortColumn ==
SortColumnSettings.releaseDate) {
result = (a.app.releaseDate)?.compareTo(
b.app.releaseDate ?? DateTime.fromMicrosecondsSinceEpoch(0)) ??
0;
}
return result;
});
if (settingsProvider.sortOrder == SortOrderSettings.descending) {
sortedApps = sortedApps.reversed.toList();
listedApps = listedApps.reversed.toList();
}
var existingUpdates = appsProvider.findExistingUpdates(installedOnly: true);
var existingUpdateIdsAllOrSelected = existingUpdates
.where((element) => selectedApps.isEmpty
? sortedApps.where((a) => a.app.id == element).isNotEmpty
? listedApps.where((a) => a.app.id == element).isNotEmpty
: selectedApps.map((e) => e.id).contains(element))
.toList();
var newInstallIdsAllOrSelected = appsProvider
.findExistingUpdates(nonInstalledOnly: true)
.where((element) => selectedApps.isEmpty
? sortedApps.where((a) => a.app.id == element).isNotEmpty
? listedApps.where((a) => a.app.id == element).isNotEmpty
: selectedApps.map((e) => e.id).contains(element))
.toList();
@ -159,26 +164,26 @@ class AppsPageState extends State<AppsPage> {
if (settingsProvider.pinUpdates) {
var temp = [];
sortedApps = sortedApps.where((sa) {
listedApps = listedApps.where((sa) {
if (existingUpdates.contains(sa.app.id)) {
temp.add(sa);
return false;
}
return true;
}).toList();
sortedApps = [...temp, ...sortedApps];
listedApps = [...temp, ...listedApps];
}
var tempPinned = [];
var tempNotPinned = [];
for (var a in sortedApps) {
for (var a in listedApps) {
if (a.app.pinned) {
tempPinned.add(a);
} else {
tempNotPinned.add(a);
}
}
sortedApps = [...tempPinned, ...tempNotPinned];
listedApps = [...tempPinned, ...tempNotPinned];
return Scaffold(
backgroundColor: Theme.of(context).colorScheme.surface,
@ -198,7 +203,7 @@ class AppsPageState extends State<AppsPage> {
},
child: CustomScrollView(slivers: <Widget>[
CustomAppBar(title: tr('appsString')),
if (appsProvider.loadingApps || sortedApps.isEmpty)
if (appsProvider.loadingApps || listedApps.isEmpty)
SliverFillRemaining(
child: Center(
child: appsProvider.loadingApps
@ -225,8 +230,8 @@ class AppsPageState extends State<AppsPage> {
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
String? changesUrl = SourceProvider()
.getSource(sortedApps[index].app.url)
.changeLogPageFromStandardUrl(sortedApps[index].app.url);
.getSource(listedApps[index].app.url)
.changeLogPageFromStandardUrl(listedApps[index].app.url);
var transparent = const Color.fromARGB(0, 0, 0, 0).value;
return Container(
decoration: BoxDecoration(
@ -234,52 +239,54 @@ class AppsPageState extends State<AppsPage> {
vertical: BorderSide(
width: 4,
color: Color(
sortedApps[index].app.categories.isNotEmpty
listedApps[index].app.categories.isNotEmpty
? settingsProvider.categories[
sortedApps[index]
listedApps[index]
.app
.categories
.first] ??
transparent
: transparent)))),
child: ListTile(
tileColor: sortedApps[index].app.pinned
tileColor: listedApps[index].app.pinned
? Colors.grey.withOpacity(0.1)
: Colors.transparent,
selectedTileColor: Theme.of(context)
.colorScheme
.primary
.withOpacity(sortedApps[index].app.pinned ? 0.2 : 0.1),
selected: selectedApps.contains(sortedApps[index].app),
.withOpacity(listedApps[index].app.pinned ? 0.2 : 0.1),
selected: selectedApps.contains(listedApps[index].app),
onLongPress: () {
toggleAppSelected(sortedApps[index].app);
toggleAppSelected(listedApps[index].app);
},
leading: sortedApps[index].installedInfo != null
leading: listedApps[index].installedInfo != null
? Image.memory(
sortedApps[index].installedInfo!.icon!,
listedApps[index].installedInfo!.icon!,
gaplessPlayback: true,
)
: null,
title: Text(
sortedApps[index].installedInfo?.name ??
sortedApps[index].app.name,
maxLines: 1,
listedApps[index].installedInfo?.name ??
listedApps[index].app.name,
style: TextStyle(
fontWeight: sortedApps[index].app.pinned
overflow: TextOverflow.ellipsis,
fontWeight: listedApps[index].app.pinned
? FontWeight.bold
: FontWeight.normal,
),
),
subtitle: Text(
tr('byX', args: [sortedApps[index].app.author]),
tr('byX', args: [listedApps[index].app.author]),
style: TextStyle(
fontWeight: sortedApps[index].app.pinned
fontWeight: listedApps[index].app.pinned
? FontWeight.bold
: FontWeight.normal)),
trailing: SingleChildScrollView(
reverse: true,
child: sortedApps[index].downloadProgress != null
child: listedApps[index].downloadProgress != null
? Text(tr('percentProgress', args: [
sortedApps[index]
listedApps[index]
.downloadProgress
?.toInt()
.toString() ??
@ -289,60 +296,104 @@ class AppsPageState extends State<AppsPage> {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
SizedBox(
width: 100,
Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
constraints: const BoxConstraints(
maxWidth: 150),
child: Text(
'${listedApps[index].app.installedVersion ?? tr('notInstalled')}${listedApps[index].app.additionalSettings['trackOnly'] == true ? ' ${tr('estimateInBrackets')}' : ''}',
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.end,
))
]),
GestureDetector(
onTap: changesUrl == null
? null
: () {
launchUrlString(changesUrl,
mode: LaunchMode
.externalApplication);
},
child: Text(
'${sortedApps[index].app.installedVersion ?? tr('notInstalled')}${sortedApps[index].app.additionalSettings['trackOnly'] == true ? ' ${tr('estimateInBrackets')}' : ''}',
overflow: TextOverflow.fade,
textAlign: TextAlign.end,
listedApps[index].app.releaseDate ==
null
? tr('changes')
: DateFormat('yyyy-MM-dd').format(
listedApps[index]
.app
.releaseDate!),
style: const TextStyle(
fontStyle: FontStyle.italic,
decoration:
TextDecoration.underline),
)),
sortedApps[index].app.installedVersion !=
listedApps[index].app.installedVersion !=
null &&
sortedApps[index]
listedApps[index]
.app
.installedVersion !=
sortedApps[index]
listedApps[index]
.app
.latestVersion
? GestureDetector(
onTap: changesUrl == null
? null
: () {
launchUrlString(changesUrl,
mode: LaunchMode
.externalApplication);
},
child: appsProvider
.areDownloadsRunning()
? Text(tr('pleaseWait'))
: Text(
'${tr('updateAvailable')}${sortedApps[index].app.additionalSettings['trackOnly'] == true ? ' ${tr('estimateInBracketsShort')}' : ''}',
style: TextStyle(
fontStyle:
FontStyle.italic,
decoration: changesUrl ==
null
? TextDecoration.none
: TextDecoration
.underline),
))
: const SizedBox(),
? appsProvider.areDownloadsRunning()
? Text(tr('pleaseWait'))
: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment:
MainAxisAlignment.end,
children: [
GestureDetector(
onTap: () {
appsProvider
.downloadAndInstallLatestApps(
[
listedApps[index]
.app
.id
],
globalNavigatorKey
.currentContext).catchError(
(e) {
showError(e, context);
});
},
child: Text(
listedApps[index]
.app
.additionalSettings[
'trackOnly'] ==
true
? tr('markUpdated')
: tr('update'),
style: TextStyle(
color:
Theme.of(context)
.colorScheme
.primary,
fontWeight:
FontWeight.bold),
)),
],
)
: const SizedBox.shrink(),
],
))),
onTap: () {
if (selectedApps.isNotEmpty) {
toggleAppSelected(sortedApps[index].app);
toggleAppSelected(listedApps[index].app);
} else {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
AppPage(appId: sortedApps[index].app.id)),
AppPage(appId: listedApps[index].app.id)),
);
}
},
));
}, childCount: sortedApps.length))
}, childCount: listedApps.length))
])),
persistentFooterButtons: appsProvider.apps.isEmpty
? null
@ -354,20 +405,20 @@ class AppsPageState extends State<AppsPage> {
style: const ButtonStyle(
visualDensity: VisualDensity.compact),
onPressed: () {
selectThese(sortedApps.map((e) => e.app).toList());
selectThese(listedApps.map((e) => e.app).toList());
},
icon: Icon(
Icons.select_all_outlined,
color: Theme.of(context).colorScheme.primary,
),
label: Text(sortedApps.length.toString()))
label: Text(listedApps.length.toString()))
: TextButton.icon(
style: const ButtonStyle(
visualDensity: VisualDensity.compact),
onPressed: () {
selectedApps.isEmpty
? selectThese(
sortedApps.map((e) => e.app).toList())
listedApps.map((e) => e.app).toList())
: clearSelected();
},
icon: Icon(

View File

@ -101,6 +101,10 @@ class _SettingsPageState extends State<SettingsPage> {
DropdownMenuItem(
value: SortColumnSettings.added,
child: Text(tr('asAdded')),
),
DropdownMenuItem(
value: SortColumnSettings.releaseDate,
child: Text(tr('releaseDate')),
)
],
onChanged: (value) {

View File

@ -182,7 +182,7 @@ class AppsProvider with ChangeNotifier {
// The former case should be handled (give the App its real ID), the latter is a security issue
var newInfo = await PackageArchiveInfo.fromPath(downloadedFile.path);
if (app.id != newInfo.packageName) {
if (apps[app.id] != null && !SourceProvider().isTempId(app.id)) {
if (apps[app.id] != null && !SourceProvider().isTempId(app)) {
throw IDChangedError();
}
var originalAppId = app.id;

View File

@ -6,7 +6,6 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:obtainium/app_sources/github.dart';
import 'package:obtainium/components/generated_form.dart';
import 'package:obtainium/main.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -18,7 +17,7 @@ enum ThemeSettings { system, light, dark }
enum ColourSettings { basic, materialYou }
enum SortColumnSettings { added, nameAuthor, authorName }
enum SortColumnSettings { added, nameAuthor, authorName, releaseDate }
enum SortOrderSettings { ascending, descending }

View File

@ -33,8 +33,9 @@ class APKDetails {
late String version;
late List<String> apkUrls;
late AppNames names;
late DateTime? releaseDate;
APKDetails(this.version, this.apkUrls, this.names);
APKDetails(this.version, this.apkUrls, this.names, {this.releaseDate});
}
class App {
@ -50,6 +51,7 @@ class App {
late DateTime? lastUpdateCheck;
bool pinned = false;
List<String> categories;
late DateTime? releaseDate;
App(
this.id,
this.url,
@ -62,7 +64,8 @@ class App {
this.additionalSettings,
this.lastUpdateCheck,
this.pinned,
{this.categories = const []});
{this.categories = const [],
this.releaseDate});
@override
String toString() {
@ -111,30 +114,34 @@ class App {
preferredApkIndex = 0;
}
return App(
json['id'] as String,
json['url'] as String,
json['author'] as String,
json['name'] as String,
json['installedVersion'] == null
? null
: json['installedVersion'] as String,
json['latestVersion'] as String,
json['apkUrls'] == null
? []
: List<String>.from(jsonDecode(json['apkUrls'])),
preferredApkIndex,
additionalSettings,
json['lastUpdateCheck'] == null
? null
: DateTime.fromMicrosecondsSinceEpoch(json['lastUpdateCheck']),
json['pinned'] ?? false,
categories: json['categories'] != null
? (json['categories'] as List<dynamic>)
.map((e) => e.toString())
.toList()
: json['category'] != null
? [json['category'] as String]
: []);
json['id'] as String,
json['url'] as String,
json['author'] as String,
json['name'] as String,
json['installedVersion'] == null
? null
: json['installedVersion'] as String,
json['latestVersion'] as String,
json['apkUrls'] == null
? []
: List<String>.from(jsonDecode(json['apkUrls'])),
preferredApkIndex,
additionalSettings,
json['lastUpdateCheck'] == null
? null
: DateTime.fromMicrosecondsSinceEpoch(json['lastUpdateCheck']),
json['pinned'] ?? false,
categories: json['categories'] != null
? (json['categories'] as List<dynamic>)
.map((e) => e.toString())
.toList()
: json['category'] != null
? [json['category'] as String]
: [],
releaseDate: json['releaseDate'] == null
? null
: DateTime.fromMicrosecondsSinceEpoch(json['releaseDate']),
);
}
Map<String, dynamic> toJson() => {
@ -149,7 +156,8 @@ class App {
'additionalSettings': jsonEncode(additionalSettings),
'lastUpdateCheck': lastUpdateCheck?.microsecondsSinceEpoch,
'pinned': pinned,
'categories': categories
'categories': categories,
'releaseDate': releaseDate?.microsecondsSinceEpoch
};
}
@ -225,6 +233,10 @@ class AppSource {
label: tr('trackOnly'),
)
],
[
GeneratedFormSwitch('releaseDateAsVersion',
label: tr('useReleaseDateAsVersion'))
],
[
GeneratedFormSwitch('noVersionDetection', label: tr('noVersionDetection'))
],
@ -350,34 +362,28 @@ class SourceProvider {
return false;
}
String generateTempID(AppNames names, AppSource source) =>
'${names.author.toLowerCase()}_${names.name.toLowerCase()}_${source.host}';
String generateTempID(
String standardUrl, Map<String, dynamic> additionalSettings) =>
(standardUrl + additionalSettings.toString()).hashCode.toString();
bool isTempId(String id) {
List<String> parts = id.split('_');
if (parts.length < 3) {
return false;
}
for (int i = 0; i < parts.length - 1; i++) {
if (RegExp('.*[A-Z].*').hasMatch(parts[i])) {
// TODO: Look into RegEx for non-Latin characters
return false;
}
}
return true;
bool isTempId(App app) {
return app.id == generateTempID(app.url, app.additionalSettings);
}
Future<App> getApp(
AppSource source,
String url,
Map<String, dynamic> additionalSettings, {
App? currentApp,
bool trackOnlyOverride = false,
noVersionDetectionOverride = false,
}) async {
AppSource source, String url, Map<String, dynamic> additionalSettings,
{App? currentApp,
bool trackOnlyOverride = false,
bool noVersionDetectionOverride = false,
bool releaseDateAsVersionOverride = false}) async {
if (trackOnlyOverride || source.enforceTrackOnly) {
additionalSettings['trackOnly'] = true;
}
if (releaseDateAsVersionOverride) {
additionalSettings['releaseDateAsVersion'] = true;
noVersionDetectionOverride =
true; // Rel. date as version means no ver. det.
}
if (noVersionDetectionOverride) {
additionalSettings['noVersionDetection'] = true;
}
@ -385,6 +391,10 @@ class SourceProvider {
String standardUrl = source.standardizeURL(preStandardizeUrl(url));
APKDetails apk =
await source.getLatestAPKDetails(standardUrl, additionalSettings);
if (additionalSettings['releaseDateAsVersion'] == true &&
apk.releaseDate != null) {
apk.version = apk.releaseDate!.microsecondsSinceEpoch.toString();
}
if (additionalSettings['apkFilterRegEx'] != null) {
var reg = RegExp(additionalSettings['apkFilterRegEx']);
apk.apkUrls =
@ -400,7 +410,7 @@ class SourceProvider {
currentApp?.id ??
source.tryInferringAppId(standardUrl,
additionalSettings: additionalSettings) ??
generateTempID(apk.names, source),
generateTempID(standardUrl, additionalSettings),
standardUrl,
apk.names.author[0].toUpperCase() + apk.names.author.substring(1),
name.trim().isNotEmpty
@ -413,7 +423,8 @@ class SourceProvider {
additionalSettings,
DateTime.now(),
currentApp?.pinned ?? false,
categories: currentApp?.categories ?? const []);
categories: currentApp?.categories ?? const [],
releaseDate: apk.releaseDate);
}
// Returns errors in [results, errors] instead of throwing them

View File

@ -5,18 +5,18 @@ packages:
dependency: "direct main"
description:
name: android_alarm_manager_plus
sha256: "71e796198588e0038dd125bf8c91683b3237b938ffad037413245c689b87ae28"
sha256: "8647cc5f9339f3955a2bd9ec40e0f10c3a80049f31f80b3ffdd87e07bb73fce2"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "2.1.1"
android_intent_plus:
dependency: "direct main"
description:
name: android_intent_plus
sha256: ebd110b60723334bdc6eeb373116d6c52e9bed8feb9dcbd9f034531f56636e31
sha256: "54810cb33945c2c10742cd746ea994822c115e9dbe189919bc63cb436e45a6af"
url: "https://pub.dev"
source: hosted
version: "3.1.5"
version: "3.1.6"
animations:
dependency: "direct main"
description:
@ -37,10 +37,10 @@ packages:
dependency: transitive
description:
name: args
sha256: "139d809800a412ebb26a3892da228b2d0ba36f0ef5d9a82166e5e52ec8d61611"
sha256: "4cab82a83ffef80b262ddedf47a0a8e56ee6fbf7fe21e6e768b02792034dd440"
url: "https://pub.dev"
source: hosted
version: "2.3.2"
version: "2.4.0"
async:
dependency: transitive
description:
@ -149,10 +149,10 @@ packages:
dependency: "direct main"
description:
name: device_info_plus
sha256: "7ff671ed0a6356fa8f2e1ae7d3558d3fb7b6a41e24455e4f8df75b811fb8e4ab"
sha256: "1d6e5a61674ba3a68fb048a7c7b4ff4bebfed8d7379dbe8f2b718231be9a7c95"
url: "https://pub.dev"
source: hosted
version: "8.0.0"
version: "8.1.0"
device_info_plus_platform_interface:
dependency: transitive
description:
@ -258,10 +258,10 @@ packages:
dependency: transitive
description:
name: flutter_local_notifications_linux
sha256: "8f6c1611e0c4a88a382691a97bb3c3feb24cc0c0b54152b8b5fb7ffb837f7fbf"
sha256: ccb08b93703aeedb58856e5637450bf3ffec899adb66dc325630b68994734b89
url: "https://pub.dev"
source: hosted
version: "3.0.0"
version: "3.0.0+1"
flutter_local_notifications_platform_interface:
dependency: transitive
description:
@ -297,10 +297,10 @@ packages:
dependency: "direct main"
description:
name: fluttertoast
sha256: "7cc92eabe01e3f1babe1571c5560b135dfc762a34e41e9056881e2196b178ec1"
sha256: "774fa28b07f3a82c93596bc137be33189fec578ed3447a93a5a11c93435de394"
url: "https://pub.dev"
source: hosted
version: "8.1.2"
version: "8.1.3"
html:
dependency: "direct main"
description:
@ -473,10 +473,10 @@ packages:
dependency: transitive
description:
name: path_provider_linux
sha256: ab0987bf95bc591da42dffb38c77398fc43309f0b9b894dcc5d6f40c4b26c379
sha256: "2e32f1640f07caef0d3cb993680f181c79e54a3827b997d5ee221490d131fbd9"
url: "https://pub.dev"
source: hosted
version: "2.1.7"
version: "2.1.8"
path_provider_platform_interface:
dependency: transitive
description:
@ -585,10 +585,10 @@ packages:
dependency: "direct main"
description:
name: share_plus
sha256: e387077716f80609bb979cd199331033326033ecd1c8f200a90c5f57b1c9f55e
sha256: "8c6892037b1824e2d7e8f59d54b3105932899008642e6372e5079c6939b4b625"
url: "https://pub.dev"
source: hosted
version: "6.3.0"
version: "6.3.1"
share_plus_platform_interface:
dependency: transitive
description:
@ -750,10 +750,10 @@ packages:
dependency: "direct main"
description:
name: url_launcher
sha256: "698fa0b4392effdc73e9e184403b627362eb5fbf904483ac9defbb1c2191d809"
sha256: e8f2efc804810c0f2f5b485f49e7942179f56eabcfe81dce3387fec4bb55876b
url: "https://pub.dev"
source: hosted
version: "6.1.8"
version: "6.1.9"
url_launcher_android:
dependency: transitive
description:
@ -766,10 +766,10 @@ packages:
dependency: transitive
description:
name: url_launcher_ios
sha256: bb328b24d3bccc20bdf1024a0990ac4f869d57663660de9c936fb8c043edefe3
sha256: "0a5af0aefdd8cf820dd739886efb1637f1f24489900204f50984634c07a54815"
url: "https://pub.dev"
source: hosted
version: "6.0.18"
version: "6.1.0"
url_launcher_linux:
dependency: transitive
description:
@ -830,18 +830,18 @@ packages:
dependency: "direct main"
description:
name: webview_flutter
sha256: f7ec234830f86d0ef2bd664e8460b0038b8c1a83ff076035cad74ac70273753c
sha256: dad1f2caa3272071275436984eb123276a6810dbe7cd6f4c60697640b56a4699
url: "https://pub.dev"
source: hosted
version: "4.0.2"
version: "4.0.4"
webview_flutter_android:
dependency: transitive
description:
name: webview_flutter_android
sha256: "5f49a6e5fc59e21fcec5e1bbcd401afbee9792a24a4f3d9cef9b5bb0cd1e3767"
sha256: da98c8cdaebea4cf89481853f37ca93ccc8d31fc386f5b3c928aea3b6e83268c
url: "https://pub.dev"
source: hosted
version: "3.2.4"
version: "3.3.0"
webview_flutter_platform_interface:
dependency: transitive
description:
@ -854,10 +854,10 @@ packages:
dependency: transitive
description:
name: webview_flutter_wkwebview
sha256: "92e7e7fa468f1df597fb9d37bcf1f303175cbe147c4dbdf06ecc323d950116eb"
sha256: dcd9ad0ef0f608f399d7a54d0b289597385e59a89f04983a672b9348faddfd98
url: "https://pub.dev"
source: hosted
version: "3.0.5"
version: "3.1.0"
win32:
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.10.10+116 # When changing this, update the tag in main() accordingly
version: 0.11.1+120 # When changing this, update the tag in main() accordingly
environment:
sdk: '>=2.18.2 <3.0.0'