From 11d63e05221b2a6f7936f35cf46cc6baef31fdbf Mon Sep 17 00:00:00 2001 From: Marcin Wojnarowski Date: Sat, 30 Apr 2022 15:44:03 +0200 Subject: [PATCH] Upgrade to flutter 2.10 (#325) --- .github/workflows/ci.yml | 4 -- .github/workflows/release.yml | 4 -- README.md | 6 +-- analysis_options.yaml | 8 ++++ android/app/build.gradle | 2 +- android/app/src/main/AndroidManifest.xml | 2 +- android/build.gradle | 2 +- lib/pages/communities_tab.dart | 7 ++-- lib/util/async_store.dart | 4 ++ pubspec.lock | 37 +++++++++++-------- pubspec.yaml | 6 +-- .../flutter/generated_plugin_registrant.cc | 8 ++-- windows/flutter/generated_plugin_registrant.h | 2 + 13 files changed, 51 insertions(+), 41 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17dbc22..931bfb7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,10 +110,6 @@ jobs: with: channel: "stable" - - name: Enable windows support - run: | - flutter config --enable-windows-desktop - - name: Build run: | flutter build windows --release --target lib/main_prod.dart diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4da5ec1..b8a10b3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -119,10 +119,6 @@ jobs: with: channel: "stable" - - name: Enable windows support - run: | - flutter config --enable-windows-desktop - - name: Build run: | flutter build windows --release --target lib/main_prod.dart diff --git a/README.md b/README.md index 6fd36b9..fe48f30 100644 --- a/README.md +++ b/README.md @@ -55,11 +55,7 @@ The executable will be in `build/linux/x64/release/bundle/lemmur` (be aware, how ### Windows 1. Make sure you have the additional [windows requirements](https://flutter.dev/desktop#additional-windows-requirements) (verify with `flutter doctor`) -2. Enable windows desktop: - ```sh - flutter config --enable-windows-desktop - ``` -3. Build: `flutter build windows --target lib/main_prod.dart --release` +2. Build: `flutter build windows --target lib/main_prod.dart --release` The executable will be in `build\windows\runner\Release\lemmur.exe` (be aware, however, that this executable is not standalone) diff --git a/analysis_options.yaml b/analysis_options.yaml index ee9d985..09d6844 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -5,6 +5,7 @@ linter: - avoid_catching_errors - avoid_equals_and_hash_code_on_mutable_classes - avoid_escaping_inner_quotes + - avoid_final_parameters - avoid_function_literals_in_foreach_calls - avoid_init_to_null - avoid_null_checks_in_equality_operators @@ -29,6 +30,7 @@ linter: - cascade_invocations - cast_nullable_to_non_nullable - constant_identifier_names + - conditional_uri_does_not_exist - curly_braces_in_flow_control_structures - directives_ordering - empty_catches @@ -41,8 +43,11 @@ linter: - invariant_booleans - library_names - library_prefixes + - literal_only_boolean_expressions - non_constant_identifier_names - noop_primitive_operations + - no_leading_underscores_for_library_prefixes + - no_leading_underscores_for_local_identifiers - null_check_on_nullable_type_parameter - omit_local_variable_types - one_member_abstracts @@ -81,7 +86,9 @@ linter: - prefer_spread_collections - prefer_typing_uninitialized_variables - recursive_getters + - secure_pubspec_urls - sized_box_for_whitespace + - sized_box_shrink_expand - slash_for_doc_comments - sort_child_properties_last - sort_unnamed_constructors_first @@ -94,6 +101,7 @@ linter: - unnecessary_constructor_name - unnecessary_getters_setters - unnecessary_lambdas + - unnecessary_late - unnecessary_new - unnecessary_null_aware_assignments - unnecessary_null_checks diff --git a/android/app/build.gradle b/android/app/build.gradle index 9847cf9..02e117f 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 30 + compileSdkVersion 31 lintOptions { disable 'InvalidPackage' diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 50fe246..1aba7b4 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -7,7 +7,7 @@ diff --git a/android/build.gradle b/android/build.gradle index 18261f3..40b343e 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.5.31' repositories { google() mavenCentral() diff --git a/lib/pages/communities_tab.dart b/lib/pages/communities_tab.dart index 5e92632..f3b9782 100644 --- a/lib/pages/communities_tab.dart +++ b/lib/pages/communities_tab.dart @@ -60,15 +60,14 @@ class CommunitiesTab extends HookWidget { return Future.wait(futures); } - final _loggedInAccounts = accountsStore.loggedInInstances + final loggedInAccounts = accountsStore.loggedInInstances .map((instanceHost) => '$instanceHost${accountsStore.defaultUsernameFor(instanceHost)}') .toList(); - final instancesRefreshable = - useRefreshable(getInstances, _loggedInAccounts); + final instancesRefreshable = useRefreshable(getInstances, loggedInAccounts); final communitiesRefreshable = - useRefreshable(getCommunities, _loggedInAccounts); + useRefreshable(getCommunities, loggedInAccounts); if (communitiesRefreshable.snapshot.hasError || instancesRefreshable.snapshot.hasError) { diff --git a/lib/util/async_store.dart b/lib/util/async_store.dart index 8c59d4d..2420bb3 100644 --- a/lib/util/async_store.dart +++ b/lib/util/async_store.dart @@ -65,6 +65,8 @@ abstract class _AsyncStore with Store { } rethrow; } + + return null; } /// [run] but specialized for a [LemmyApiQuery]. @@ -88,6 +90,8 @@ abstract class _AsyncStore with Store { asyncState = AsyncState.error(err.message); } } + + return null; } /// helper function for mapping [asyncState] into 3 variants diff --git a/pubspec.lock b/pubspec.lock index 675dcba..f16fa8f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,21 +7,21 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "33.0.0" + version: "34.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "3.1.0" + version: "3.2.0" archive: dependency: transitive description: name: archive url: "https://pub.dartlang.org" source: hosted - version: "3.1.8" + version: "3.1.11" args: dependency: transitive description: @@ -276,7 +276,7 @@ packages: name: flutter_mobx url: "https://pub.dartlang.org" source: hosted - version: "2.0.3+2" + version: "2.0.4" flutter_plugin_android_lifecycle: dependency: transitive description: @@ -391,7 +391,7 @@ packages: name: image_picker url: "https://pub.dartlang.org" source: hosted - version: "0.8.4+4" + version: "0.8.4+6" image_picker_for_web: dependency: transitive description: @@ -483,6 +483,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.12.11" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" matrix4_transform: dependency: "direct main" description: @@ -755,7 +762,7 @@ packages: name: shared_preferences url: "https://pub.dartlang.org" source: hosted - version: "2.0.12" + version: "2.0.13" shared_preferences_android: dependency: transitive description: @@ -886,14 +893,14 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.3" + version: "0.4.8" timeago: dependency: "direct main" description: name: timeago url: "https://pub.dartlang.org" source: hosted - version: "3.1.0" + version: "3.2.1" timing: dependency: transitive description: @@ -935,14 +942,14 @@ packages: name: url_launcher_linux url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.0.3" url_launcher_macos: dependency: transitive description: name: url_launcher_macos url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.0.3" url_launcher_platform_interface: dependency: transitive description: @@ -956,7 +963,7 @@ packages: name: url_launcher_web url: "https://pub.dartlang.org" source: hosted - version: "2.0.6" + version: "2.0.8" url_launcher_windows: dependency: transitive description: @@ -991,14 +998,14 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.3.3" + version: "2.3.10" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "0.2.0+1" xml: dependency: transitive description: @@ -1014,5 +1021,5 @@ packages: source: hosted version: "3.1.0" sdks: - dart: ">=2.15.0 <3.0.0" - flutter: ">=2.8.0" + dart: ">=2.16.0 <3.0.0" + flutter: ">=2.10.0" diff --git a/pubspec.yaml b/pubspec.yaml index 917f70a..33cb380 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,8 +18,8 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev version: 0.8.0+19 environment: - sdk: ">=2.15.0 <3.0.0" - flutter: ">=2.8.0 <3.0.0" + sdk: ">=2.16.0 <3.0.0" + flutter: ">=2.10.0 <3.0.0" dependencies: # widgets @@ -50,7 +50,7 @@ dependencies: lemmy_api_client: ^0.19.0 intl: ^0.17.0 matrix4_transform: ^2.0.0 - json_annotation: ^4.3.0 + json_annotation: ^4.4.0 keyboard_dismisser: ^2.0.0 freezed_annotation: ^1.0.0 logging: ^1.0.1 diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index ddfcf7c..4f78848 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -2,11 +2,13 @@ // Generated file. Do not edit. // +// clang-format off + #include "generated_plugin_registrant.h" -#include +#include void RegisterPlugins(flutter::PluginRegistry* registry) { - UrlLauncherPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("UrlLauncherPlugin")); + UrlLauncherWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("UrlLauncherWindows")); } diff --git a/windows/flutter/generated_plugin_registrant.h b/windows/flutter/generated_plugin_registrant.h index 9846246..dc139d8 100644 --- a/windows/flutter/generated_plugin_registrant.h +++ b/windows/flutter/generated_plugin_registrant.h @@ -2,6 +2,8 @@ // Generated file. Do not edit. // +// clang-format off + #ifndef GENERATED_PLUGIN_REGISTRANT_ #define GENERATED_PLUGIN_REGISTRANT_