From 6d4cc45d07d1b3b339252fb8bc736a1b2035ee16 Mon Sep 17 00:00:00 2001 From: Krille Date: Thu, 7 Nov 2024 14:07:58 +0100 Subject: [PATCH] refactor: Move to upstream geolocator --- android/app/build.gradle | 4 +++ lib/pages/chat/send_location_dialog.dart | 12 ++++--- pubspec.lock | 32 ++++++++++++------- pubspec.yaml | 5 +-- scripts/enable-android-google-services.patch | 18 +++++++---- .../flutter/generated_plugin_registrant.cc | 3 ++ windows/flutter/generated_plugins.cmake | 1 + 7 files changed, 49 insertions(+), 26 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 7520ff2ab..f92f73f38 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -86,3 +86,7 @@ dependencies { //implementation 'com.google.firebase:firebase-messaging:19.0.1' // Workaround for https://github.com/microg/android_packages_apps_GmsCore/issues/313#issuecomment-617651698 implementation 'androidx.multidex:multidex:2.0.1' } + +configurations.all { + exclude group: 'com.google.android.gms' +} \ No newline at end of file diff --git a/lib/pages/chat/send_location_dialog.dart b/lib/pages/chat/send_location_dialog.dart index 31a311f72..bf14460ca 100644 --- a/lib/pages/chat/send_location_dialog.dart +++ b/lib/pages/chat/send_location_dialog.dart @@ -57,13 +57,17 @@ class SendLocationDialogState extends State { Position position; try { position = await Geolocator.getCurrentPosition( - desiredAccuracy: LocationAccuracy.best, - timeLimit: const Duration(seconds: 30), + locationSettings: const LocationSettings( + accuracy: LocationAccuracy.best, + timeLimit: Duration(seconds: 30), + ), ); } on TimeoutException { position = await Geolocator.getCurrentPosition( - desiredAccuracy: LocationAccuracy.medium, - timeLimit: const Duration(seconds: 30), + locationSettings: const LocationSettings( + accuracy: LocationAccuracy.medium, + timeLimit: Duration(seconds: 30), + ), ); } setState(() => this.position = position); diff --git a/pubspec.lock b/pubspec.lock index af7511c4d..421a88055 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -801,42 +801,50 @@ packages: dependency: "direct main" description: name: geolocator - sha256: b8f520252c5c66851295bcc263bc8ae7555501938427f72216ba7688702e261d + sha256: "0ec58b731776bc43097fcf751f79681b6a8f6d3bc737c94779fe9f1ad73c1a81" url: "https://pub.dev" source: hosted - version: "7.7.1" + version: "13.0.1" geolocator_android: - dependency: "direct overridden" + dependency: transitive description: name: geolocator_android - sha256: a4834a98fab5124f2d5b881e62a40ebb4a71d6aad6ad577e047a3ffb69b67dac - url: "https://hanntech-gmbh.gitlab.io/free2pass/flutter-geolocator-floss/" + sha256: "7aefc530db47d90d0580b552df3242440a10fe60814496a979aa67aa98b1fd47" + url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "4.6.1" geolocator_apple: dependency: transitive description: name: geolocator_apple - sha256: "1e8e398cc92151d946a4bbd34e2075885333e42d35ca33e418e7ce7b0a29991e" + sha256: bc2aca02423ad429cb0556121f56e60360a2b7d694c8570301d06ea0c00732fd url: "https://pub.dev" source: hosted - version: "1.2.2" + version: "2.3.7" geolocator_platform_interface: dependency: transitive description: name: geolocator_platform_interface - sha256: "9d6f34a8a4b704d504f34acc5e52d880a7d2caedd99739902d6319179b0336d4" + sha256: "386ce3d9cce47838355000070b1d0b13efb5bc430f8ecda7e9238c8409ace012" url: "https://pub.dev" source: hosted - version: "2.3.6" + version: "4.2.4" geolocator_web: dependency: transitive description: name: geolocator_web - sha256: "0b9e0ec13ce2211085cae0055b3516c975bd6cfe2878a20c8f13611f1a259855" + sha256: "2ed69328e05cd94e7eb48bb0535f5fc0c0c44d1c4fa1e9737267484d05c29b5e" url: "https://pub.dev" source: hosted - version: "2.0.6" + version: "4.1.1" + geolocator_windows: + dependency: transitive + description: + name: geolocator_windows + sha256: "53da08937d07c24b0d9952eb57a3b474e29aae2abf9dd717f7e1230995f13f0e" + url: "https://pub.dev" + source: hosted + version: "0.2.3" get_it: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 0e1e4cc3c..fb3e3ca40 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -51,7 +51,7 @@ dependencies: flutter_typeahead: ^5.2.0 flutter_web_auth_2: ^4.0.1 flutter_webrtc: ^0.11.7 - geolocator: ^7.6.2 + geolocator: ^13.0.1 go_router: ^14.3.0 handy_window: ^0.4.0 hive: ^2.2.3 @@ -153,9 +153,6 @@ msix_config: install_certificate: false dependency_overrides: - geolocator_android: - hosted: https://hanntech-gmbh.gitlab.io/free2pass/flutter-geolocator-floss - version: ^1.0.1 # waiting for null safety # Upstream pull request: https://github.com/AntoineMarcel/keyboard_shortcuts/pull/13 keyboard_shortcuts: diff --git a/scripts/enable-android-google-services.patch b/scripts/enable-android-google-services.patch index aca4f69b8..def051189 100644 --- a/scripts/enable-android-google-services.patch +++ b/scripts/enable-android-google-services.patch @@ -1,5 +1,5 @@ diff --git a/android/app/build.gradle b/android/app/build.gradle -index 7520ff2a..ae376d9d 100644 +index f92f73f3..6d389efb 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -2,7 +2,7 @@ plugins { @@ -11,7 +11,7 @@ index 7520ff2a..ae376d9d 100644 } def localProperties = new Properties() -@@ -83,6 +83,6 @@ flutter { +@@ -83,10 +83,10 @@ flutter { } dependencies { @@ -19,6 +19,12 @@ index 7520ff2a..ae376d9d 100644 + implementation 'com.google.firebase:firebase-messaging:19.0.1' // Workaround for https://github.com/microg/android_packages_apps_GmsCore/issues/313#issuecomment-617651698 implementation 'androidx.multidex:multidex:2.0.1' } + + configurations.all { +- exclude group: 'com.google.android.gms' ++ //exclude group: 'com.google.android.gms' + } +\ No newline at end of file diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro index d0e0fbc9..0a546da0 100644 --- a/android/app/proguard-rules.pro @@ -100,10 +106,10 @@ index b2fd960a..fdb01a4d 100644 include ":app" \ No newline at end of file diff --git a/lib/utils/background_push.dart b/lib/utils/background_push.dart -index 039dde89..1cefdd71 100644 +index 1ba2659a..989f458e 100644 --- a/lib/utils/background_push.dart +++ b/lib/utils/background_push.dart -@@ -38,7 +38,7 @@ import '../config/setting_keys.dart'; +@@ -39,7 +39,7 @@ import '../config/setting_keys.dart'; import '../widgets/matrix.dart'; import 'platform_infos.dart'; @@ -112,7 +118,7 @@ index 039dde89..1cefdd71 100644 class NoTokenException implements Exception { String get cause => 'Cannot get firebase token'; -@@ -63,7 +63,7 @@ class BackgroundPush { +@@ -64,7 +64,7 @@ class BackgroundPush { final pendingTests = >{}; @@ -122,7 +128,7 @@ index 039dde89..1cefdd71 100644 DateTime? lastReceivedPush; diff --git a/pubspec.yaml b/pubspec.yaml -index 69c80d6e..efd32d89 100644 +index fb3e3ca4..039b2ccc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,7 +25,7 @@ dependencies: diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index eda11f869..83da0badc 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -36,6 +37,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin")); FlutterWebRTCPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("FlutterWebRTCPlugin")); + GeolocatorWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("GeolocatorWindows")); PasteboardPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("PasteboardPlugin")); PermissionHandlerWindowsPluginRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 5e8e211e5..24fc8c78d 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -10,6 +10,7 @@ list(APPEND FLUTTER_PLUGIN_LIST file_selector_windows flutter_secure_storage_windows flutter_webrtc + geolocator_windows pasteboard permission_handler_windows record_windows