diff --git a/lib/app_sources/codeberg.dart b/lib/app_sources/codeberg.dart index aa21171..1d181bc 100644 --- a/lib/app_sources/codeberg.dart +++ b/lib/app_sources/codeberg.dart @@ -118,9 +118,11 @@ class Codeberg extends AppSource { if (version == null) { throw NoVersionError(); } + var changeLog = targetRelease['body'].toString(); return APKDetails(version, targetRelease['apkUrls'] as List, getAppNames(standardUrl), - releaseDate: releaseDate); + releaseDate: releaseDate, + changeLog: changeLog.isEmpty ? null : changeLog); } else { throw getObtainiumHttpError(res); } diff --git a/lib/app_sources/fdroid.dart b/lib/app_sources/fdroid.dart index 01f9293..3c2bba8 100644 --- a/lib/app_sources/fdroid.dart +++ b/lib/app_sources/fdroid.dart @@ -27,9 +27,6 @@ class FDroid extends AppSource { return url.substring(0, match.end); } - @override - String? changeLogPageFromStandardUrl(String standardUrl) => null; - @override String? tryInferringAppId(String standardUrl, {Map additionalSettings = const {}}) { diff --git a/lib/app_sources/github.dart b/lib/app_sources/github.dart index 1ce8cfc..9506453 100644 --- a/lib/app_sources/github.dart +++ b/lib/app_sources/github.dart @@ -160,9 +160,11 @@ class GitHub extends AppSource { if (version == null) { throw NoVersionError(); } + var changeLog = targetRelease['body'].toString(); return APKDetails(version, targetRelease['apkUrls'] as List, getAppNames(standardUrl), - releaseDate: releaseDate); + releaseDate: releaseDate, + changeLog: changeLog.isEmpty ? null : changeLog); } else { rateLimitErrorCheck(res); throw getObtainiumHttpError(res); diff --git a/lib/app_sources/html.dart b/lib/app_sources/html.dart index 003eef0..5d44b98 100644 --- a/lib/app_sources/html.dart +++ b/lib/app_sources/html.dart @@ -10,9 +10,6 @@ class HTML extends AppSource { return url; } - @override - String? changeLogPageFromStandardUrl(String standardUrl) => null; - @override Future getLatestAPKDetails( String standardUrl, diff --git a/lib/app_sources/izzyondroid.dart b/lib/app_sources/izzyondroid.dart index 8d61693..a3f388c 100644 --- a/lib/app_sources/izzyondroid.dart +++ b/lib/app_sources/izzyondroid.dart @@ -18,9 +18,6 @@ class IzzyOnDroid extends AppSource { return url.substring(0, match.end); } - @override - String? changeLogPageFromStandardUrl(String standardUrl) => null; - @override String? tryInferringAppId(String standardUrl, {Map additionalSettings = const {}}) { diff --git a/lib/app_sources/neutroncode.dart b/lib/app_sources/neutroncode.dart index 6baa0a1..b5e499a 100644 --- a/lib/app_sources/neutroncode.dart +++ b/lib/app_sources/neutroncode.dart @@ -97,10 +97,13 @@ class NeutronCode extends AppSource { var dateString = dateStringOriginal != null ? (customDateParse(dateStringOriginal)) : null; - + var changeLogElements = http.querySelectorAll('.pd-fdesc p'); return APKDetails(version, [apkUrl], AppNames(runtimeType.toString(), name ?? standardUrl.split('/').last), - releaseDate: dateString != null ? DateTime.parse(dateString) : null); + releaseDate: dateString != null ? DateTime.parse(dateString) : null, + changeLog: changeLogElements.isNotEmpty + ? changeLogElements.last.innerHtml + : null); } else { throw getObtainiumHttpError(res); } diff --git a/lib/app_sources/signal.dart b/lib/app_sources/signal.dart index ad3c7b9..38af04a 100644 --- a/lib/app_sources/signal.dart +++ b/lib/app_sources/signal.dart @@ -13,9 +13,6 @@ class Signal extends AppSource { return 'https://$host'; } - @override - String? changeLogPageFromStandardUrl(String standardUrl) => null; - @override Future getLatestAPKDetails( String standardUrl, diff --git a/lib/app_sources/sourceforge.dart b/lib/app_sources/sourceforge.dart index 2c80838..ed484a6 100644 --- a/lib/app_sources/sourceforge.dart +++ b/lib/app_sources/sourceforge.dart @@ -18,9 +18,6 @@ class SourceForge extends AppSource { return url.substring(0, match.end); } - @override - String? changeLogPageFromStandardUrl(String standardUrl) => null; - @override Future getLatestAPKDetails( String standardUrl, diff --git a/lib/app_sources/steammobile.dart b/lib/app_sources/steammobile.dart index a5e07cf..db6def3 100644 --- a/lib/app_sources/steammobile.dart +++ b/lib/app_sources/steammobile.dart @@ -24,9 +24,6 @@ class SteamMobile extends AppSource { return 'https://$host'; } - @override - String? changeLogPageFromStandardUrl(String standardUrl) => null; - @override Future getLatestAPKDetails( String standardUrl, diff --git a/lib/app_sources/telegramapp.dart b/lib/app_sources/telegramapp.dart index 6b249fd..c152ed9 100644 --- a/lib/app_sources/telegramapp.dart +++ b/lib/app_sources/telegramapp.dart @@ -15,9 +15,6 @@ class TelegramApp extends AppSource { return 'https://$host'; } - @override - String? changeLogPageFromStandardUrl(String standardUrl) => null; - @override Future getLatestAPKDetails( String standardUrl, diff --git a/lib/main.dart b/lib/main.dart index 5e49a1a..fec7297 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -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.11.10'; +const String currentVersion = '0.11.11'; const String currentReleaseTag = 'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES diff --git a/lib/pages/apps.dart b/lib/pages/apps.dart index 49e21db..8da87c2 100644 --- a/lib/pages/apps.dart +++ b/lib/pages/apps.dart @@ -232,6 +232,49 @@ class AppsPageState extends State { String? changesUrl = SourceProvider() .getSource(listedApps[index].app.url) .changeLogPageFromStandardUrl(listedApps[index].app.url); + String? changeLog = listedApps[index].app.changeLog; + var showChanges = (changeLog == null && changesUrl == null) + ? null + : () { + if (changeLog != null) { + showDialog( + context: context, + builder: (BuildContext context) { + return GeneratedFormModal( + title: tr('changes'), + items: [], + additionalWidgets: [ + Text(changeLog), + changesUrl != null + ? const SizedBox( + height: 16, + ) + : const SizedBox.shrink(), + changesUrl != null + ? GestureDetector( + child: Text( + changesUrl, + style: const TextStyle( + decoration: + TextDecoration.underline, + fontStyle: FontStyle.italic), + ), + onTap: () { + launchUrlString(changesUrl, + mode: LaunchMode + .externalApplication); + }, + ) + : const SizedBox.shrink() + ], + singleNullReturnButton: tr('ok'), + ); + }); + } else { + launchUrlString(changesUrl!, + mode: LaunchMode.externalApplication); + } + }; var transparent = const Color.fromARGB(0, 0, 0, 0).value; var hasUpdate = listedApps[index].app.installedVersion != null && listedApps[index].app.installedVersion != @@ -366,13 +409,7 @@ class AppsPageState extends State { mainAxisSize: MainAxisSize.min, children: [ GestureDetector( - onTap: changesUrl == null - ? null - : () { - launchUrlString(changesUrl, - mode: LaunchMode - .externalApplication); - }, + onTap: showChanges, child: Text( listedApps[index].app.releaseDate == null @@ -381,10 +418,11 @@ class AppsPageState extends State { .format(listedApps[index] .app .releaseDate!), - style: const TextStyle( + style: TextStyle( fontStyle: FontStyle.italic, - decoration: - TextDecoration.underline), + decoration: showChanges != null + ? TextDecoration.underline + : TextDecoration.none), )) ], ), diff --git a/lib/providers/source_provider.dart b/lib/providers/source_provider.dart index f2b7afd..270b4c4 100644 --- a/lib/providers/source_provider.dart +++ b/lib/providers/source_provider.dart @@ -36,8 +36,10 @@ class APKDetails { late List apkUrls; late AppNames names; late DateTime? releaseDate; + late String? changeLog; - APKDetails(this.version, this.apkUrls, this.names, {this.releaseDate}); + APKDetails(this.version, this.apkUrls, this.names, + {this.releaseDate, this.changeLog}); } class App { @@ -54,6 +56,7 @@ class App { bool pinned = false; List categories; late DateTime? releaseDate; + late String? changeLog; App( this.id, this.url, @@ -67,7 +70,8 @@ class App { this.lastUpdateCheck, this.pinned, {this.categories = const [], - this.releaseDate}); + this.releaseDate, + this.changeLog}); @override String toString() { @@ -130,34 +134,35 @@ 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.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) - .map((e) => e.toString()) - .toList() - : json['category'] != null - ? [json['category'] as String] - : [], - releaseDate: json['releaseDate'] == null - ? null - : DateTime.fromMicrosecondsSinceEpoch(json['releaseDate']), - ); + 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.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) + .map((e) => e.toString()) + .toList() + : json['category'] != null + ? [json['category'] as String] + : [], + releaseDate: json['releaseDate'] == null + ? null + : DateTime.fromMicrosecondsSinceEpoch(json['releaseDate']), + changeLog: + json['changeLog'] == null ? null : json['changeLog'] as String); } Map toJson() => { @@ -173,7 +178,8 @@ class App { 'lastUpdateCheck': lastUpdateCheck?.microsecondsSinceEpoch, 'pinned': pinned, 'categories': categories, - 'releaseDate': releaseDate?.microsecondsSinceEpoch + 'releaseDate': releaseDate?.microsecondsSinceEpoch, + 'changeLog': changeLog }; } @@ -437,7 +443,8 @@ class SourceProvider { DateTime.now(), currentApp?.pinned ?? false, categories: currentApp?.categories ?? const [], - releaseDate: apk.releaseDate); + releaseDate: apk.releaseDate, + changeLog: apk.changeLog); } // Returns errors in [results, errors] instead of throwing them diff --git a/pubspec.yaml b/pubspec.yaml index f3871a6..e061020 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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.11.10+131 # When changing this, update the tag in main() accordingly +version: 0.11.11+132 # When changing this, update the tag in main() accordingly environment: sdk: '>=2.18.2 <3.0.0'