From f3f778757aef276ecf1ccf98d28f612456ff3e1b Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Tue, 6 Aug 2024 17:58:24 +0800 Subject: [PATCH] =?UTF-8?q?android=E7=AB=AF=E5=AE=9A=E4=BD=8D=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/build.gradle | 4 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- lib/address/address_map_page.dart | 2 +- lib/setting/permission_setting_page.dart | 2 +- lib/utils/location.dart | 6 +- pubspec.lock | 122 +++++++++++++----- pubspec.yaml | 4 +- 7 files changed, 101 insertions(+), 41 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 6a39fb30..c7f9f6a8 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.6.0' + ext.kotlin_version = '1.7.10' repositories { maven { url 'https://maven.aliyun.com/repository/google' @@ -24,7 +24,7 @@ buildscript { dependencies { // classpath 'com.android.tools.build:gradle:4.1.0' - classpath 'com.android.tools.build:gradle:4.1.1' + classpath 'com.android.tools.build:gradle:7.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.huawei.agconnect:agcp:1.4.1.300' classpath 'com.mob.sdk:MobSDK:+' diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index ffed3a25..2ec77e51 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/lib/address/address_map_page.dart b/lib/address/address_map_page.dart index e8d1d6d1..dca398f2 100644 --- a/lib/address/address_map_page.dart +++ b/lib/address/address_map_page.dart @@ -104,7 +104,7 @@ class _AddressMapPage extends State { Future.delayed(Duration(seconds: 6), () { EasyLoading.dismiss(); }); - } else if (await PH.Permission.location.isUndetermined) { + } else if (await PH.Permission.location.isDenied) { await PH.Permission.location.request(); } else { if (Platform.isIOS) { diff --git a/lib/setting/permission_setting_page.dart b/lib/setting/permission_setting_page.dart index b0cbf557..a4ea4ff5 100644 --- a/lib/setting/permission_setting_page.dart +++ b/lib/setting/permission_setting_page.dart @@ -117,7 +117,7 @@ class _PermissionSettingPage extends State { } if (await permission.isPermanentlyDenied) { requestDialog(position); - } else if (await permission.isUndetermined) { + } else if (await permission.isDenied) { await permission.request(); queryPermission(); } else { diff --git a/lib/utils/location.dart b/lib/utils/location.dart index feda0fec..a29d3a0c 100644 --- a/lib/utils/location.dart +++ b/lib/utils/location.dart @@ -47,7 +47,11 @@ class LocationInstance { EasyLoading.dismiss(); } }); - Position locationData = await Geolocator.getCurrentPosition(); + Position locationData = await Geolocator.getCurrentPosition( + desiredAccuracy: LocationAccuracy.medium, + timeLimit: const Duration(seconds: 30), + forceAndroidLocationManager: true, + ); isNext = false; locationCallback.call(locationData); } diff --git a/pubspec.lock b/pubspec.lock index 60fcba17..3ee6e8c1 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -401,18 +401,50 @@ packages: dependency: "direct main" description: name: geolocator - sha256: "3018f6a37b1ec3c9dfb1adaa1ce406c0522c293a1a623ead94c32cd93a255fd3" + sha256: "5c496b46e245d006760e643cedde7c9fa785a34391b5eca857a46358f9bde02b" url: "https://pub.flutter-io.cn" source: hosted - version: "6.1.12" + version: "8.2.1" + geolocator_android: + dependency: transitive + description: + name: geolocator_android + sha256: "3fa9215caf1e4463adbdf1f21b07fdcb9bc2af2ef1df3715a52376b87bebb087" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.2.1" + geolocator_apple: + dependency: transitive + description: + name: geolocator_apple + sha256: bc2aca02423ad429cb0556121f56e60360a2b7d694c8570301d06ea0c00732fd + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.3.7" geolocator_platform_interface: dependency: transitive description: name: geolocator_platform_interface - sha256: aa11c4cb9eb31f096ffc62cf54858f869bd437de327cba660577ddd594a8f3fa + sha256: b8cc1d3be0ca039a3f2174b0b026feab8af3610e220b8532e42cff8ec6658535 + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.1.0" + geolocator_web: + dependency: transitive + description: + name: geolocator_web + sha256: "102e7da05b48ca6bf0a5bda0010f886b171d1a08059f01bfe02addd0175ebece" url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.9" + version: "2.2.1" + geolocator_windows: + dependency: transitive + description: + name: geolocator_windows + sha256: "4f4218f122a6978d0ad655fa3541eea74c67417440b09f0657238810d5af6bdc" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.3" gradient_widgets: dependency: "direct main" description: @@ -665,18 +697,42 @@ packages: dependency: "direct main" description: name: permission_handler - sha256: fb4666087528b1cbf91d98771cf50b14f36f4d8756ec7e7a8629dd3cb55442b7 + sha256: "5749ebeb7ec0c3865ea17e3eb337174b87747be816dab582c551e1aff6f6bbf3" + url: "https://pub.flutter-io.cn" + source: hosted + version: "9.2.0" + permission_handler_android: + dependency: transitive + description: + name: permission_handler_android + sha256: a512e0fa8abcb0659d938ec2df93a70eb1df1fdea5fdc6d79a866bfd858a28fc + url: "https://pub.flutter-io.cn" + source: hosted + version: "9.0.2+1" + permission_handler_apple: + dependency: transitive + description: + name: permission_handler_apple + sha256: "99e220bce3f8877c78e4ace901082fb29fa1b4ebde529ad0932d8d664b34f3f5" url: "https://pub.flutter-io.cn" source: hosted - version: "5.1.0+2" + version: "9.1.4" permission_handler_platform_interface: dependency: transitive description: name: permission_handler_platform_interface - sha256: f7e3c798f7c4dd215e4ca8843695b3a63a5b79c9aa04f296d316f13a15d518ba + sha256: "6760eb5ef34589224771010805bea6054ad28453906936f843a8cc4d3a55c4a4" url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.2" + version: "3.12.0" + permission_handler_windows: + dependency: transitive + description: + name: permission_handler_windows + sha256: cc074aace208760f1eee6aa4fae766b45d947df85bc831cde77009cdb4720098 + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.3" petitparser: dependency: transitive description: @@ -709,14 +765,22 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "3.1.0" + platform_detect: + dependency: transitive + description: + name: platform_detect + sha256: aab1dd0e19af823c0bbfc2d0f364e33abc52bd13be27711fea98bade0fe35213 + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.4.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - sha256: c3ebbff365bfb1b5f7b690c9857d2dabea167f35b05eb7586186499b407efb37 + sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.3" + version: "2.1.6" pointycastle: dependency: transitive description: @@ -741,6 +805,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "6.0.5" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "3c51ec0aaeccb85cacfe824816c60e1e3c53da586c64e1166422a906a4f7251c" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.4.4" pull_to_refresh: dependency: "direct main" description: @@ -1023,18 +1095,10 @@ packages: dependency: "direct main" description: name: url_launcher - sha256: e1e0c46fcd777c0f0bd7f4541b747c28ad4e925f93344cebf667ef76c695533a - url: "https://pub.flutter-io.cn" - source: hosted - version: "5.7.10" - url_launcher_linux: - dependency: transitive - description: - name: url_launcher_linux - sha256: c489023cdd864a19c0be63bb3796bec21ea4bc16bfe09568953f1828e02151c9 + sha256: "0a1f90f605bbfa9832b3514cea3a74693c6e569b8a1999fabeba12d8216a85c9" url: "https://pub.flutter-io.cn" source: hosted - version: "0.0.1+4" + version: "5.4.0" url_launcher_macos: dependency: transitive description: @@ -1047,26 +1111,18 @@ packages: dependency: transitive description: name: url_launcher_platform_interface - sha256: c6bd00f46e8c348703d0ae691850eb2052be8e1338dc3ae6f72af53b962da157 + sha256: "9b5396f49780ac4f3e6563ab0936d8218182b0f1498318b5a7d1528e0293704f" url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.9" + version: "1.0.1" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: eaa6de8ac353681794533edcedd69dd8b39ed987bf2360d172185eff8283dbc2 - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.1.5+3" - url_launcher_windows: - dependency: transitive - description: - name: url_launcher_windows - sha256: "034479b1dafd8f01de81267d8117eb5ae019e0dddcc23f4b14ed31253a2635d9" + sha256: b7478fa6476d0971fd41508bea0b4a25c59ccd263daea09f22f8ca4114559043 url: "https://pub.flutter-io.cn" source: hosted - version: "0.0.1+3" + version: "0.1.3" vector_math: dependency: transitive description: @@ -1204,5 +1260,5 @@ packages: source: hosted version: "5.4.1" sdks: - dart: ">=2.18.0 <3.0.0" + dart: ">=2.19.0 <3.0.0" flutter: ">=3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 8accc489..37ad775e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -39,9 +39,9 @@ dependencies: number_precision: ^2.0.2+1 - permission_handler: ^5.0.1+1 + permission_handler: ^9.0.2 - geolocator: ^6.1.12 + geolocator: ^8.2.1 # location: ^3.2.4 dio: ^3.0.10