diff --git a/.flutter b/.flutter index b25305a..6fba244 160000 --- a/.flutter +++ b/.flutter @@ -1 +1 @@ -Subproject commit b25305a8832cfc6ba632a7f87ad455e319dccce8 +Subproject commit 6fba2447e95c451518584c35e25f5433f14d888c diff --git a/lib/app_sources/apkpure.dart b/lib/app_sources/apkpure.dart index 888ab51..75733ce 100644 --- a/lib/app_sources/apkpure.dart +++ b/lib/app_sources/apkpure.dart @@ -8,7 +8,7 @@ import 'package:obtainium/providers/source_provider.dart'; extension Unique on List { List unique([Id Function(E element)? id, bool inplace = true]) { - final ids = Set(); + final ids = {}; var list = inplace ? this : List.from(this); list.retainWhere((x) => ids.add(id != null ? id(x) : x as Id)); return list; @@ -76,7 +76,7 @@ class APKPure extends AppSource { return Uri.parse(standardUrl).pathSegments.last; } - getDetailsForVersion( + Future getDetailsForVersion( List> versionVariants, List supportedArchs, Map additionalSettings, diff --git a/lib/app_sources/directAPKLink.dart b/lib/app_sources/directAPKLink.dart index 5be1483..998f7bc 100644 --- a/lib/app_sources/directAPKLink.dart +++ b/lib/app_sources/directAPKLink.dart @@ -16,7 +16,7 @@ class DirectAPKLink extends AppSource { .where((element) => element.key == 'requestHeader') .isNotEmpty, ) - .toList(), + , [ GeneratedFormDropdown( 'defaultPseudoVersioningMethod', diff --git a/lib/app_sources/github.dart b/lib/app_sources/github.dart index 667e93e..560605a 100644 --- a/lib/app_sources/github.dart +++ b/lib/app_sources/github.dart @@ -566,7 +566,7 @@ class GitHub extends AppSource { } } - getLatestAPKDetailsCommon2( + Future getLatestAPKDetailsCommon2( String standardUrl, Map additionalSettings, Future Function(bool) reqUrlGenerator, @@ -667,7 +667,7 @@ class GitHub extends AppSource { ); } - rateLimitErrorCheck(Response res) { + void rateLimitErrorCheck(Response res) { if (res.headers['x-ratelimit-remaining'] == '0') { throw RateLimitError( (int.parse(res.headers['x-ratelimit-reset'] ?? '1800000000') / 60000000) diff --git a/lib/app_sources/huaweiappgallery.dart b/lib/app_sources/huaweiappgallery.dart index 2d09e60..7ecffd3 100644 --- a/lib/app_sources/huaweiappgallery.dart +++ b/lib/app_sources/huaweiappgallery.dart @@ -24,10 +24,10 @@ class HuaweiAppGallery extends AppSource { return match.group(0)!; } - getDlUrl(String standardUrl) => + String getDlUrl(String standardUrl) => 'https://${hosts[0].replaceAll('appgallery.huawei', 'appgallery.cloud.huawei')}/appdl/${standardUrl.split('/').last}'; - requestAppdlRedirect( + Future requestAppdlRedirect( String dlUrl, Map additionalSettings, ) async { @@ -45,7 +45,7 @@ class HuaweiAppGallery extends AppSource { } } - appIdFromRedirectDlUrl(String redirectDlUrl) { + String appIdFromRedirectDlUrl(String redirectDlUrl) { var parts = redirectDlUrl .split('?')[0] .split('/') diff --git a/lib/app_sources/neutroncode.dart b/lib/app_sources/neutroncode.dart index 8efca3d..de243ed 100644 --- a/lib/app_sources/neutroncode.dart +++ b/lib/app_sources/neutroncode.dart @@ -56,7 +56,7 @@ class NeutronCode extends AppSource { } } - customDateParse(String dateString) { + String? customDateParse(String dateString) { List parts = dateString.split(' '); if (parts.length != 3) { return null; diff --git a/lib/app_sources/uptodown.dart b/lib/app_sources/uptodown.dart index 3dbee4c..7315675 100644 --- a/lib/app_sources/uptodown.dart +++ b/lib/app_sources/uptodown.dart @@ -3,7 +3,7 @@ import 'package:html/parser.dart'; import 'package:obtainium/custom_errors.dart'; import 'package:obtainium/providers/source_provider.dart'; -parseDateTimeMMMddCommayyyy(String? dateString) { +DateTime? parseDateTimeMMMddCommayyyy(String? dateString) { DateTime? releaseDate; try { releaseDate = dateString != null diff --git a/lib/components/generated_form.dart b/lib/components/generated_form.dart index 27c2db5..25f3192 100644 --- a/lib/components/generated_form.dart +++ b/lib/components/generated_form.dart @@ -293,7 +293,7 @@ class _GeneratedFormState extends State { widget.onValueChanges(returnValues, valid, isBuilding); } - initForm() { + void initForm() { initKey = widget.key.toString(); // Initialize form values as all empty values.clear(); diff --git a/lib/custom_errors.dart b/lib/custom_errors.dart index 0ecdf74..b6ba177 100644 --- a/lib/custom_errors.dart +++ b/lib/custom_errors.dart @@ -76,7 +76,7 @@ class MultiAppMultiError extends ObtainiumError { MultiAppMultiError() : super(tr('placeholder'), unexpected: true); - add(String appId, dynamic error, {String? appName}) { + void add(String appId, dynamic error, {String? appName}) { if (error is SocketException) { error = error.message; } @@ -107,7 +107,7 @@ class MultiAppMultiError extends ObtainiumError { .join('\n\n'); } -showMessage(dynamic e, BuildContext context, {bool isError = false}) { +void showMessage(dynamic e, BuildContext context, {bool isError = false}) { Provider.of( context, listen: false, @@ -150,7 +150,7 @@ showMessage(dynamic e, BuildContext context, {bool isError = false}) { } } -showError(dynamic e, BuildContext context) { +void showError(dynamic e, BuildContext context) { showMessage(e, context, isError: true); } diff --git a/lib/pages/add_app.dart b/lib/pages/add_app.dart index 6251737..bff5cfa 100644 --- a/lib/pages/add_app.dart +++ b/lib/pages/add_app.dart @@ -39,7 +39,7 @@ class AddAppPageState extends State { int urlInputKey = 0; SourceProvider sourceProvider = SourceProvider(); - linkFn(String input) { + void linkFn(String input) { try { if (input.isEmpty) { throw UnsupportedURLError(); @@ -51,7 +51,7 @@ class AddAppPageState extends State { } } - changeUserInput( + void changeUserInput( String input, bool valid, bool isBuilding, { diff --git a/lib/pages/apps.dart b/lib/pages/apps.dart index e029420..6ef7e11 100644 --- a/lib/pages/apps.dart +++ b/lib/pages/apps.dart @@ -26,7 +26,7 @@ class AppsPage extends StatefulWidget { State createState() => AppsPageState(); } -showChangeLogDialog( +void showChangeLogDialog( BuildContext context, App app, String? changesUrl, @@ -100,7 +100,7 @@ showChangeLogDialog( ); } -getChangeLogFn(BuildContext context, App app) { +Null Function()? getChangeLogFn(BuildContext context, App app) { AppSource appSource = SourceProvider().getSource( app.url, overrideSource: app.overrideSource, @@ -138,7 +138,7 @@ class AppsPageState extends State { Set selectedAppIds = {}; DateTime? refreshingSince; - clearSelected() { + bool clearSelected() { if (selectedAppIds.isNotEmpty) { setState(() { selectedAppIds.clear(); @@ -148,7 +148,7 @@ class AppsPageState extends State { return false; } - selectThese(List apps) { + void selectThese(List apps) { if (selectedAppIds.isEmpty) { setState(() { for (var a in apps) { @@ -1063,6 +1063,7 @@ class AppsPageState extends State { globalNavigatorKey.currentContext ?? context, ) .catchError( + // ignore: invalid_return_type_for_catch_error (e) => showError( e, globalNavigatorKey.currentContext ?? context, @@ -1317,7 +1318,7 @@ class AppsFilter { }; } - setFormValuesFromMap(Map values) { + void setFormValuesFromMap(Map values) { nameFilter = values['appName']!; authorFilter = values['author']!; idFilter = values['appId']!; diff --git a/lib/pages/home.dart b/lib/pages/home.dart index ee45ed2..591541b 100644 --- a/lib/pages/home.dart +++ b/lib/pages/home.dart @@ -229,7 +229,7 @@ class _HomePageState extends State { }); } - setIsReversing(int targetIndex) { + void setIsReversing(int targetIndex) { bool reversing = selectedIndexHistory.isNotEmpty && selectedIndexHistory.last > targetIndex; @@ -238,7 +238,7 @@ class _HomePageState extends State { }); } - switchToPage(int index) async { + Future switchToPage(int index) async { setIsReversing(index); if (index == 0) { while ((pages[0].widget.key as GlobalKey).currentState != @@ -340,8 +340,8 @@ class _HomePageState extends State { }); return false; } - return !(pages[0].widget.key as GlobalKey).currentState - ?.clearSelected(); + return !(pages[0].widget.key as GlobalKey).currentState! + .clearSelected(); }, ); } diff --git a/lib/pages/import_export.dart b/lib/pages/import_export.dart index cfe4beb..23b1cb7 100644 --- a/lib/pages/import_export.dart +++ b/lib/pages/import_export.dart @@ -695,7 +695,7 @@ class _SelectionModalState extends State { } } - selectOnlyOne(String url) { + void selectOnlyOne(String url) { for (var e in entrySelections.keys) { entrySelections[e] = e.key == url; } diff --git a/lib/providers/apps_provider.dart b/lib/providers/apps_provider.dart index 769be36..8c4c884 100644 --- a/lib/providers/apps_provider.dart +++ b/lib/providers/apps_provider.dart @@ -112,7 +112,7 @@ Set findStandardFormatsForVersion(String version, bool strict) { return results; } -moveStrToEnd(List arr, String str, {String? strB}) { +List moveStrToEnd(List arr, String str, {String? strB}) { String? temp; arr.removeWhere((element) { bool res = element == str || element == strB; @@ -269,7 +269,7 @@ Future checkETagHeader( .toString(); } -deleteFile(File file) { +void deleteFile(File file) { try { file.deleteSync(recursive: true); } on PathAccessException catch (e) { @@ -1826,7 +1826,7 @@ class AppsProvider with ChangeNotifier { await intent.launch(); } - addMissingCategories(SettingsProvider settingsProvider) { + void addMissingCategories(SettingsProvider settingsProvider) { var cats = settingsProvider.categories; apps.forEach((key, value) { for (var c in value.app.categories) { diff --git a/lib/providers/notifications_provider.dart b/lib/providers/notifications_provider.dart index 0f126ce..0d44bc9 100644 --- a/lib/providers/notifications_provider.dart +++ b/lib/providers/notifications_provider.dart @@ -218,7 +218,7 @@ class NotificationsProvider { false; } - checkLaunchByNotif() async { + Future checkLaunchByNotif() async { final NotificationAppLaunchDetails? launchDetails = await notifications .getNotificationAppLaunchDetails(); if (launchDetails?.didNotificationLaunchApp ?? false) { @@ -229,7 +229,7 @@ class NotificationsProvider { } } - _showNotificationPayload(String? payload, {bool doublePop = false}) { + void _showNotificationPayload(String? payload, {bool doublePop = false}) { if (payload?.isNotEmpty == true) { var title = (payload ?? '\n\n').split('\n').first; var content = (payload ?? '\n\n').split('\n').sublist(1).join('\n'); diff --git a/lib/providers/source_provider.dart b/lib/providers/source_provider.dart index 9c6a14d..f14d988 100644 --- a/lib/providers/source_provider.dart +++ b/lib/providers/source_provider.dart @@ -63,15 +63,15 @@ class APKDetails { }); } -stringMapListTo2DList(List> mapList) => +List> stringMapListTo2DList(List> mapList) => mapList.map((e) => [e.key, e.value]).toList(); -assumed2DlistToStringMapList(List arr) => +List> assumed2DlistToStringMapList(List arr) => arr.map((e) => MapEntry(e[0] as String, e[1] as String)).toList(); // App JSON schema has changed multiple times over the many versions of Obtainium // This function takes an App JSON and modifies it if needed to conform to the latest (current) version -appJSONCompatibilityModifiers(Map json) { +Map appJSONCompatibilityModifiers(Map json) { var source = SourceProvider().getSource( json['url'], overrideSource: json['overrideSource'], @@ -454,7 +454,7 @@ class App { } // Ensure the input is starts with HTTPS and has no WWW -preStandardizeUrl(String url) { +String preStandardizeUrl(String url) { var firstDotIndex = url.indexOf('.'); if (!(firstDotIndex >= 0 && firstDotIndex != url.length - 1)) { throw UnsupportedURLError(); @@ -529,7 +529,7 @@ Future>> filterApksByArch( return apkUrls; } -getSourceRegex(List hosts) { +String getSourceRegex(List hosts) { return '(${hosts.join('|').replaceAll('.', '\\.')})'; } @@ -637,7 +637,7 @@ abstract class AppSource { name = runtimeType.toString(); } - overrideAdditionalAppSpecificSourceAgnosticSettingSwitch( + void overrideAdditionalAppSpecificSourceAgnosticSettingSwitch( String key, { bool disabled = true, bool defaultValue = true, @@ -949,7 +949,7 @@ abstract class MassAppUrlSource { Future>> getUrlsWithDescriptions(List args); } -regExValidator(String? value) { +String? regExValidator(String? value) { if (value == null || value.isEmpty) { return null; } @@ -961,7 +961,7 @@ regExValidator(String? value) { return null; } -intValidator(String? value, {bool positive = false}) { +String? intValidator(String? value, {bool positive = false}) { if (value == null) { return tr('invalidInput'); } @@ -980,7 +980,7 @@ bool isTempId(App app) { return RegExp('^[0-9]+\$').hasMatch(app.id); } -replaceMatchGroupsInString(RegExpMatch match, String matchGroupString) { +String? replaceMatchGroupsInString(RegExpMatch match, String matchGroupString) { if (RegExp('^\\d+\$').hasMatch(matchGroupString)) { matchGroupString = '\$$matchGroupString'; } @@ -1049,7 +1049,7 @@ List> filterApks( return apkUrls; } -isVersionPseudo(App app) => +bool isVersionPseudo(App app) => app.additionalSettings['trackOnly'] == true || (app.installedVersion != null && app.additionalSettings['versionDetection'] != true); diff --git a/pubspec.lock b/pubspec.lock index 2980b59..18f6a6c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -288,10 +288,10 @@ packages: dependency: "direct main" description: name: file_picker - sha256: "77f8e81d22d2a07d0dee2c62e1dda71dc1da73bf43bb2d45af09727406167964" + sha256: ef9908739bdd9c476353d6adff72e88fd00c625f5b959ae23f7567bd5137db0a url: "https://pub.dev" source: hosted - version: "10.1.9" + version: "10.2.0" fixnum: dependency: transitive description: @@ -804,10 +804,10 @@ packages: dependency: transitive description: name: pointer_interceptor_web - sha256: "7a7087782110f8c1827170660b09f8aa893e0e9a61431dbbe2ac3fc482e8c044" + sha256: "460b600e71de6fcea2b3d5f662c92293c049c4319e27f0829310e5a953b3ee2a" url: "https://pub.dev" source: hosted - version: "0.10.2+1" + version: "0.10.3" provider: dependency: "direct main" description: @@ -893,7 +893,7 @@ packages: description: path: "." ref: master - resolved-ref: "89cdb5434a7ac7510f6bcdb60e1d51a27ee2f40b" + resolved-ref: "012e22791138958e089f6c1a8d6c4c6943a9f253" url: "https://github.com/AlexBacich/shared-storage" source: git version: "0.7.0" @@ -1155,10 +1155,10 @@ packages: dependency: transitive description: name: webview_flutter_platform_interface - sha256: "7cb32b21825bd65569665c32bb00a34ded5779786d6201f5350979d2d529940d" + sha256: f0dc2dc3a2b1e3a6abdd6801b9355ebfeb3b8f6cde6b9dc7c9235909c4a1f147 url: "https://pub.dev" source: hosted - version: "2.13.0" + version: "2.13.1" webview_flutter_wkwebview: dependency: transitive description: @@ -1171,10 +1171,10 @@ packages: dependency: transitive description: name: win32 - sha256: "329edf97fdd893e0f1e3b9e88d6a0e627128cc17cc316a8d67fda8f1451178ba" + sha256: "66814138c3562338d05613a6e368ed8cfb237ad6d64a9e9334be3f309acfca03" url: "https://pub.dev" source: hosted - version: "5.13.0" + version: "5.14.0" win32_registry: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index ed9261e..62e0118 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -149,4 +149,4 @@ flutter: fonts: - family: Montserrat fonts: - - asset: assets/fonts/Montserrat-Regular.ttf \ No newline at end of file + - asset: assets/fonts/Montserrat-Regular.ttf