Skip to content

Commit

Permalink
Merge pull request #1463 from krille-chan/krille/move-to-upstream-geo…
Browse files Browse the repository at this point in the history
…locator

refactor: Move to upstream geolocator
  • Loading branch information
krille-chan authored Nov 7, 2024
2 parents b66c2ca + 6d4cc45 commit cbe2e6b
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 26 deletions.
4 changes: 4 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
12 changes: 8 additions & 4 deletions lib/pages/chat/send_location_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,17 @@ class SendLocationDialogState extends State<SendLocationDialog> {
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);
Expand Down
32 changes: 20 additions & 12 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 1 addition & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
18 changes: 12 additions & 6 deletions scripts/enable-android-google-services.patch
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -11,14 +11,20 @@ index 7520ff2a..ae376d9d 100644
}

def localProperties = new Properties()
@@ -83,6 +83,6 @@ flutter {
@@ -83,10 +83,10 @@ flutter {
}

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 '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
Expand Down Expand Up @@ -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';

Expand All @@ -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 = <String, Completer<void>>{};

Expand All @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <file_selector_windows/file_selector_windows.h>
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
#include <flutter_webrtc/flutter_web_r_t_c_plugin.h>
#include <geolocator_windows/geolocator_windows.h>
#include <pasteboard/pasteboard_plugin.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <record_windows/record_windows_plugin_c_api.h>
Expand All @@ -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(
Expand Down
1 change: 1 addition & 0 deletions windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cbe2e6b

Please sign in to comment.