From e6b05d50b95f0e7ab70299c474850c36c6219762 Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Tue, 4 Apr 2023 19:59:35 -0400 Subject: [PATCH 1/3] Scrolling bugfix #392, custom name #420, search archive label #421 --- lib/app_sources/github.dart | 8 +++++--- lib/pages/add_app.dart | 16 ++++++++-------- lib/pages/app.dart | 2 +- lib/providers/apps_provider.dart | 3 +++ lib/providers/source_provider.dart | 13 +++++++------ 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/lib/app_sources/github.dart b/lib/app_sources/github.dart index 9506453..39fbf2f 100644 --- a/lib/app_sources/github.dart +++ b/lib/app_sources/github.dart @@ -185,9 +185,11 @@ class GitHub extends AppSource { Map urlsWithDescriptions = {}; for (var e in (jsonDecode(res.body)['items'] as List)) { urlsWithDescriptions.addAll({ - e['html_url'] as String: e['description'] != null - ? e['description'] as String - : tr('noDescription') + e['html_url'] as String: + ((e['archived'] == true ? '[ARCHIVED] ' : '') + + (e['description'] != null + ? e['description'] as String + : tr('noDescription'))) }); } return urlsWithDescriptions; diff --git a/lib/pages/add_app.dart b/lib/pages/add_app.dart index 64d7f3c..f4f6c0e 100644 --- a/lib/pages/add_app.dart +++ b/lib/pages/add_app.dart @@ -334,11 +334,10 @@ class _AddAppPageState extends State { ], ); - Widget getSourcesListWidget() => Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ + Widget getSourcesListWidget() => Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ const SizedBox( height: 48, ), @@ -365,16 +364,17 @@ class _AddAppPageState extends State { fontStyle: FontStyle.italic), ))) .toList() - ])); + ]); return Scaffold( backgroundColor: Theme.of(context).colorScheme.surface, - body: CustomScrollView(slivers: [ + body: CustomScrollView(shrinkWrap: true, slivers: [ CustomAppBar(title: tr('addApp')), - SliverFillRemaining( + SliverToBoxAdapter( child: Padding( padding: const EdgeInsets.all(16), child: Column( + mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ getUrlInputRow(), diff --git a/lib/pages/app.dart b/lib/pages/app.dart index 3e015de..3f54294 100644 --- a/lib/pages/app.dart +++ b/lib/pages/app.dart @@ -147,7 +147,7 @@ class _AppPageState extends State { height: 25, ), Text( - app?.installedInfo?.name ?? app?.app.name ?? tr('app'), + app?.app.name ?? tr('app'), textAlign: TextAlign.center, style: Theme.of(context).textTheme.displayLarge, ), diff --git a/lib/providers/apps_provider.dart b/lib/providers/apps_provider.dart index 28a0fc1..4815129 100644 --- a/lib/providers/apps_provider.dart +++ b/lib/providers/apps_provider.dart @@ -670,6 +670,9 @@ class AppsProvider with ChangeNotifier { for (var app in apps) { AppInfo? info = await getInstalledInfo(app.id); app.name = info?.name ?? app.name; + if (app.additionalSettings['appName']?.toString().isNotEmpty == true) { + app.name = app.additionalSettings['appName'].toString().trim(); + } if (attemptToCorrectInstallStatus) { app = getCorrectedInstallStatusAppIfPossible(app, info) ?? app; } diff --git a/lib/providers/source_provider.dart b/lib/providers/source_provider.dart index be18176..1239eef 100644 --- a/lib/providers/source_provider.dart +++ b/lib/providers/source_provider.dart @@ -278,7 +278,8 @@ class AppSource { return regExValidator(value); } ]) - ] + ], + [GeneratedFormTextField('appName', label: tr('appName'), required: false)] ]; // Previous 2 variables combined into one at runtime for convenient usage @@ -427,8 +428,10 @@ class SourceProvider { throw NoAPKError(); } String apkVersion = apk.version.replaceAll('/', '-'); - var name = currentApp?.name.trim() ?? - apk.names.name[0].toUpperCase() + apk.names.name.substring(1); + var name = currentApp != null ? currentApp.name.trim() : ''; + name = name.isNotEmpty + ? name + : apk.names.name[0].toUpperCase() + apk.names.name.substring(1); return App( currentApp?.id ?? source.tryInferringAppId(standardUrl, @@ -436,9 +439,7 @@ class SourceProvider { generateTempID(standardUrl, additionalSettings), standardUrl, apk.names.author[0].toUpperCase() + apk.names.author.substring(1), - name.trim().isNotEmpty - ? name - : apk.names.name[0].toUpperCase() + apk.names.name.substring(1), + name, currentApp?.installedVersion, apkVersion, apk.apkUrls, From d557746965d395db61d6e76c113e2145f37f4f66 Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Tue, 4 Apr 2023 20:00:36 -0400 Subject: [PATCH 2/3] Increment version --- lib/main.dart | 2 +- pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index b9f36b6..7f2241b 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.22'; +const String currentVersion = '0.11.23'; const String currentReleaseTag = 'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES diff --git a/pubspec.yaml b/pubspec.yaml index 13d0b38..ed83e2f 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.22+144 # When changing this, update the tag in main() accordingly +version: 0.11.23+145 # When changing this, update the tag in main() accordingly environment: sdk: '>=2.18.2 <3.0.0' From 782d055bc3c6411f2798c3bacddabf256e03b044 Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Tue, 4 Apr 2023 20:21:24 -0400 Subject: [PATCH 3/3] Added cloudflare.f-droid.org support --- lib/app_sources/fdroid.dart | 13 ++++++++----- lib/providers/source_provider.dart | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/app_sources/fdroid.dart b/lib/app_sources/fdroid.dart index 3c2bba8..f0279fe 100644 --- a/lib/app_sources/fdroid.dart +++ b/lib/app_sources/fdroid.dart @@ -14,12 +14,14 @@ class FDroid extends AppSource { @override String standardizeURL(String url) { RegExp standardUrlRegExB = - RegExp('^https?://$host/+[^/]+/+packages/+[^/]+'); + RegExp('^https?://(cloudflare\\.)?$host/+[^/]+/+packages/+[^/]+'); RegExpMatch? match = standardUrlRegExB.firstMatch(url.toLowerCase()); if (match != null) { - url = 'https://$host/packages/${Uri.parse(url).pathSegments.last}'; + url = + 'https://${Uri.parse(url.substring(0, match.end)).host}/packages/${Uri.parse(url).pathSegments.last}'; } - RegExp standardUrlRegExA = RegExp('^https?://$host/+packages/+[^/]+'); + RegExp standardUrlRegExA = + RegExp('^https?://(cloudflare\\.)?$host/+packages/+[^/]+'); match = standardUrlRegExA.firstMatch(url.toLowerCase()); if (match == null) { throw InvalidURLError(name); @@ -61,9 +63,10 @@ class FDroid extends AppSource { Map additionalSettings, ) async { String? appId = tryInferringAppId(standardUrl); + String host = Uri.parse(standardUrl).host; return getAPKUrlsFromFDroidPackagesAPIResponse( - await get(Uri.parse('https://f-droid.org/api/v1/packages/$appId')), - 'https://f-droid.org/repo/$appId', + await get(Uri.parse('https://$host/api/v1/packages/$appId')), + 'https://$host/repo/$appId', standardUrl); } } diff --git a/lib/providers/source_provider.dart b/lib/providers/source_provider.dart index 1239eef..be09d43 100644 --- a/lib/providers/source_provider.dart +++ b/lib/providers/source_provider.dart @@ -363,7 +363,7 @@ class SourceProvider { url = preStandardizeUrl(url); AppSource? source; for (var s in sources.where((element) => element.host != null)) { - if (url.contains('://${s.host}')) { + if (RegExp('://(.+\\.)?${s.host}').hasMatch(url)) { source = s; break; }