diff --git a/android/app/build.gradle b/android/app/build.gradle index 7bf62ae2..c2a7685a 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -138,12 +138,18 @@ android { buildTypes { release { signingConfig signingConfigs.config + proguardFiles getDefaultProguardFile('proguard-android.txt'), + 'proguard-rules.pro' } debug { signingConfig signingConfigs.config + proguardFiles getDefaultProguardFile('proguard-android.txt'), + 'proguard-rules.pro' } profile { signingConfig signingConfigs.config + proguardFiles getDefaultProguardFile('proguard-android.txt'), + 'proguard-rules.pro' } } diff --git a/android/app/proguard-android.txt b/android/app/proguard-rules.pro similarity index 89% rename from android/app/proguard-android.txt rename to android/app/proguard-rules.pro index d952a6f4..a2053995 100644 --- a/android/app/proguard-android.txt +++ b/android/app/proguard-rules.pro @@ -15,7 +15,10 @@ -dontwarn com.sina.** -dontwarn com.mob.** - +-keep class com.baidu.** {*;} +-keep class vi.com.** {*;} +-keep class com.baidu.vi.** {*;} +-dontwarn com.baidu.** #andResGuard { # whiteList = [ diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 97ee9a2d..65e66c38 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -119,11 +119,11 @@ - - - - + + + diff --git a/android/app/src/main/kotlin/com/zsw/huixiang/HxApplication.kt b/android/app/src/main/kotlin/com/zsw/huixiang/HxApplication.kt index 0504d00f..e0e33423 100644 --- a/android/app/src/main/kotlin/com/zsw/huixiang/HxApplication.kt +++ b/android/app/src/main/kotlin/com/zsw/huixiang/HxApplication.kt @@ -1,8 +1,9 @@ package com.zsw.huixiang import android.app.Application +import com.baidu.mapapi.base.BmfMapApplication -class HxApplication : Application() { +class HxApplication : BmfMapApplication() { override fun onCreate() { diff --git a/android/build.gradle b/android/build.gradle index 749fa1fb..9ef0b68f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -10,8 +10,11 @@ buildscript { maven { url 'http://maven.aliyun.com/nexus/content/groups/public' } - google() +// google() // jcenter() + jcenter(){ + url "http://jcenter.bintray.com/" + } maven { url "http://mvn.mob.com/android" } @@ -38,7 +41,7 @@ allprojects { maven { url 'http://maven.aliyun.com/nexus/content/groups/public' } - google() +// google() // jcenter() maven { url "http://mvn.mob.com/android" diff --git a/assets/map_style/chatian.sty b/assets/map_style/chatian.sty new file mode 100644 index 00000000..69173e91 Binary files /dev/null and b/assets/map_style/chatian.sty differ diff --git a/assets/map_style/style.data b/assets/map_style/style.data deleted file mode 100644 index e57629fd..00000000 Binary files a/assets/map_style/style.data and /dev/null differ diff --git a/assets/map_style/style_extra.data b/assets/map_style/style_extra.data deleted file mode 100644 index ddeb93cb..00000000 Binary files a/assets/map_style/style_extra.data and /dev/null differ diff --git a/ios/Podfile.lock b/ios/Podfile.lock index f1cde395..85bfaa51 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,16 +1,27 @@ PODS: - - AMap3DMap (7.9.0): - - AMapFoundation (~> 1.6.6) - - amap_flutter_location (0.0.1): - - AMapLocation (~> 2.6.7) + - BaiduMapKit/Base (6.2.0) + - BaiduMapKit/Map (6.2.0): + - BaiduMapKit/Base + - BaiduMapKit/Search (6.2.0): + - BaiduMapKit/Base + - BaiduMapKit/Utils (6.2.0): + - BaiduMapKit/Base + - Flutter (1.0.0) + - flutter_baidu_mapapi_base (2.0.0): + - BaiduMapKit/Utils (= 6.2.0) - Flutter - - amap_flutter_map (0.0.1): - - AMap3DMap + - flutter_baidu_mapapi_map (2.0.0): + - BaiduMapKit/Map (= 6.2.0) - Flutter - - AMapFoundation (1.6.7) - - AMapLocation (2.6.8): - - AMapFoundation (~> 1.6.4) - - Flutter (1.0.0) + - flutter_baidu_mapapi_base + - flutter_baidu_mapapi_search (0.0.1): + - BaiduMapKit/Search (= 6.2.0) + - Flutter + - flutter_baidu_mapapi_base + - flutter_baidu_mapapi_utils (2.0.0): + - BaiduMapKit/Utils (= 6.2.0) + - Flutter + - flutter_baidu_mapapi_base - fluwx (0.0.1): - Flutter - WechatOpenSDK (= 1.8.7.1) @@ -82,9 +93,11 @@ PODS: - WechatOpenSDK (1.8.7.1) DEPENDENCIES: - - amap_flutter_location (from `.symlinks/plugins/amap_flutter_location/ios`) - - amap_flutter_map (from `.symlinks/plugins/amap_flutter_map/ios`) - Flutter (from `Flutter`) + - flutter_baidu_mapapi_base (from `.symlinks/plugins/flutter_baidu_mapapi_base/ios`) + - flutter_baidu_mapapi_map (from `.symlinks/plugins/flutter_baidu_mapapi_map/ios`) + - flutter_baidu_mapapi_search (from `.symlinks/plugins/flutter_baidu_mapapi_search/ios`) + - flutter_baidu_mapapi_utils (from `.symlinks/plugins/flutter_baidu_mapapi_utils/ios`) - fluwx (from `.symlinks/plugins/fluwx/ios`) - image_cropper (from `.symlinks/plugins/image_cropper/ios`) - image_picker (from `.symlinks/plugins/image_picker/ios`) @@ -102,9 +115,7 @@ DEPENDENCIES: SPEC REPOS: trunk: - - AMap3DMap - - AMapFoundation - - AMapLocation + - BaiduMapKit - FMDB - mob_sharesdk - MOBFoundation @@ -113,12 +124,16 @@ SPEC REPOS: - WechatOpenSDK EXTERNAL SOURCES: - amap_flutter_location: - :path: ".symlinks/plugins/amap_flutter_location/ios" - amap_flutter_map: - :path: ".symlinks/plugins/amap_flutter_map/ios" Flutter: :path: Flutter + flutter_baidu_mapapi_base: + :path: ".symlinks/plugins/flutter_baidu_mapapi_base/ios" + flutter_baidu_mapapi_map: + :path: ".symlinks/plugins/flutter_baidu_mapapi_map/ios" + flutter_baidu_mapapi_search: + :path: ".symlinks/plugins/flutter_baidu_mapapi_search/ios" + flutter_baidu_mapapi_utils: + :path: ".symlinks/plugins/flutter_baidu_mapapi_utils/ios" fluwx: :path: ".symlinks/plugins/fluwx/ios" image_cropper: @@ -149,12 +164,12 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/webview_flutter/ios" SPEC CHECKSUMS: - AMap3DMap: 4ff760f011b89aec85edd8b5fcf90d384aae1202 - amap_flutter_location: 3e33b57f1aad80b0dfb4b399de857a1a9f071e62 - amap_flutter_map: 979e54d227cedac6c7504a2151bfbf3bcf96760a - AMapFoundation: c7da72b42a713f1429c88af1858d623dde88934b - AMapLocation: dad27669c4ca68e395ce7532ff614b7d4d45f7b7 + BaiduMapKit: 907c6d9b74f66c3ff4741fc4b568ae0b339917f8 Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c + flutter_baidu_mapapi_base: 90fddba11ec4435406a7211d6ee905b4311c31db + flutter_baidu_mapapi_map: 771bf00671832b1fcddb17733518cd631529df16 + flutter_baidu_mapapi_search: 4cffaa74e739a4114595c4f82f790e1783bb612d + flutter_baidu_mapapi_utils: a5bd582b91ecd35be1bc45558b38f49d5684f70a fluwx: 07a55ed66bf3a4961e836a2a411b02dcada32902 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a image_cropper: f1668dd8d2cad2d357955caad15a40547856edcb diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 994434db..7c2efa0a 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -8,6 +8,9 @@ /* Begin PBXBuildFile section */ 05C5426026BB9CEB00D26AC2 /* liblibIO.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EE8F33A2695816000237A5E /* liblibIO.a */; }; + 05C5426F26BBE8FE00D26AC2 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EE8F373269581F600237A5E /* CoreLocation.framework */; }; + 05C5427126BBE93600D26AC2 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05C5427026BBE93600D26AC2 /* AdSupport.framework */; }; + 05C5427426BCE3AC00D26AC2 /* BMKLocationKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05C5427326BCE3AC00D26AC2 /* BMKLocationKit.framework */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 6EE8F3452695816000237A5E /* __uniappes6.js in Resources */ = {isa = PBXBuildFile; fileRef = 6EE8F2E62695815A00237A5E /* __uniappes6.js */; }; @@ -87,6 +90,10 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 05C5427026BBE93600D26AC2 /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; }; + 05C5427326BCE3AC00D26AC2 /* BMKLocationKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = BMKLocationKit.framework; sourceTree = ""; }; + 05C5427526BCFA9000D26AC2 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; }; + 05C5427726BCFCBB00D26AC2 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; @@ -255,20 +262,22 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 05C5427126BBE93600D26AC2 /* AdSupport.framework in Frameworks */, + 6EE8F36C269581D500237A5E /* libc++.tbd in Frameworks */, + 6EE8F370269581EC00237A5E /* CoreTelephony.framework in Frameworks */, + 89A626A526A7F71A0004A8F0 /* libsqlite3.0.tbd in Frameworks */, + 89AEFA9326A69A3600DD2817 /* Security.framework in Frameworks */, + 89AEFA9526A69A4800DD2817 /* SystemConfiguration.framework in Frameworks */, + 05C5426F26BBE8FE00D26AC2 /* CoreLocation.framework in Frameworks */, 05C5426026BB9CEB00D26AC2 /* liblibIO.a in Frameworks */, 89A626B026A80E520004A8F0 /* AMapFoundationKit.framework in Frameworks */, 89A626B126A80E520004A8F0 /* AMapLocationKit.framework in Frameworks */, 89A626B226A80E520004A8F0 /* libAMapLocationPlugin.a in Frameworks */, 89A626B326A80E520004A8F0 /* liblibGeolocation.a in Frameworks */, - 89AEFA9526A69A4800DD2817 /* SystemConfiguration.framework in Frameworks */, - 6EE8F370269581EC00237A5E /* CoreTelephony.framework in Frameworks */, 89AEFA8F26A699DE00DD2817 /* libz.tbd in Frameworks */, - 89A626A526A7F71A0004A8F0 /* libsqlite3.0.tbd in Frameworks */, 89A6269F26A7F6D30004A8F0 /* liblibPayment.a in Frameworks */, - 89AEFA9326A69A3600DD2817 /* Security.framework in Frameworks */, 6EE8F362269581AF00237A5E /* GLKit.framework in Frameworks */, 89AEFA9126A69A2200DD2817 /* ExternalAccessory.framework in Frameworks */, - 6EE8F36C269581D500237A5E /* libc++.tbd in Frameworks */, 89AEFA4526A6802000DD2817 /* MapKit.framework in Frameworks */, 89AEFA3D26A67FB100DD2817 /* DCUniVideoPublic.framework in Frameworks */, 6EE8F3782695820600237A5E /* libiconv.tbd in Frameworks */, @@ -296,6 +305,7 @@ 6EE8F34D2695816000237A5E /* liblibWeex.a in Frameworks */, 6EE8F3552695816000237A5E /* storage.framework in Frameworks */, 6EE8F3512695816000237A5E /* libcoreSupport.a in Frameworks */, + 05C5427426BCE3AC00D26AC2 /* BMKLocationKit.framework in Frameworks */, 89A626A726A7FF910004A8F0 /* libWeChatSDK.a in Frameworks */, 89A626AC26A8002F0004A8F0 /* libWeChatSDK.a in Frameworks */, 6EE8F3562695816000237A5E /* liblibNativeObj.a in Frameworks */, @@ -309,9 +319,19 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 05C5426126BBE82E00D26AC2 /* baidu */ = { + isa = PBXGroup; + children = ( + 05C5427326BCE3AC00D26AC2 /* BMKLocationKit.framework */, + ); + path = baidu; + sourceTree = ""; + }; 4ACDDAD1B437E297D1948602 /* Frameworks */ = { isa = PBXGroup; children = ( + 05C5427526BCFA9000D26AC2 /* SwiftUI.framework */, + 05C5427026BBE93600D26AC2 /* AdSupport.framework */, 89A626A426A7F71A0004A8F0 /* libsqlite3.0.tbd */, 89AEFA9626A69D8E00DD2817 /* Foundation.framework */, 89AEFA9426A69A4800DD2817 /* SystemConfiguration.framework */, @@ -565,6 +585,7 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( + 05C5426126BBE82E00D26AC2 /* baidu */, 89A626A826A7FFF30004A8F0 /* wx */, 89847A4826A14482008C8077 /* Runner.entitlements */, 6EE8F2E42695813500237A5E /* UniMPSDK */, @@ -578,6 +599,7 @@ 97C146F11CF9000F007C117D /* Supporting Files */, 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 05C5427726BCFCBB00D26AC2 /* Runner-Bridging-Header.h */, ); path = Runner; sourceTree = ""; @@ -626,6 +648,7 @@ TargetAttributes = { 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1250; }; }; }; @@ -845,6 +868,8 @@ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; + CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CURRENT_PROJECT_VERSION = 32; DEVELOPMENT_TEAM = YF3Q8DVP52; @@ -853,11 +878,15 @@ "$(inherited)", "$(PROJECT_DIR)/UniMPSDK/Libs", ); + GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; HEADER_SEARCH_PATHS = ( "$(inherited)", "\"${PODS_ROOT}/Headers/Public\"", - "\"${PODS_ROOT}/Headers/Public/amap_flutter_location\"", - "\"${PODS_ROOT}/Headers/Public/amap_flutter_map\"", + "\"${PODS_ROOT}/Headers/Public/flutter_bmflocation\"", + "\"${PODS_ROOT}/Headers/Public/flutter_baidu_mapapi_utils\"", + "\"${PODS_ROOT}/Headers/Public/flutter_baidu_mapapi_search\"", + "\"${PODS_ROOT}/Headers/Public/flutter_baidu_mapapi_map\"", + "\"${PODS_ROOT}/Headers/Public/flutter_baidu_mapapi_base\"", "\"${PODS_ROOT}/Headers/Public/image_cropper\"", "\"${PODS_ROOT}/Headers/Public/image_picker\"", "\"${PODS_ROOT}/Headers/Public/path_provider\"", @@ -868,7 +897,7 @@ "\"${PODS_ROOT}/Headers/Public/wakelock\"", "\"${PODS_ROOT}/Headers/Public/webview_flutter\"", "$(PROJECT_DIR)/UniMPSDK/Headers", - "//$(PROJECT_DIR)/wx/Headers", + "$(PROJECT_DIR)/wx/Headers", "\"${PODS_ROOT}/Headers/Private/fluwx\"", ); INFOPLIST_FILE = Runner/Info.plist; @@ -880,18 +909,23 @@ "$(inherited)", "$(PROJECT_DIR)/UniMPSDK/Libs", "$(PROJECT_DIR)/wx/Libs", + "$(PROJECT_DIR)/baidu", + "$(PROJECT_DIR)/Runner/baidu", ); MARKETING_VERSION = 1.0.32; ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", - "-l\"amap_flutter_location\"", - "-l\"amap_flutter_map\"", "-l\"c++\"", "-l\"image_cropper\"", "-l\"image_picker\"", "-l\"path_provider\"", + "-l\"flutter_bmflocation\"", + "-l\"flutter_baidu_mapapi_utils\"", + "-l\"flutter_baidu_mapapi_search\"", + "-l\"flutter_baidu_mapapi_map\"", + "-l\"flutter_baidu_mapapi_base\"", "-l\"permission_handler\"", "-l\"shared_preferences\"", "-l\"sqflite\"", @@ -926,10 +960,24 @@ "\"Security\"", "-framework", "\"SystemConfiguration\"", + "-framework", + "\"BMKLocationKit\"", + "-framework", + "\"BaiduMapAPI_Base\"", + "-framework", + "\"BaiduMapAPI_Map\"", + "-framework", + "\"BaiduMapAPI_Utils\"", + "-framework", + "\"BaiduMapAPI_Search\"", + "-fcxx-modules", + "-fmodules", ); PRODUCT_BUNDLE_IDENTIFIER = com.zsw.hx; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Profile; @@ -1046,6 +1094,8 @@ baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; + CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CURRENT_PROJECT_VERSION = 32; DEVELOPMENT_TEAM = YF3Q8DVP52; @@ -1054,11 +1104,15 @@ "$(inherited)", "$(PROJECT_DIR)/UniMPSDK/Libs", ); + GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; HEADER_SEARCH_PATHS = ( "$(inherited)", "\"${PODS_ROOT}/Headers/Public\"", - "\"${PODS_ROOT}/Headers/Public/amap_flutter_location\"", - "\"${PODS_ROOT}/Headers/Public/amap_flutter_map\"", + "\"${PODS_ROOT}/Headers/Public/flutter_bmflocation\"", + "\"${PODS_ROOT}/Headers/Public/flutter_baidu_mapapi_utils\"", + "\"${PODS_ROOT}/Headers/Public/flutter_baidu_mapapi_search\"", + "\"${PODS_ROOT}/Headers/Public/flutter_baidu_mapapi_map\"", + "\"${PODS_ROOT}/Headers/Public/flutter_baidu_mapapi_base\"", "\"${PODS_ROOT}/Headers/Public/image_cropper\"", "\"${PODS_ROOT}/Headers/Public/image_picker\"", "\"${PODS_ROOT}/Headers/Public/path_provider\"", @@ -1069,7 +1123,7 @@ "\"${PODS_ROOT}/Headers/Public/wakelock\"", "\"${PODS_ROOT}/Headers/Public/webview_flutter\"", "$(PROJECT_DIR)/UniMPSDK/Headers", - "//$(PROJECT_DIR)/wx/Headers", + "$(PROJECT_DIR)/wx/Headers", "\"${PODS_ROOT}/Headers/Private/fluwx\"", ); INFOPLIST_FILE = Runner/Info.plist; @@ -1081,18 +1135,23 @@ "$(inherited)", "$(PROJECT_DIR)/UniMPSDK/Libs", "$(PROJECT_DIR)/wx/Libs", + "$(PROJECT_DIR)/baidu", + "$(PROJECT_DIR)/Runner/baidu", ); MARKETING_VERSION = 1.0.32; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", - "-l\"amap_flutter_location\"", - "-l\"amap_flutter_map\"", "-l\"c++\"", "-l\"image_cropper\"", "-l\"image_picker\"", "-l\"path_provider\"", + "-l\"flutter_bmflocation\"", + "-l\"flutter_baidu_mapapi_utils\"", + "-l\"flutter_baidu_mapapi_search\"", + "-l\"flutter_baidu_mapapi_map\"", + "-l\"flutter_baidu_mapapi_base\"", "-l\"permission_handler\"", "-l\"shared_preferences\"", "-l\"sqflite\"", @@ -1127,9 +1186,24 @@ "\"Security\"", "-framework", "\"SystemConfiguration\"", + "-framework", + "\"BMKLocationKit\"", + "-framework", + "\"BaiduMapAPI_Base\"", + "-framework", + "\"BaiduMapAPI_Map\"", + "-framework", + "\"BaiduMapAPI_Utils\"", + "-framework", + "\"BaiduMapAPI_Search\"", + "-fcxx-modules", + "-fmodules", ); PRODUCT_BUNDLE_IDENTIFIER = com.zsw.hx; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -1139,6 +1213,8 @@ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; + CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CURRENT_PROJECT_VERSION = 32; DEVELOPMENT_TEAM = YF3Q8DVP52; @@ -1147,11 +1223,15 @@ "$(inherited)", "$(PROJECT_DIR)/UniMPSDK/Libs", ); + GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; HEADER_SEARCH_PATHS = ( "$(inherited)", "\"${PODS_ROOT}/Headers/Public\"", - "\"${PODS_ROOT}/Headers/Public/amap_flutter_location\"", - "\"${PODS_ROOT}/Headers/Public/amap_flutter_map\"", + "\"${PODS_ROOT}/Headers/Public/flutter_bmflocation\"", + "\"${PODS_ROOT}/Headers/Public/flutter_baidu_mapapi_utils\"", + "\"${PODS_ROOT}/Headers/Public/flutter_baidu_mapapi_search\"", + "\"${PODS_ROOT}/Headers/Public/flutter_baidu_mapapi_map\"", + "\"${PODS_ROOT}/Headers/Public/flutter_baidu_mapapi_base\"", "\"${PODS_ROOT}/Headers/Public/image_cropper\"", "\"${PODS_ROOT}/Headers/Public/image_picker\"", "\"${PODS_ROOT}/Headers/Public/path_provider\"", @@ -1162,7 +1242,7 @@ "\"${PODS_ROOT}/Headers/Public/wakelock\"", "\"${PODS_ROOT}/Headers/Public/webview_flutter\"", "$(PROJECT_DIR)/UniMPSDK/Headers", - "//$(PROJECT_DIR)/wx/Headers", + "$(PROJECT_DIR)/wx/Headers", "\"${PODS_ROOT}/Headers/Private/fluwx\"", ); INFOPLIST_FILE = Runner/Info.plist; @@ -1174,18 +1254,23 @@ "$(inherited)", "$(PROJECT_DIR)/UniMPSDK/Libs", "$(PROJECT_DIR)/wx/Libs", + "$(PROJECT_DIR)/baidu", + "$(PROJECT_DIR)/Runner/baidu", ); MARKETING_VERSION = 1.0.32; ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", - "-l\"amap_flutter_location\"", - "-l\"amap_flutter_map\"", "-l\"c++\"", "-l\"image_cropper\"", "-l\"image_picker\"", "-l\"path_provider\"", + "-l\"flutter_bmflocation\"", + "-l\"flutter_baidu_mapapi_utils\"", + "-l\"flutter_baidu_mapapi_search\"", + "-l\"flutter_baidu_mapapi_map\"", + "-l\"flutter_baidu_mapapi_base\"", "-l\"permission_handler\"", "-l\"shared_preferences\"", "-l\"sqflite\"", @@ -1220,10 +1305,24 @@ "\"Security\"", "-framework", "\"SystemConfiguration\"", + "-framework", + "\"BMKLocationKit\"", + "-framework", + "\"BaiduMapAPI_Base\"", + "-framework", + "\"BaiduMapAPI_Map\"", + "-framework", + "\"BaiduMapAPI_Utils\"", + "-framework", + "\"BaiduMapAPI_Search\"", + "-fcxx-modules", + "-fmodules", ); PRODUCT_BUNDLE_IDENTIFIER = com.zsw.hx; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; diff --git a/ios/Runner/AppDelegate.m b/ios/Runner/AppDelegate.m index a8269877..6b75bbb1 100644 --- a/ios/Runner/AppDelegate.m +++ b/ios/Runner/AppDelegate.m @@ -19,7 +19,7 @@ [DCUniMPSDKEngine initSDKEnvironmentWithLaunchOptions:options ]; FlutterViewController* controller = (FlutterViewController*)self.window.rootViewController; - FlutterMethodChannel* uniAppChannel = [FlutterMethodChannel methodChannelWithName:@"min" binaryMessenger:controller]; + FlutterMethodChannel* uniAppChannel = [FlutterMethodChannel methodChannelWithName:@"min" binaryMessenger:(NSObject *)controller]; UniappPlugin * plugin = [[UniappPlugin alloc] init]; [DCUniMPSDKEngine setDelegate:plugin]; [uniAppChannel setMethodCallHandler:^(FlutterMethodCall * _Nonnull call, FlutterResult _Nonnull result) { diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index eb266313..e8a6f700 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -151,5 +151,6 @@ https://hx.lotus-wallet.com/app/ io.flutter.embedded_views_preview YES + diff --git a/ios/Runner/Runner-Bridging-Header.h b/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 00000000..1b2cb5d6 --- /dev/null +++ b/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1,4 @@ +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + diff --git a/ios/Runner/Runner.entitlements b/ios/Runner/Runner.entitlements index 9c897b6e..2d6a8024 100644 --- a/ios/Runner/Runner.entitlements +++ b/ios/Runner/Runner.entitlements @@ -7,8 +7,8 @@ com.apple.developer.associated-domains applinks:demo.dcloud.net.cn - hx.lotus-wallet.com applinks:hx.lotus-wallet.com + applinks:huixiang.lotus-wallet.com diff --git a/ios/Runner/baidu/BMKLocationKit b/ios/Runner/baidu/BMKLocationKit new file mode 100644 index 00000000..1c745780 Binary files /dev/null and b/ios/Runner/baidu/BMKLocationKit differ diff --git a/ios/Runner/baidu/BMKLocationKit.framework/BMKLocationKit b/ios/Runner/baidu/BMKLocationKit.framework/BMKLocationKit new file mode 100644 index 00000000..1c745780 Binary files /dev/null and b/ios/Runner/baidu/BMKLocationKit.framework/BMKLocationKit differ diff --git a/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKGeoFenceManager.h b/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKGeoFenceManager.h new file mode 100644 index 00000000..ef834cd8 --- /dev/null +++ b/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKGeoFenceManager.h @@ -0,0 +1,141 @@ +// +// BMKGeoFenceManager.h +// BMKLocationKit +// +// Created by baidu on 2017/3/2. +// Copyright © 2017年 baidu. All rights reserved. +// + +#import "BMKGeoFenceRegion.h" + +@protocol BMKGeoFenceManagerDelegate; + +///地理围栏监听状态类型 +typedef NS_OPTIONS(NSUInteger, BMKGeoFenceActiveAction) +{ + BMKGeoFenceActiveActionNone = 0, ///< 不进行监听 + BMKGeoFenceActiveActionInside = 1 << 0, ///< 在范围内 + BMKGeoFenceActiveActionOutside = 1 << 1, ///< 在范围外 + BMKGeoFenceActiveActionStayed = 1 << 2, ///< 停留(在范围内超过10分钟) +}; + +///BMKGeoFence errorDomain +FOUNDATION_EXPORT NSErrorDomain const _Nonnull BMKGeoFenceErrorDomain; + +///地理围栏错误码 +typedef NS_ENUM(NSInteger, BMKGeoFenceErrorCode) { + BMKGeoFenceErrorUnknown = 1, ///< 未知错误 + BMKGeoFenceErrorInvalidParameter = 2, ///< 参数错误 + BMKGeoFenceErrorFailureConnection = 3, ///< 网络连接异常 + BMKGeoFenceErrorFailureAuth = 4, ///< 鉴权失败 + BMKGeoFenceErrorNoValidFence = 5, ///< 无可用围栏 + BMKGeoFenceErroFailureLocating = 6, ///< 定位错误 +}; + + +///地理围栏管理类 +@interface BMKGeoFenceManager : NSObject + + +///实现了 BMKGeoFenceManagerDelegate 协议的类指针。 +@property (nonatomic, weak, nullable) id delegate; + + +///需要进行通知的行为,默认为BMKGeoFenceActiveActionInside。 +@property (nonatomic, assign) BMKGeoFenceActiveAction activeAction; + + +///指定定位是否会被系统自动暂停。默认为NO。 +@property (nonatomic, assign) BOOL pausesLocationUpdatesAutomatically; + + +///是否允许后台定位。默认为NO。只在iOS 9.0及之后起作用。设置为YES的时候必须保证 Background Modes 中的 Location updates 处于选中状态,否则会抛出异常。 +@property (nonatomic, assign) BOOL allowsBackgroundLocationUpdates; + + +/** + * @brief 添加一个圆形围栏 + * @param center 围栏的中心点经纬度坐标 + * @param radius 围栏的半径,单位:米,要求大于0 + * @param type 围栏的坐标系类型 + * @param customID 用户自定义ID,可选,SDK原值返回 + */ +- (void)addCircleRegionForMonitoringWithCenter:(CLLocationCoordinate2D)center radius:(CLLocationDistance)radius coorType:(BMKLocationCoordinateType)type customID:(NSString * _Nullable)customID; + + +/** + * @brief 根据经纬度坐标数据添加一个闭合的多边形围栏,点与点之间按顺序尾部相连, 第一个点与最后一个点相连 + * @param coordinates 经纬度坐标点数据,coordinates对应的内存会拷贝,调用者负责该内存的释放 + * @param count 经纬度坐标点的个数,不可小于3个 + * @param type 围栏的坐标系类型 + * @param customID 用户自定义ID,可选,SDK原值返回 + */ +- (void)addPolygonRegionForMonitoringWithCoordinates:(CLLocationCoordinate2D * _Nonnull)coordinates count:(NSInteger)count coorType:(BMKLocationCoordinateType)type customID:(NSString * _Nullable)customID; + + +/** + * @brief 根据customID获得指定的围栏,如果customID传nil,则返回全部围栏 + * @param customID 用户执行添加围栏函数时传入的customID + * @return 获得的围栏构成的数组,如果没有结果,返回nil + */ +- (NSArray * _Nullable)geoFenceRegionsWithCustomID:(NSString * _Nullable)customID; + + +/** + * @brief 移除指定围栏 + * @param region 要停止监控的围栏 + */ +- (void)removeTheGeoFenceRegion:(BMKGeoFenceRegion * _Nonnull)region; + + +/** + * @brief 移除指定customID的围栏 + * @param customID 用户执行添加围栏函数时传入的customID + */ +- (void)removeGeoFenceRegionsWithCustomID:(NSString * _Nullable)customID; + + +/** + * @brief 移除所有围栏 + */ +- (void)removeAllGeoFenceRegions; + + +@end + + + +///地理围栏代理协议,该协议定义了获取地理围栏相关回调方法,包括添加、状态改变等。 +@protocol BMKGeoFenceManagerDelegate + +@optional + +/** + * @brief 为了适配app store关于新的后台定位的审核机制(app store要求如果开发者只配置了使用期间定位,则代码中不能出现申请后台定位的逻辑),当开发者在plist配置NSLocationAlwaysUsageDescription或者NSLocationAlwaysAndWhenInUseUsageDescription时,需要在该delegate中调用后台定位api:[locationManager requestAlwaysAuthorization]。开发者如果只配置了NSLocationWhenInUseUsageDescription,且只有使用期间的定位需求,则无需在delegate中实现逻辑。 + * @param manager 定位 BMKGeoFenceManager 类。 + * @param locationManager 系统 CLLocationManager 类 。 + * @since 1.7.0 + */ +- (void)BMKGeoFenceManager:(BMKGeoFenceManager * _Nonnull)manager doRequestAlwaysAuthorization:(CLLocationManager * _Nonnull)locationManager; + +/** + * @brief 添加地理围栏完成后的回调,成功与失败都会调用 + * @param manager 地理围栏管理类 + * @param regions 成功添加的一个或多个地理围栏构成的数组 + * @param customID 用户执行添加围栏函数时传入的customID + * @param error 添加失败的错误信息 + */ +- (void)BMKGeoFenceManager:(BMKGeoFenceManager * _Nonnull)manager didAddRegionForMonitoringFinished:(NSArray * _Nullable)regions customID:(NSString * _Nullable)customID error:(NSError * _Nullable)error; + + +/** + * @brief 地理围栏状态改变时回调,当围栏状态的值发生改变,定位失败都会调用 + * @param manager 地理围栏管理类 + * @param region 状态改变的地理围栏 + * @param customID 用户执行添加围栏函数时传入的customID + * @param error 错误信息,如定位相关的错误 + */ +- (void)BMKGeoFenceManager:(BMKGeoFenceManager * _Nonnull)manager didGeoFencesStatusChangedForRegion:(BMKGeoFenceRegion * _Nullable)region customID:(NSString * _Nullable)customID error:(NSError * _Nullable)error; + +@end + diff --git a/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKGeoFenceRegion.h b/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKGeoFenceRegion.h new file mode 100644 index 00000000..119358f5 --- /dev/null +++ b/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKGeoFenceRegion.h @@ -0,0 +1,114 @@ +// +// BMKGeoFenceRegion.h +// BMKLocationKit +// +// Created by baidu on 2017/3/2. +// Copyright © 2017年 baidu. All rights reserved. +// + +#import +#import +#import "BMKLocationManager.h" + +///BMKGeoFence Region State +typedef NS_ENUM(NSInteger, BMKGeoFenceRegionStatus) +{ + BMKGeoFenceRegionStatusUnknown = 0, ///< 未知 + BMKGeoFenceRegionStatusInside = 1, ///< 在范围内 + BMKGeoFenceRegionStatusOutside = 1 << 1, ///< 在范围外 + BMKGeoFenceRegionStatusStayed = 1 << 2, ///< 停留(在范围内超过10分钟) +}; + +#pragma mark - BMKGeoFenceRegion + + +///地理围栏基类,不可直接使用 +@interface BMKGeoFenceRegion : NSObject + + +///BMKGeoFenceRegion的唯一标识符 +@property (nonatomic, copy, readonly) NSString *identifier; + + +///用户自定义ID,可为nil。 +@property (nonatomic, copy, readonly) NSString *customID; + + +///坐标点和围栏的关系,比如用户的位置和围栏的关系 +@property (nonatomic, assign) BMKGeoFenceRegionStatus fenceStatus; + +///设定围栏坐标系类型。默认为 BMKLocationCoordinateTypeGCJ02。 +@property(nonatomic, readonly) BMKLocationCoordinateType coordinateType; + +///上次发生状态变化的时间 +@property(nonatomic, assign)NSTimeInterval lastEventTime; + + +/** + * @brief 判断位置与围栏状态 + * @param CLLocationCoordinate2D 坐标值 + * @return 返回BMKGeoFenceRegionStatus状态 + */ +-(BMKGeoFenceRegionStatus)judgeStatusWithCoor:(CLLocationCoordinate2D)coor; + +@end + + +#pragma mark - BMKLocationCircleRegion + + +///圆形地理围栏 +@interface BMKGeoFenceCircleRegion : BMKGeoFenceRegion + + +///中心点的经纬度坐标 +@property (nonatomic, readonly) CLLocationCoordinate2D center; + + +///半径,单位:米 +@property (nonatomic, readonly) CLLocationDistance radius; + +/** + * @brief 构造圆形围栏 + * @param customid 用户自定义ID + * @param identityid 识别id + * @param center 中心坐标 + * @param radius 围栏半径 + * @param type 坐标系类型 + * @return BMKGeoFenceCircleRegion id + */ +- (id)initWithCustomID:(NSString *)customid identityID:(NSString *)identityid center:(CLLocationCoordinate2D)center radius:(CLLocationDistance)radius coor:(BMKLocationCoordinateType)type; + + + +@end + + +#pragma mark -BMKGeoFencePolygonRegion + + +///多边形地理围栏 +@interface BMKGeoFencePolygonRegion : BMKGeoFenceRegion + + +///经纬度坐标点数据 +@property (nonatomic, readonly) CLLocationCoordinate2D *coordinates; + + +///经纬度坐标点的个数 +@property (nonatomic, readonly) NSInteger count; + + +/** + * @brief 构造多边形围栏 + * @param customid 用户自定义ID + * @param identityid 识别id + * @param coor 多边形顶点 + * @param count 顶点个数 + * @param type 坐标系类型 + * @return BMKGeoFencePolygonRegion id + */ +- (id)initWithCustomID:(NSString *)customid identityID:(NSString *)identityid coor:(CLLocationCoordinate2D *)coor count:(NSInteger)count coor:(BMKLocationCoordinateType)type; + +@end + diff --git a/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocation.h b/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocation.h new file mode 100644 index 00000000..eae633c2 --- /dev/null +++ b/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocation.h @@ -0,0 +1,97 @@ +// +// BMKLocation.h +// LocationComponent +// +// Created by baidu on 2017/8/16. +// Copyright © 2017年 baidu. All rights reserved. +// + +#ifndef BMKLocation_h +#define BMKLocation_h + +#import +#import "BMKLocationReGeocode.h" + +/** + * BMKLocationProvider 位置数据来源,分iOS系统定位和其他定位服务结果两种,目前仅支持iOS系统定位服务 + * + */ +typedef NS_ENUM(int, BMKLocationProvider) { + + BMKLocationProviderIOS = 0, //!<位置来源于iOS本身定位 + BMKLocationProviderOther //!<位置来源于其他定位服务 + +}; + +///描述百度iOS 定位数据 +@interface BMKLocation : NSObject + +///BMKLocation 位置数据 +@property(nonatomic, copy, readonly) CLLocation * _Nullable location; + +///BMKLocation 地址数据 +@property(nonatomic, copy) BMKLocationReGeocode * _Nullable rgcData; + +///BMKLocation 位置来源 +@property(nonatomic, assign) BMKLocationProvider provider; + +///BMKLocation 位置ID +@property(nonatomic, retain) NSString * _Nullable locationID; + +/* + * floorString + * + * Discussion: + * 室内定位成功时返回的楼层信息,ex:f1 + */ +@property(readonly, nonatomic, copy, nullable) NSString *floorString; + +/* + * buildingID + * + * Discussion: + * 室内定位成功时返回的百度建筑物ID + */ +@property(readonly, nonatomic, copy, nullable) NSString *buildingID; + +/* + * buildingName + * + * Discussion: + * 室内定位成功时返回的百度建筑物名称 + */ +@property(readonly, nonatomic, copy, nullable) NSString *buildingName; + + +/* + * extraInfo + * + * Discussion: + * 定位附加信息,如停车位code识别结果、停车位code示例、vdr推算结果置信度等 + */ +@property(readonly, nonatomic, copy, nullable) NSDictionary * extraInfo; + +/** + * @brief 初始化BMKLocation实例 + * @param loc CLLocation对象 + * @param rgc BMKLocationReGeocode对象 + * @return BMKLocation id + */ +- (id _Nonnull)initWithLocation:(CLLocation * _Nullable)loc withRgcData:(BMKLocationReGeocode * _Nullable)rgc; + +/** + * @brief 构造BMKLocation + * @param location CLLocation + * @param floorString 楼层字符串 + * @param buildingID 建筑物ID + * @param buildingName 建筑物名称 + * @param info 位置附加信息 + * @return BMKLocation id + */ +-(id _Nonnull)initWithLocation:(CLLocation * _Nullable)location floorString:(NSString * _Nullable)floorString buildingID:(NSString * _Nullable)buildingID + buildingName:(NSString * _Nullable)buildingName extraInfo:(NSDictionary * _Nullable)info withRgcData:(BMKLocationReGeocode * _Nullable)rgc; + + +@end + +#endif /* BMKLocation_h */ diff --git a/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationAuth.h b/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationAuth.h new file mode 100644 index 00000000..90494645 --- /dev/null +++ b/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationAuth.h @@ -0,0 +1,56 @@ +// +// BMKLocationAuth.h +// LocationComponent +// +// Created by baidu on 2017/4/10. +// Copyright © 2017年 baidu. All rights reserved. +// + +#ifndef BMKLocationAuth_h +#define BMKLocationAuth_h + +///定位鉴权错误码 +typedef NS_ENUM(NSInteger, BMKLocationAuthErrorCode) { + BMKLocationAuthErrorUnknown = -1, ///< 未知错误 + BMKLocationAuthErrorSuccess = 0, ///< 鉴权成功 + BMKLocationAuthErrorNetworkFailed = 1, ///< 因网络鉴权失败 + BMKLocationAuthErrorFailed = 2, ///< KEY非法鉴权失败 + +}; +///通知Delegate +@protocol BMKLocationAuthDelegate +@optional + +/** + *@brief 返回授权验证错误 + *@param iError 错误号 : 为0时验证通过,具体参加BMKLocationAuthErrorCode + */ +- (void)onCheckPermissionState:(BMKLocationAuthErrorCode)iError; +@end + + +///BMKLocationAuth类。用于鉴权 +@interface BMKLocationAuth : NSObject + +///鉴权状态0:成功; 1:网络错误; 2:授权失败 +@property(nonatomic, readonly, assign) BMKLocationAuthErrorCode permisionState; + +/** + * @brief 得到BMKLocationAuth的单例 + */ ++ (BMKLocationAuth*)sharedInstance; + + +/** + *@brief 启动引擎 + *@param key 申请的有效key + *@param delegate 回调是否鉴权成功 + */ +-(void)checkPermisionWithKey:(NSString*)key authDelegate:(id)delegate; + + +@end + + + +#endif /* BMKLocationAuth_h */ diff --git a/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationComponent.h b/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationComponent.h new file mode 100644 index 00000000..0b6310fe --- /dev/null +++ b/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationComponent.h @@ -0,0 +1,16 @@ +// +// BMKLocationComponent.h +// LocationComponent +// +// Created by Baidu on 3/31/14. +// Copyright (c) 2014 baidu. All rights reserved. +// + +#import "BMKLocationManager.h" +#import "BMKLocationKitVersion.h" +#import "BMKLocationPoi.h" +#import "BMKLocation.h" +#import "BMKGeoFenceRegion.h" +#import "BMKGeoFenceManager.h" +#import "BMKLocationReGeocode.h" +#import "BMKLocationAuth.h" diff --git a/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationKitVersion.h b/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationKitVersion.h new file mode 100644 index 00000000..0426c5e4 --- /dev/null +++ b/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationKitVersion.h @@ -0,0 +1,30 @@ +// +// BMKLocationKitVersion.h +// BMKLocationKit +// +// Created by baidu on 17/9/9. +// Copyright © 2017年 baidu. All rights reserved. +// + +#ifndef BMKLocationKitVersion_h +#define BMKLocationKitVersion_h + +#import + +/** + *获取当前定位sdk 的版本号 + *当前定位sdk版本 : 2.0.0 + *@return 返回当前定位sdk 的版本号 + */ +UIKIT_EXTERN NSString* BMKLocationKitVersion(); + +/** + *获取当前定位sdk 的float版本号 + *当前定位sdk版本 : 2.0 + *@return 返回当前定位sdk 的float版本号 + */ +UIKIT_EXTERN float BMKLocationKitFloatVersion(); + + + +#endif /* BMKLocationKitVersion_h */ diff --git a/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationManager.h b/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationManager.h new file mode 100644 index 00000000..d6e3ab8a --- /dev/null +++ b/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationManager.h @@ -0,0 +1,296 @@ +// +// BMKLocationManager.h +// BMKLocationKit +// +// Created by baidu on 2017/3/2. +// Copyright © 2017年 baidu. All rights reserved. +// + +#import +#import +#import +#import "BMKLocationReGeocode.h" +#import "BMKLocation.h" + +/** BMKLocationCoordinateType 枚举坐标系类型 + * + */ +typedef NS_ENUM(NSUInteger, BMKLocationCoordinateType) +{ + BMKLocationCoordinateTypeBMK09LL = 0, /// delegate; + +///设定定位的最小更新距离。默认为 kCLDistanceFilterNone。 +@property(nonatomic, assign) CLLocationDistance distanceFilter; + +///设定定位精度。默认为 kCLLocationAccuracyBest。 +@property(nonatomic, assign) CLLocationAccuracy desiredAccuracy; + +///设定定位类型。默认为 CLActivityTypeAutomotiveNavigation。 +@property(nonatomic, assign) CLActivityType activityType; + +///设定定位坐标系类型。默认为 BMKLocationCoordinateTypeGCJ02。 +@property(nonatomic, assign) BMKLocationCoordinateType coordinateType; + +///指定定位是否会被系统自动暂停。默认为NO。 +@property(nonatomic, assign) BOOL pausesLocationUpdatesAutomatically; + + +///是否允许后台定位。默认为NO。只在iOS 9.0及之后起作用。设置为YES的时候必须保证 Background Modes 中的 Location updates 处于选中状态,否则会抛出异常。由于iOS系统限制,需要在定位未开始之前或定位停止之后,修改该属性的值才会有效果。 +@property(nonatomic, assign) BOOL allowsBackgroundLocationUpdates; + +///指定单次定位超时时间,默认为10s。最小值是2s。注意单次定位请求前设置。注意: 单次定位超时时间从确定了定位权限(非kCLAuthorizationStatusNotDetermined状态)后开始计算。 +@property(nonatomic, assign) NSInteger locationTimeout; + +///指定单次定位逆地理超时时间,默认为10s。最小值是2s。注意单次定位请求前设置。 +@property(nonatomic, assign) NSInteger reGeocodeTimeout; + +///连续定位是否返回逆地理信息,默认YES。 +@property (nonatomic, assign) BOOL locatingWithReGeocode; + +///定位sdk-v1.3之后,开发者可以选择是否需要最新版本rgc数据,1.9之后默认是需要YES;YES的情况下,定位sdk会实时返回最新的rgc数据,如城市变更等数据都会实时更新 +@property (nonatomic, assign) BOOL isNeedNewVersionReGeocode; + + +///开发者可以指定该用户的id,用于后续统一识别用户,便于查找问题 +@property(nonatomic, copy, nullable) NSString * userID; + +///返回定位精度等级,IOS14之后用户可以直接控制返回定位的精度等级,开发者可以通过这个值适配不同定位等级下的产品逻辑 +@property (nonatomic, readonly) BMKLAccuracyAuthorization accuracyAuthorization; + + +/** + * @brief 单次定位。如果当前正在连续定位,调用此方法将会失败,返回NO。\n该方法将会根据设定的 desiredAccuracy 去获取定位信息。如果获取的定位信息精确度低于 desiredAccuracy ,将会持续的等待定位信息,直到超时后通过completionBlock返回精度最高的定位信息。\n可以通过 stopUpdatingLocation 方法去取消正在进行的单次定位请求。 + * @param withReGeocode 是否带有逆地理信息(获取逆地理信息需要联网) + * @param withNetWorkState 是否带有移动热点识别状态(需要联网) + * @param completionBlock 单次定位完成后的Block + * @return 是否成功添加单次定位Request + */ +- (BOOL)requestLocationWithReGeocode:(BOOL)withReGeocode withNetworkState:(BOOL)withNetWorkState completionBlock:(BMKLocatingCompletionBlock _Nonnull)completionBlock; + +/** + * @brief 开始连续定位。调用此方法会cancel掉所有的单次定位请求。 + */ +- (void)startUpdatingLocation; + +/** + * @brief 停止连续定位。调用此方法会cancel掉所有的单次定位请求,可以用来取消单次定位。 + */ +- (void)stopUpdatingLocation; + +/** + * @brief 请求网络状态结果回调。 + */ +- (void)requestNetworkState; + + +/** + * @brief 该方法返回设备是否支持设备朝向事件回调。 + * @return 是否支持设备朝向事件回调 + */ ++ (BOOL)headingAvailable; + +/** + * @brief 该方法为BMKLocationManager开始设备朝向事件回调。 + */ +- (void)startUpdatingHeading; + +/** + * @brief 该方法为BMKLocationManager停止设备朝向事件回调。 + */ +- (void)stopUpdatingHeading; + +/** + * @brief 该方法为BMKLocationManager尝试使用高精度室内定位。在特定的室内场景下会有更高精度的定位回调,只在室内定位版本生效。 + */ +- (void)tryIndoorLocation; + +/** + * @brief 该方法为BMKLocationManager会关闭高精度室内定位,只在室内定位版本生效。 + */ +- (void)stopIndoorLocation; + + +/** + * @brief 转换为百度经纬度的坐标 + * @param coordinate 待转换的经纬度 + * @param srctype 待转换坐标系类型 + * @param destype 目标百度坐标系类型(bd09ll,bd09mc) + * @return 目标百度坐标系经纬度 + */ ++ (CLLocationCoordinate2D) BMKLocationCoordinateConvert:(CLLocationCoordinate2D) coordinate SrcType:(BMKLocationCoordinateType)srctype DesType:(BMKLocationCoordinateType)destype; + +/** + * @brief 判断目标经纬度是否在大陆以及港、澳地区。 + * @param coordinate 待判断的目标经纬度 + * @param coortype 待判断经纬度的坐标系类型 + * @return 是否在大陆以及港、澳地区 + */ ++ (BOOL) BMKLocationDataAvailableForCoordinate:(CLLocationCoordinate2D)coordinate withCoorType:(BMKLocationCoordinateType)coortype; + + + +/** + * @brief 返回当前定位权限 + * @return CLAuthorizationStatus 定位权限枚举类型 + */ +- (CLAuthorizationStatus)authorizationStatus; + + +/** + * @brief 如果你没有全量定位等级精度权限,利用该接口可以临时请求一次全量定位精度等级,系统会抛出弹框让用户确认是否授权app授予相应权限 + * @param purposeKey info.plist中NSLocationTemporaryUsageDescriptionDictionary定义的key,对应相应的value可以详细描述申请全量定位精度等级的原因 + * @param completion 回调是否 + * @return + */ +- (void)requestTemporaryFullAccuracyAuthorizationWithPurposeKey:(NSString * _Nonnull)purposeKey completion:(void(^ _Nullable)(NSError * _Nullable))completion API_AVAILABLE(ios(14.0)); + +/** + * @brief 请求一次全量定位精度等级 + * @param purposeKey info.plist中NSLocationTemporaryUsageDescriptionDictionary定义的key + * @return + */ +- (void)requestTemporaryFullAccuracyAuthorizationWithPurposeKey:(NSString * _Nonnull)purposeKey API_AVAILABLE(ios(14.0)); + + +@end + +#pragma mark - BMKLocationManagerDelegate + + +///BMKLocationManagerDelegate 协议定义了发生错误时的错误回调方法,连续定位的回调方法等。 +@protocol BMKLocationManagerDelegate + +@optional + +/** + * @brief 为了适配app store关于新的后台定位的审核机制(app store要求如果开发者只配置了使用期间定位,则代码中不能出现申请后台定位的逻辑),当开发者在plist配置NSLocationAlwaysUsageDescription或者NSLocationAlwaysAndWhenInUseUsageDescription时,需要在该delegate中调用后台定位api:[locationManager requestAlwaysAuthorization]。开发者如果只配置了NSLocationWhenInUseUsageDescription,且只有使用期间的定位需求,则无需在delegate中实现逻辑。 + * @param manager 定位 BMKLocationManager 类。 + * @param locationManager 系统 CLLocationManager 类 。 + * @since 1.6.0 + */ +- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager doRequestAlwaysAuthorization:(CLLocationManager * _Nonnull)locationManager; + +/** + * @brief 当定位发生错误时,会调用代理的此方法。 + * @param manager 定位 BMKLocationManager 类。 + * @param error 返回的错误,参考 CLError 。 + */ +- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager didFailWithError:(NSError * _Nullable)error; + + +/** + * @brief 连续定位回调函数。 + * @param manager 定位 BMKLocationManager 类。 + * @param location 定位结果,参考BMKLocation。 + * @param error 错误信息。 + */ +- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager didUpdateLocation:(BMKLocation * _Nullable)location orError:(NSError * _Nullable)error; + +/** + * @brief 定位权限状态改变时回调函数 + * @param manager 定位 BMKLocationManager 类。 + * @param status 定位权限状态。 + */ +- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status API_DEPRECATED_WITH_REPLACEMENT("-BMKLocationManagerDidChangeAuthorization", ios(4.2, 14.0)); + + +/** + * @brief authorizationStatus或者accuracyAuthorization有变化时回调函数 + * @param manager 定位 BMKLocationManager 类。 + */ +- (void)BMKLocationManagerDidChangeAuthorization:(BMKLocationManager * _Nonnull)manager; + + +/** + * @brief 该方法为BMKLocationManager提示需要设备校正回调方法。 + * @param manager 提供该定位结果的BMKLocationManager类的实例。 + */ +- (BOOL)BMKLocationManagerShouldDisplayHeadingCalibration:(BMKLocationManager * _Nonnull)manager; + +/** + * @brief 该方法为BMKLocationManager提供设备朝向的回调方法。 + * @param manager 提供该定位结果的BMKLocationManager类的实例 + * @param heading 设备的朝向结果 + */ +- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager + didUpdateHeading:(CLHeading * _Nullable)heading; + +/** + * @brief 该方法为BMKLocationManager所在App系统网络状态改变的回调事件。 + * @param manager 提供该定位结果的BMKLocationManager类的实例 + * @param state 当前网络状态 + * @param error 错误信息 + */ +- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager + didUpdateNetworkState:(BMKLocationNetworkState)state orError:(NSError * _Nullable)error; + + +@end + + diff --git a/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationPoi.h b/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationPoi.h new file mode 100644 index 00000000..246316bf --- /dev/null +++ b/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationPoi.h @@ -0,0 +1,42 @@ +// +// BMKLocationPoi.h +// BMKLocationKit +// +// Created by baidu on 2017/3/2. +// Copyright © 2017年 baidu. All rights reserved. +// + + +///描述Poi各属性 +@interface BMKLocationPoi : NSObject + +///BMKLocationPoi的id属性 +@property(nonatomic, copy, readonly) NSString *uid; + +///BMKLocationPoi的名字属性 +@property(nonatomic, copy, readonly) NSString *name; + +///BMKLocationPoi的标签属性 +@property(nonatomic, copy, readonly) NSString *tags; + +///BMKLocationPoi的地址属性 +@property(nonatomic, copy, readonly) NSString *addr; + +///BMKLocationPoi的可信度 +@property(nonatomic, assign, readonly) float relaiability; + + +/** + * @brief 通过NSDictionary初始化方法一 + */ +- (id)initWithDictionary:(NSDictionary *)dictionary; + + +/** + * @brief 通过NSDictionary初始化方法二 + */ +- (id)initWithTwoDictionary:(NSDictionary *)dictionary; + +@end + + diff --git a/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationPoiRegion.h b/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationPoiRegion.h new file mode 100644 index 00000000..f6edaf3c --- /dev/null +++ b/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationPoiRegion.h @@ -0,0 +1,35 @@ +// +// BMKLocationPoiRegion.h +// LocationComponent +// +// Created by Jiang,Fangsheng on 2019/9/4. +// Copyright © 2019 baidu. All rights reserved. +// + +#ifndef BMKLocationPoiRegion_h +#define BMKLocationPoiRegion_h + + +///描述PoiRegion各属性 +@interface BMKLocationPoiRegion : NSObject + +///BMKLocationPoiRegion的方向属性,如『内』、『外』 +@property(nonatomic, copy, readonly) NSString *directionDesc; + +///BMKLocationPoiRegion的名字属性 +@property(nonatomic, copy, readonly) NSString *name; + +///BMKLocationPoiRegion的标签属性 +@property(nonatomic, copy, readonly) NSString *tags; + + + +/** + * @brief 通过NSDictionary初始化方法一 + */ +- (id)initWithDictionary:(NSDictionary *)dictionary; + + +@end + +#endif /* BMKLocationPoiRegion_h */ diff --git a/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationReGeocode.h b/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationReGeocode.h new file mode 100644 index 00000000..2c51c204 --- /dev/null +++ b/ios/Runner/baidu/BMKLocationKit.framework/Headers/BMKLocationReGeocode.h @@ -0,0 +1,67 @@ +// +// BMKLocationReGeocode.h +// BMKLocationKit +// +// Created by baidu on 2017/3/2. +// Copyright © 2017年 baidu. All rights reserved. +// +#import +#import "BMKLocationPoi.h" +#import "BMKLocationPoiRegion.h" + +///BMKLocationReGeocode类。描述跟地址有关的信息. +@interface BMKLocationReGeocode : NSObject + +///国家名字属性 +@property(nonatomic, copy, readonly) NSString *country; + +///国家编码属性 +@property(nonatomic, copy, readonly) NSString *countryCode; + +///省份名字属性 +@property(nonatomic, copy, readonly) NSString *province; + +///城市名字属性 +@property(nonatomic, copy, readonly) NSString *city; + +///区名字属性 +@property(nonatomic, copy, readonly) NSString *district; + +///乡镇名字属性 +@property(nonatomic, copy, readonly) NSString *town; + +///街道名字属性 +@property(nonatomic, copy, readonly) NSString *street; + +///街道号码属性 +@property(nonatomic, copy, readonly) NSString *streetNumber; + +///城市编码属性 +@property(nonatomic, copy, readonly) NSString *cityCode; + +///行政区划编码属性 +@property(nonatomic, copy, readonly) NSString *adCode; + + +///位置语义化结果的定位点在什么地方周围的描述信息 +@property(nonatomic, copy, readonly) NSString *locationDescribe; + + +///位置语义化结果的属性,该定位点周围的poi列表信息 +@property(nonatomic, retain, readonly) NSArray *poiList; + +///位置语义化结果的定位点在什么地方周围的描述信息 +@property(nonatomic, strong, readonly) BMKLocationPoiRegion *poiRegion; + +/** + * @brief 通过NSData初始化方法 + */ +- (id)initWithReGeocodeString:(NSData *)reGeocodeString; + + +/** + * @brief 通过JSON初始化方法 + */ +- (id)initWithJsonString:(NSData *)jsonString withHighAccuracy:(BOOL)highAcc; + +@end diff --git a/ios/Runner/baidu/BMKLocationKit.framework/readme.txt b/ios/Runner/baidu/BMKLocationKit.framework/readme.txt new file mode 100644 index 00000000..d8636363 --- /dev/null +++ b/ios/Runner/baidu/BMKLocationKit.framework/readme.txt @@ -0,0 +1,11 @@ +1、版本: + 百度地图iOS定位SDK v2.0.0 + +2、是否带IDFA: + 无 + +3、是否为Bitcode: + 是 + +4、集成方法: + http://lbsyun.baidu.com/index.php?title=ios-locsdk diff --git a/ios/Runner/baidu/Headers/BMKGeoFenceManager.h b/ios/Runner/baidu/Headers/BMKGeoFenceManager.h new file mode 100644 index 00000000..ef834cd8 --- /dev/null +++ b/ios/Runner/baidu/Headers/BMKGeoFenceManager.h @@ -0,0 +1,141 @@ +// +// BMKGeoFenceManager.h +// BMKLocationKit +// +// Created by baidu on 2017/3/2. +// Copyright © 2017年 baidu. All rights reserved. +// + +#import "BMKGeoFenceRegion.h" + +@protocol BMKGeoFenceManagerDelegate; + +///地理围栏监听状态类型 +typedef NS_OPTIONS(NSUInteger, BMKGeoFenceActiveAction) +{ + BMKGeoFenceActiveActionNone = 0, ///< 不进行监听 + BMKGeoFenceActiveActionInside = 1 << 0, ///< 在范围内 + BMKGeoFenceActiveActionOutside = 1 << 1, ///< 在范围外 + BMKGeoFenceActiveActionStayed = 1 << 2, ///< 停留(在范围内超过10分钟) +}; + +///BMKGeoFence errorDomain +FOUNDATION_EXPORT NSErrorDomain const _Nonnull BMKGeoFenceErrorDomain; + +///地理围栏错误码 +typedef NS_ENUM(NSInteger, BMKGeoFenceErrorCode) { + BMKGeoFenceErrorUnknown = 1, ///< 未知错误 + BMKGeoFenceErrorInvalidParameter = 2, ///< 参数错误 + BMKGeoFenceErrorFailureConnection = 3, ///< 网络连接异常 + BMKGeoFenceErrorFailureAuth = 4, ///< 鉴权失败 + BMKGeoFenceErrorNoValidFence = 5, ///< 无可用围栏 + BMKGeoFenceErroFailureLocating = 6, ///< 定位错误 +}; + + +///地理围栏管理类 +@interface BMKGeoFenceManager : NSObject + + +///实现了 BMKGeoFenceManagerDelegate 协议的类指针。 +@property (nonatomic, weak, nullable) id delegate; + + +///需要进行通知的行为,默认为BMKGeoFenceActiveActionInside。 +@property (nonatomic, assign) BMKGeoFenceActiveAction activeAction; + + +///指定定位是否会被系统自动暂停。默认为NO。 +@property (nonatomic, assign) BOOL pausesLocationUpdatesAutomatically; + + +///是否允许后台定位。默认为NO。只在iOS 9.0及之后起作用。设置为YES的时候必须保证 Background Modes 中的 Location updates 处于选中状态,否则会抛出异常。 +@property (nonatomic, assign) BOOL allowsBackgroundLocationUpdates; + + +/** + * @brief 添加一个圆形围栏 + * @param center 围栏的中心点经纬度坐标 + * @param radius 围栏的半径,单位:米,要求大于0 + * @param type 围栏的坐标系类型 + * @param customID 用户自定义ID,可选,SDK原值返回 + */ +- (void)addCircleRegionForMonitoringWithCenter:(CLLocationCoordinate2D)center radius:(CLLocationDistance)radius coorType:(BMKLocationCoordinateType)type customID:(NSString * _Nullable)customID; + + +/** + * @brief 根据经纬度坐标数据添加一个闭合的多边形围栏,点与点之间按顺序尾部相连, 第一个点与最后一个点相连 + * @param coordinates 经纬度坐标点数据,coordinates对应的内存会拷贝,调用者负责该内存的释放 + * @param count 经纬度坐标点的个数,不可小于3个 + * @param type 围栏的坐标系类型 + * @param customID 用户自定义ID,可选,SDK原值返回 + */ +- (void)addPolygonRegionForMonitoringWithCoordinates:(CLLocationCoordinate2D * _Nonnull)coordinates count:(NSInteger)count coorType:(BMKLocationCoordinateType)type customID:(NSString * _Nullable)customID; + + +/** + * @brief 根据customID获得指定的围栏,如果customID传nil,则返回全部围栏 + * @param customID 用户执行添加围栏函数时传入的customID + * @return 获得的围栏构成的数组,如果没有结果,返回nil + */ +- (NSArray * _Nullable)geoFenceRegionsWithCustomID:(NSString * _Nullable)customID; + + +/** + * @brief 移除指定围栏 + * @param region 要停止监控的围栏 + */ +- (void)removeTheGeoFenceRegion:(BMKGeoFenceRegion * _Nonnull)region; + + +/** + * @brief 移除指定customID的围栏 + * @param customID 用户执行添加围栏函数时传入的customID + */ +- (void)removeGeoFenceRegionsWithCustomID:(NSString * _Nullable)customID; + + +/** + * @brief 移除所有围栏 + */ +- (void)removeAllGeoFenceRegions; + + +@end + + + +///地理围栏代理协议,该协议定义了获取地理围栏相关回调方法,包括添加、状态改变等。 +@protocol BMKGeoFenceManagerDelegate + +@optional + +/** + * @brief 为了适配app store关于新的后台定位的审核机制(app store要求如果开发者只配置了使用期间定位,则代码中不能出现申请后台定位的逻辑),当开发者在plist配置NSLocationAlwaysUsageDescription或者NSLocationAlwaysAndWhenInUseUsageDescription时,需要在该delegate中调用后台定位api:[locationManager requestAlwaysAuthorization]。开发者如果只配置了NSLocationWhenInUseUsageDescription,且只有使用期间的定位需求,则无需在delegate中实现逻辑。 + * @param manager 定位 BMKGeoFenceManager 类。 + * @param locationManager 系统 CLLocationManager 类 。 + * @since 1.7.0 + */ +- (void)BMKGeoFenceManager:(BMKGeoFenceManager * _Nonnull)manager doRequestAlwaysAuthorization:(CLLocationManager * _Nonnull)locationManager; + +/** + * @brief 添加地理围栏完成后的回调,成功与失败都会调用 + * @param manager 地理围栏管理类 + * @param regions 成功添加的一个或多个地理围栏构成的数组 + * @param customID 用户执行添加围栏函数时传入的customID + * @param error 添加失败的错误信息 + */ +- (void)BMKGeoFenceManager:(BMKGeoFenceManager * _Nonnull)manager didAddRegionForMonitoringFinished:(NSArray * _Nullable)regions customID:(NSString * _Nullable)customID error:(NSError * _Nullable)error; + + +/** + * @brief 地理围栏状态改变时回调,当围栏状态的值发生改变,定位失败都会调用 + * @param manager 地理围栏管理类 + * @param region 状态改变的地理围栏 + * @param customID 用户执行添加围栏函数时传入的customID + * @param error 错误信息,如定位相关的错误 + */ +- (void)BMKGeoFenceManager:(BMKGeoFenceManager * _Nonnull)manager didGeoFencesStatusChangedForRegion:(BMKGeoFenceRegion * _Nullable)region customID:(NSString * _Nullable)customID error:(NSError * _Nullable)error; + +@end + diff --git a/ios/Runner/baidu/Headers/BMKGeoFenceRegion.h b/ios/Runner/baidu/Headers/BMKGeoFenceRegion.h new file mode 100644 index 00000000..119358f5 --- /dev/null +++ b/ios/Runner/baidu/Headers/BMKGeoFenceRegion.h @@ -0,0 +1,114 @@ +// +// BMKGeoFenceRegion.h +// BMKLocationKit +// +// Created by baidu on 2017/3/2. +// Copyright © 2017年 baidu. All rights reserved. +// + +#import +#import +#import "BMKLocationManager.h" + +///BMKGeoFence Region State +typedef NS_ENUM(NSInteger, BMKGeoFenceRegionStatus) +{ + BMKGeoFenceRegionStatusUnknown = 0, ///< 未知 + BMKGeoFenceRegionStatusInside = 1, ///< 在范围内 + BMKGeoFenceRegionStatusOutside = 1 << 1, ///< 在范围外 + BMKGeoFenceRegionStatusStayed = 1 << 2, ///< 停留(在范围内超过10分钟) +}; + +#pragma mark - BMKGeoFenceRegion + + +///地理围栏基类,不可直接使用 +@interface BMKGeoFenceRegion : NSObject + + +///BMKGeoFenceRegion的唯一标识符 +@property (nonatomic, copy, readonly) NSString *identifier; + + +///用户自定义ID,可为nil。 +@property (nonatomic, copy, readonly) NSString *customID; + + +///坐标点和围栏的关系,比如用户的位置和围栏的关系 +@property (nonatomic, assign) BMKGeoFenceRegionStatus fenceStatus; + +///设定围栏坐标系类型。默认为 BMKLocationCoordinateTypeGCJ02。 +@property(nonatomic, readonly) BMKLocationCoordinateType coordinateType; + +///上次发生状态变化的时间 +@property(nonatomic, assign)NSTimeInterval lastEventTime; + + +/** + * @brief 判断位置与围栏状态 + * @param CLLocationCoordinate2D 坐标值 + * @return 返回BMKGeoFenceRegionStatus状态 + */ +-(BMKGeoFenceRegionStatus)judgeStatusWithCoor:(CLLocationCoordinate2D)coor; + +@end + + +#pragma mark - BMKLocationCircleRegion + + +///圆形地理围栏 +@interface BMKGeoFenceCircleRegion : BMKGeoFenceRegion + + +///中心点的经纬度坐标 +@property (nonatomic, readonly) CLLocationCoordinate2D center; + + +///半径,单位:米 +@property (nonatomic, readonly) CLLocationDistance radius; + +/** + * @brief 构造圆形围栏 + * @param customid 用户自定义ID + * @param identityid 识别id + * @param center 中心坐标 + * @param radius 围栏半径 + * @param type 坐标系类型 + * @return BMKGeoFenceCircleRegion id + */ +- (id)initWithCustomID:(NSString *)customid identityID:(NSString *)identityid center:(CLLocationCoordinate2D)center radius:(CLLocationDistance)radius coor:(BMKLocationCoordinateType)type; + + + +@end + + +#pragma mark -BMKGeoFencePolygonRegion + + +///多边形地理围栏 +@interface BMKGeoFencePolygonRegion : BMKGeoFenceRegion + + +///经纬度坐标点数据 +@property (nonatomic, readonly) CLLocationCoordinate2D *coordinates; + + +///经纬度坐标点的个数 +@property (nonatomic, readonly) NSInteger count; + + +/** + * @brief 构造多边形围栏 + * @param customid 用户自定义ID + * @param identityid 识别id + * @param coor 多边形顶点 + * @param count 顶点个数 + * @param type 坐标系类型 + * @return BMKGeoFencePolygonRegion id + */ +- (id)initWithCustomID:(NSString *)customid identityID:(NSString *)identityid coor:(CLLocationCoordinate2D *)coor count:(NSInteger)count coor:(BMKLocationCoordinateType)type; + +@end + diff --git a/ios/Runner/baidu/Headers/BMKLocation.h b/ios/Runner/baidu/Headers/BMKLocation.h new file mode 100644 index 00000000..eae633c2 --- /dev/null +++ b/ios/Runner/baidu/Headers/BMKLocation.h @@ -0,0 +1,97 @@ +// +// BMKLocation.h +// LocationComponent +// +// Created by baidu on 2017/8/16. +// Copyright © 2017年 baidu. All rights reserved. +// + +#ifndef BMKLocation_h +#define BMKLocation_h + +#import +#import "BMKLocationReGeocode.h" + +/** + * BMKLocationProvider 位置数据来源,分iOS系统定位和其他定位服务结果两种,目前仅支持iOS系统定位服务 + * + */ +typedef NS_ENUM(int, BMKLocationProvider) { + + BMKLocationProviderIOS = 0, //!<位置来源于iOS本身定位 + BMKLocationProviderOther //!<位置来源于其他定位服务 + +}; + +///描述百度iOS 定位数据 +@interface BMKLocation : NSObject + +///BMKLocation 位置数据 +@property(nonatomic, copy, readonly) CLLocation * _Nullable location; + +///BMKLocation 地址数据 +@property(nonatomic, copy) BMKLocationReGeocode * _Nullable rgcData; + +///BMKLocation 位置来源 +@property(nonatomic, assign) BMKLocationProvider provider; + +///BMKLocation 位置ID +@property(nonatomic, retain) NSString * _Nullable locationID; + +/* + * floorString + * + * Discussion: + * 室内定位成功时返回的楼层信息,ex:f1 + */ +@property(readonly, nonatomic, copy, nullable) NSString *floorString; + +/* + * buildingID + * + * Discussion: + * 室内定位成功时返回的百度建筑物ID + */ +@property(readonly, nonatomic, copy, nullable) NSString *buildingID; + +/* + * buildingName + * + * Discussion: + * 室内定位成功时返回的百度建筑物名称 + */ +@property(readonly, nonatomic, copy, nullable) NSString *buildingName; + + +/* + * extraInfo + * + * Discussion: + * 定位附加信息,如停车位code识别结果、停车位code示例、vdr推算结果置信度等 + */ +@property(readonly, nonatomic, copy, nullable) NSDictionary * extraInfo; + +/** + * @brief 初始化BMKLocation实例 + * @param loc CLLocation对象 + * @param rgc BMKLocationReGeocode对象 + * @return BMKLocation id + */ +- (id _Nonnull)initWithLocation:(CLLocation * _Nullable)loc withRgcData:(BMKLocationReGeocode * _Nullable)rgc; + +/** + * @brief 构造BMKLocation + * @param location CLLocation + * @param floorString 楼层字符串 + * @param buildingID 建筑物ID + * @param buildingName 建筑物名称 + * @param info 位置附加信息 + * @return BMKLocation id + */ +-(id _Nonnull)initWithLocation:(CLLocation * _Nullable)location floorString:(NSString * _Nullable)floorString buildingID:(NSString * _Nullable)buildingID + buildingName:(NSString * _Nullable)buildingName extraInfo:(NSDictionary * _Nullable)info withRgcData:(BMKLocationReGeocode * _Nullable)rgc; + + +@end + +#endif /* BMKLocation_h */ diff --git a/ios/Runner/baidu/Headers/BMKLocationAuth.h b/ios/Runner/baidu/Headers/BMKLocationAuth.h new file mode 100644 index 00000000..90494645 --- /dev/null +++ b/ios/Runner/baidu/Headers/BMKLocationAuth.h @@ -0,0 +1,56 @@ +// +// BMKLocationAuth.h +// LocationComponent +// +// Created by baidu on 2017/4/10. +// Copyright © 2017年 baidu. All rights reserved. +// + +#ifndef BMKLocationAuth_h +#define BMKLocationAuth_h + +///定位鉴权错误码 +typedef NS_ENUM(NSInteger, BMKLocationAuthErrorCode) { + BMKLocationAuthErrorUnknown = -1, ///< 未知错误 + BMKLocationAuthErrorSuccess = 0, ///< 鉴权成功 + BMKLocationAuthErrorNetworkFailed = 1, ///< 因网络鉴权失败 + BMKLocationAuthErrorFailed = 2, ///< KEY非法鉴权失败 + +}; +///通知Delegate +@protocol BMKLocationAuthDelegate +@optional + +/** + *@brief 返回授权验证错误 + *@param iError 错误号 : 为0时验证通过,具体参加BMKLocationAuthErrorCode + */ +- (void)onCheckPermissionState:(BMKLocationAuthErrorCode)iError; +@end + + +///BMKLocationAuth类。用于鉴权 +@interface BMKLocationAuth : NSObject + +///鉴权状态0:成功; 1:网络错误; 2:授权失败 +@property(nonatomic, readonly, assign) BMKLocationAuthErrorCode permisionState; + +/** + * @brief 得到BMKLocationAuth的单例 + */ ++ (BMKLocationAuth*)sharedInstance; + + +/** + *@brief 启动引擎 + *@param key 申请的有效key + *@param delegate 回调是否鉴权成功 + */ +-(void)checkPermisionWithKey:(NSString*)key authDelegate:(id)delegate; + + +@end + + + +#endif /* BMKLocationAuth_h */ diff --git a/ios/Runner/baidu/Headers/BMKLocationComponent.h b/ios/Runner/baidu/Headers/BMKLocationComponent.h new file mode 100644 index 00000000..0b6310fe --- /dev/null +++ b/ios/Runner/baidu/Headers/BMKLocationComponent.h @@ -0,0 +1,16 @@ +// +// BMKLocationComponent.h +// LocationComponent +// +// Created by Baidu on 3/31/14. +// Copyright (c) 2014 baidu. All rights reserved. +// + +#import "BMKLocationManager.h" +#import "BMKLocationKitVersion.h" +#import "BMKLocationPoi.h" +#import "BMKLocation.h" +#import "BMKGeoFenceRegion.h" +#import "BMKGeoFenceManager.h" +#import "BMKLocationReGeocode.h" +#import "BMKLocationAuth.h" diff --git a/ios/Runner/baidu/Headers/BMKLocationKitVersion.h b/ios/Runner/baidu/Headers/BMKLocationKitVersion.h new file mode 100644 index 00000000..0426c5e4 --- /dev/null +++ b/ios/Runner/baidu/Headers/BMKLocationKitVersion.h @@ -0,0 +1,30 @@ +// +// BMKLocationKitVersion.h +// BMKLocationKit +// +// Created by baidu on 17/9/9. +// Copyright © 2017年 baidu. All rights reserved. +// + +#ifndef BMKLocationKitVersion_h +#define BMKLocationKitVersion_h + +#import + +/** + *获取当前定位sdk 的版本号 + *当前定位sdk版本 : 2.0.0 + *@return 返回当前定位sdk 的版本号 + */ +UIKIT_EXTERN NSString* BMKLocationKitVersion(); + +/** + *获取当前定位sdk 的float版本号 + *当前定位sdk版本 : 2.0 + *@return 返回当前定位sdk 的float版本号 + */ +UIKIT_EXTERN float BMKLocationKitFloatVersion(); + + + +#endif /* BMKLocationKitVersion_h */ diff --git a/ios/Runner/baidu/Headers/BMKLocationManager.h b/ios/Runner/baidu/Headers/BMKLocationManager.h new file mode 100644 index 00000000..d6e3ab8a --- /dev/null +++ b/ios/Runner/baidu/Headers/BMKLocationManager.h @@ -0,0 +1,296 @@ +// +// BMKLocationManager.h +// BMKLocationKit +// +// Created by baidu on 2017/3/2. +// Copyright © 2017年 baidu. All rights reserved. +// + +#import +#import +#import +#import "BMKLocationReGeocode.h" +#import "BMKLocation.h" + +/** BMKLocationCoordinateType 枚举坐标系类型 + * + */ +typedef NS_ENUM(NSUInteger, BMKLocationCoordinateType) +{ + BMKLocationCoordinateTypeBMK09LL = 0, /// delegate; + +///设定定位的最小更新距离。默认为 kCLDistanceFilterNone。 +@property(nonatomic, assign) CLLocationDistance distanceFilter; + +///设定定位精度。默认为 kCLLocationAccuracyBest。 +@property(nonatomic, assign) CLLocationAccuracy desiredAccuracy; + +///设定定位类型。默认为 CLActivityTypeAutomotiveNavigation。 +@property(nonatomic, assign) CLActivityType activityType; + +///设定定位坐标系类型。默认为 BMKLocationCoordinateTypeGCJ02。 +@property(nonatomic, assign) BMKLocationCoordinateType coordinateType; + +///指定定位是否会被系统自动暂停。默认为NO。 +@property(nonatomic, assign) BOOL pausesLocationUpdatesAutomatically; + + +///是否允许后台定位。默认为NO。只在iOS 9.0及之后起作用。设置为YES的时候必须保证 Background Modes 中的 Location updates 处于选中状态,否则会抛出异常。由于iOS系统限制,需要在定位未开始之前或定位停止之后,修改该属性的值才会有效果。 +@property(nonatomic, assign) BOOL allowsBackgroundLocationUpdates; + +///指定单次定位超时时间,默认为10s。最小值是2s。注意单次定位请求前设置。注意: 单次定位超时时间从确定了定位权限(非kCLAuthorizationStatusNotDetermined状态)后开始计算。 +@property(nonatomic, assign) NSInteger locationTimeout; + +///指定单次定位逆地理超时时间,默认为10s。最小值是2s。注意单次定位请求前设置。 +@property(nonatomic, assign) NSInteger reGeocodeTimeout; + +///连续定位是否返回逆地理信息,默认YES。 +@property (nonatomic, assign) BOOL locatingWithReGeocode; + +///定位sdk-v1.3之后,开发者可以选择是否需要最新版本rgc数据,1.9之后默认是需要YES;YES的情况下,定位sdk会实时返回最新的rgc数据,如城市变更等数据都会实时更新 +@property (nonatomic, assign) BOOL isNeedNewVersionReGeocode; + + +///开发者可以指定该用户的id,用于后续统一识别用户,便于查找问题 +@property(nonatomic, copy, nullable) NSString * userID; + +///返回定位精度等级,IOS14之后用户可以直接控制返回定位的精度等级,开发者可以通过这个值适配不同定位等级下的产品逻辑 +@property (nonatomic, readonly) BMKLAccuracyAuthorization accuracyAuthorization; + + +/** + * @brief 单次定位。如果当前正在连续定位,调用此方法将会失败,返回NO。\n该方法将会根据设定的 desiredAccuracy 去获取定位信息。如果获取的定位信息精确度低于 desiredAccuracy ,将会持续的等待定位信息,直到超时后通过completionBlock返回精度最高的定位信息。\n可以通过 stopUpdatingLocation 方法去取消正在进行的单次定位请求。 + * @param withReGeocode 是否带有逆地理信息(获取逆地理信息需要联网) + * @param withNetWorkState 是否带有移动热点识别状态(需要联网) + * @param completionBlock 单次定位完成后的Block + * @return 是否成功添加单次定位Request + */ +- (BOOL)requestLocationWithReGeocode:(BOOL)withReGeocode withNetworkState:(BOOL)withNetWorkState completionBlock:(BMKLocatingCompletionBlock _Nonnull)completionBlock; + +/** + * @brief 开始连续定位。调用此方法会cancel掉所有的单次定位请求。 + */ +- (void)startUpdatingLocation; + +/** + * @brief 停止连续定位。调用此方法会cancel掉所有的单次定位请求,可以用来取消单次定位。 + */ +- (void)stopUpdatingLocation; + +/** + * @brief 请求网络状态结果回调。 + */ +- (void)requestNetworkState; + + +/** + * @brief 该方法返回设备是否支持设备朝向事件回调。 + * @return 是否支持设备朝向事件回调 + */ ++ (BOOL)headingAvailable; + +/** + * @brief 该方法为BMKLocationManager开始设备朝向事件回调。 + */ +- (void)startUpdatingHeading; + +/** + * @brief 该方法为BMKLocationManager停止设备朝向事件回调。 + */ +- (void)stopUpdatingHeading; + +/** + * @brief 该方法为BMKLocationManager尝试使用高精度室内定位。在特定的室内场景下会有更高精度的定位回调,只在室内定位版本生效。 + */ +- (void)tryIndoorLocation; + +/** + * @brief 该方法为BMKLocationManager会关闭高精度室内定位,只在室内定位版本生效。 + */ +- (void)stopIndoorLocation; + + +/** + * @brief 转换为百度经纬度的坐标 + * @param coordinate 待转换的经纬度 + * @param srctype 待转换坐标系类型 + * @param destype 目标百度坐标系类型(bd09ll,bd09mc) + * @return 目标百度坐标系经纬度 + */ ++ (CLLocationCoordinate2D) BMKLocationCoordinateConvert:(CLLocationCoordinate2D) coordinate SrcType:(BMKLocationCoordinateType)srctype DesType:(BMKLocationCoordinateType)destype; + +/** + * @brief 判断目标经纬度是否在大陆以及港、澳地区。 + * @param coordinate 待判断的目标经纬度 + * @param coortype 待判断经纬度的坐标系类型 + * @return 是否在大陆以及港、澳地区 + */ ++ (BOOL) BMKLocationDataAvailableForCoordinate:(CLLocationCoordinate2D)coordinate withCoorType:(BMKLocationCoordinateType)coortype; + + + +/** + * @brief 返回当前定位权限 + * @return CLAuthorizationStatus 定位权限枚举类型 + */ +- (CLAuthorizationStatus)authorizationStatus; + + +/** + * @brief 如果你没有全量定位等级精度权限,利用该接口可以临时请求一次全量定位精度等级,系统会抛出弹框让用户确认是否授权app授予相应权限 + * @param purposeKey info.plist中NSLocationTemporaryUsageDescriptionDictionary定义的key,对应相应的value可以详细描述申请全量定位精度等级的原因 + * @param completion 回调是否 + * @return + */ +- (void)requestTemporaryFullAccuracyAuthorizationWithPurposeKey:(NSString * _Nonnull)purposeKey completion:(void(^ _Nullable)(NSError * _Nullable))completion API_AVAILABLE(ios(14.0)); + +/** + * @brief 请求一次全量定位精度等级 + * @param purposeKey info.plist中NSLocationTemporaryUsageDescriptionDictionary定义的key + * @return + */ +- (void)requestTemporaryFullAccuracyAuthorizationWithPurposeKey:(NSString * _Nonnull)purposeKey API_AVAILABLE(ios(14.0)); + + +@end + +#pragma mark - BMKLocationManagerDelegate + + +///BMKLocationManagerDelegate 协议定义了发生错误时的错误回调方法,连续定位的回调方法等。 +@protocol BMKLocationManagerDelegate + +@optional + +/** + * @brief 为了适配app store关于新的后台定位的审核机制(app store要求如果开发者只配置了使用期间定位,则代码中不能出现申请后台定位的逻辑),当开发者在plist配置NSLocationAlwaysUsageDescription或者NSLocationAlwaysAndWhenInUseUsageDescription时,需要在该delegate中调用后台定位api:[locationManager requestAlwaysAuthorization]。开发者如果只配置了NSLocationWhenInUseUsageDescription,且只有使用期间的定位需求,则无需在delegate中实现逻辑。 + * @param manager 定位 BMKLocationManager 类。 + * @param locationManager 系统 CLLocationManager 类 。 + * @since 1.6.0 + */ +- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager doRequestAlwaysAuthorization:(CLLocationManager * _Nonnull)locationManager; + +/** + * @brief 当定位发生错误时,会调用代理的此方法。 + * @param manager 定位 BMKLocationManager 类。 + * @param error 返回的错误,参考 CLError 。 + */ +- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager didFailWithError:(NSError * _Nullable)error; + + +/** + * @brief 连续定位回调函数。 + * @param manager 定位 BMKLocationManager 类。 + * @param location 定位结果,参考BMKLocation。 + * @param error 错误信息。 + */ +- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager didUpdateLocation:(BMKLocation * _Nullable)location orError:(NSError * _Nullable)error; + +/** + * @brief 定位权限状态改变时回调函数 + * @param manager 定位 BMKLocationManager 类。 + * @param status 定位权限状态。 + */ +- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status API_DEPRECATED_WITH_REPLACEMENT("-BMKLocationManagerDidChangeAuthorization", ios(4.2, 14.0)); + + +/** + * @brief authorizationStatus或者accuracyAuthorization有变化时回调函数 + * @param manager 定位 BMKLocationManager 类。 + */ +- (void)BMKLocationManagerDidChangeAuthorization:(BMKLocationManager * _Nonnull)manager; + + +/** + * @brief 该方法为BMKLocationManager提示需要设备校正回调方法。 + * @param manager 提供该定位结果的BMKLocationManager类的实例。 + */ +- (BOOL)BMKLocationManagerShouldDisplayHeadingCalibration:(BMKLocationManager * _Nonnull)manager; + +/** + * @brief 该方法为BMKLocationManager提供设备朝向的回调方法。 + * @param manager 提供该定位结果的BMKLocationManager类的实例 + * @param heading 设备的朝向结果 + */ +- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager + didUpdateHeading:(CLHeading * _Nullable)heading; + +/** + * @brief 该方法为BMKLocationManager所在App系统网络状态改变的回调事件。 + * @param manager 提供该定位结果的BMKLocationManager类的实例 + * @param state 当前网络状态 + * @param error 错误信息 + */ +- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager + didUpdateNetworkState:(BMKLocationNetworkState)state orError:(NSError * _Nullable)error; + + +@end + + diff --git a/ios/Runner/baidu/Headers/BMKLocationPoi.h b/ios/Runner/baidu/Headers/BMKLocationPoi.h new file mode 100644 index 00000000..246316bf --- /dev/null +++ b/ios/Runner/baidu/Headers/BMKLocationPoi.h @@ -0,0 +1,42 @@ +// +// BMKLocationPoi.h +// BMKLocationKit +// +// Created by baidu on 2017/3/2. +// Copyright © 2017年 baidu. All rights reserved. +// + + +///描述Poi各属性 +@interface BMKLocationPoi : NSObject + +///BMKLocationPoi的id属性 +@property(nonatomic, copy, readonly) NSString *uid; + +///BMKLocationPoi的名字属性 +@property(nonatomic, copy, readonly) NSString *name; + +///BMKLocationPoi的标签属性 +@property(nonatomic, copy, readonly) NSString *tags; + +///BMKLocationPoi的地址属性 +@property(nonatomic, copy, readonly) NSString *addr; + +///BMKLocationPoi的可信度 +@property(nonatomic, assign, readonly) float relaiability; + + +/** + * @brief 通过NSDictionary初始化方法一 + */ +- (id)initWithDictionary:(NSDictionary *)dictionary; + + +/** + * @brief 通过NSDictionary初始化方法二 + */ +- (id)initWithTwoDictionary:(NSDictionary *)dictionary; + +@end + + diff --git a/ios/Runner/baidu/Headers/BMKLocationPoiRegion.h b/ios/Runner/baidu/Headers/BMKLocationPoiRegion.h new file mode 100644 index 00000000..f6edaf3c --- /dev/null +++ b/ios/Runner/baidu/Headers/BMKLocationPoiRegion.h @@ -0,0 +1,35 @@ +// +// BMKLocationPoiRegion.h +// LocationComponent +// +// Created by Jiang,Fangsheng on 2019/9/4. +// Copyright © 2019 baidu. All rights reserved. +// + +#ifndef BMKLocationPoiRegion_h +#define BMKLocationPoiRegion_h + + +///描述PoiRegion各属性 +@interface BMKLocationPoiRegion : NSObject + +///BMKLocationPoiRegion的方向属性,如『内』、『外』 +@property(nonatomic, copy, readonly) NSString *directionDesc; + +///BMKLocationPoiRegion的名字属性 +@property(nonatomic, copy, readonly) NSString *name; + +///BMKLocationPoiRegion的标签属性 +@property(nonatomic, copy, readonly) NSString *tags; + + + +/** + * @brief 通过NSDictionary初始化方法一 + */ +- (id)initWithDictionary:(NSDictionary *)dictionary; + + +@end + +#endif /* BMKLocationPoiRegion_h */ diff --git a/ios/Runner/baidu/Headers/BMKLocationReGeocode.h b/ios/Runner/baidu/Headers/BMKLocationReGeocode.h new file mode 100644 index 00000000..2c51c204 --- /dev/null +++ b/ios/Runner/baidu/Headers/BMKLocationReGeocode.h @@ -0,0 +1,67 @@ +// +// BMKLocationReGeocode.h +// BMKLocationKit +// +// Created by baidu on 2017/3/2. +// Copyright © 2017年 baidu. All rights reserved. +// +#import +#import "BMKLocationPoi.h" +#import "BMKLocationPoiRegion.h" + +///BMKLocationReGeocode类。描述跟地址有关的信息. +@interface BMKLocationReGeocode : NSObject + +///国家名字属性 +@property(nonatomic, copy, readonly) NSString *country; + +///国家编码属性 +@property(nonatomic, copy, readonly) NSString *countryCode; + +///省份名字属性 +@property(nonatomic, copy, readonly) NSString *province; + +///城市名字属性 +@property(nonatomic, copy, readonly) NSString *city; + +///区名字属性 +@property(nonatomic, copy, readonly) NSString *district; + +///乡镇名字属性 +@property(nonatomic, copy, readonly) NSString *town; + +///街道名字属性 +@property(nonatomic, copy, readonly) NSString *street; + +///街道号码属性 +@property(nonatomic, copy, readonly) NSString *streetNumber; + +///城市编码属性 +@property(nonatomic, copy, readonly) NSString *cityCode; + +///行政区划编码属性 +@property(nonatomic, copy, readonly) NSString *adCode; + + +///位置语义化结果的定位点在什么地方周围的描述信息 +@property(nonatomic, copy, readonly) NSString *locationDescribe; + + +///位置语义化结果的属性,该定位点周围的poi列表信息 +@property(nonatomic, retain, readonly) NSArray *poiList; + +///位置语义化结果的定位点在什么地方周围的描述信息 +@property(nonatomic, strong, readonly) BMKLocationPoiRegion *poiRegion; + +/** + * @brief 通过NSData初始化方法 + */ +- (id)initWithReGeocodeString:(NSData *)reGeocodeString; + + +/** + * @brief 通过JSON初始化方法 + */ +- (id)initWithJsonString:(NSData *)jsonString withHighAccuracy:(BOOL)highAcc; + +@end diff --git a/lib/address/address_map_page.dart b/lib/address/address_map_page.dart index 3076b362..c59d8a94 100644 --- a/lib/address/address_map_page.dart +++ b/lib/address/address_map_page.dart @@ -1,16 +1,20 @@ import 'dart:convert'; +import 'dart:io'; -import 'package:amap_flutter_location/amap_flutter_location.dart'; -import 'package:amap_flutter_base/amap_flutter_base.dart'; -import 'package:amap_flutter_location/amap_location_option.dart'; -import 'package:amap_flutter_map/amap_flutter_map.dart'; +import 'package:android_intent_plus/android_intent.dart'; import 'package:dio/dio.dart'; -import 'package:flutter/foundation.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; +import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; +import 'package:flutter_bmflocation/bdmap_location_flutter_plugin.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/address.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/view_widget/request_permission.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -23,28 +27,15 @@ class AddressMapPage extends StatefulWidget { } class _AddressMapPage extends State { -//默认设置为不使用自定义地图,如果需要直接显示,在初始化是设置为true - CustomStyleOptions _customStyleOptions = CustomStyleOptions(false); //加载自定义地图样式 void _loadCustomData() async { - if (null == _customStyleOptions) { - _customStyleOptions = CustomStyleOptions(false); - } - ByteData styleByteData = - await rootBundle.load('assets/map_style/style.data'); - _customStyleOptions.styleData = styleByteData.buffer.asUint8List(); - ByteData styleExtraByteData = - await rootBundle.load('assets/map_style/style_extra.data'); - _customStyleOptions.styleExtraData = - styleExtraByteData.buffer.asUint8List(); - //如果需要加载完成后直接展示自定义地图,可以通过setState修改CustomStyleOptions的enable为true setState(() { - _customStyleOptions.enabled = true; + _mapController.setCustomMapStyle('assets/map_style/chatian.sty', 0); }); } - AMapFlutterLocation aMapFlutterLocation; + LocationFlutterPlugin aMapFlutterLocation; String city = "武汉市"; String keyWord = ""; @@ -52,7 +43,6 @@ class _AddressMapPage extends State { void dispose() { super.dispose(); aMapFlutterLocation.stopLocation(); - aMapFlutterLocation.destroy(); } ApiService apiService; @@ -67,44 +57,53 @@ class _AddressMapPage extends State { }); if (aMapFlutterLocation == null) { - AMapFlutterLocation.setApiKey("f39d1daa020a56f208eb2519f63e9534", - "feaae7986201b571cace1b83728be5bb"); - aMapFlutterLocation = AMapFlutterLocation(); - aMapFlutterLocation.onLocationChanged().listen((event) { + + aMapFlutterLocation = LocationFlutterPlugin(); + aMapFlutterLocation.onResultCallback().listen((event) { print("event: ${jsonEncode(event)}"); if (event != null && event["latitude"] != null && event["longitude"] != null) { city = event["city"]; - LatLng latLng; + BMFCoordinate latLng; if (event["latitude"] is String && event["longitude"] is String) { - latLng = LatLng(double.tryParse(event["latitude"]), + latLng = BMFCoordinate(double.tryParse(event["latitude"]), double.tryParse(event["longitude"])); } else { - latLng = LatLng(event["latitude"], event["longitude"]); + latLng = BMFCoordinate(event["latitude"], event["longitude"]); } saveLatLng(latLng); if (_mapController != null) - _mapController.moveCamera( - CameraUpdate.newCameraPosition( - CameraPosition( - target: latLng, - zoom: 15.0, - ), + _mapController.updateMapOptions( + BMFMapOptions( + center: latLng, + zoomLevel: 15, ), ); searchPoi(latLng); } }); } - aMapFlutterLocation.setLocationOption( - AMapLocationOption( - needAddress: true, - onceLocation: true, - locationMode: AMapLocationMode.Hight_Accuracy, - pausesLocationUpdatesAutomatically: true, - ), - ); + + aMapFlutterLocation.prepareLoc({ + "coorType": "bd09ll", + "isNeedAddres": false, + "isNeedAltitude": false, + "isNeedLocationPoiList": false, + "isNeedLocationDescribe": false, + "isNeedNewVersionRgc": false, + "scanspan": 0, + "openGps": true, + "locationMode": 2, + }, { + "locationMode": "kCLLocationAccuracyBest", + "locationTimeout": 10, + "reGeocodeTimeout": 10, + "activityType": "CLActivityTypeAutomotiveNavigation", + "BMKLocationCoordinateType": "BMKLocationCoordinateTypeBMK09LL", + "BMKLocationCoordinateType": "BMKLocationCoordinateTypeBMK09LL", + "isNeedNewVersionRgc": false, + }); _loadCustomData(); @@ -114,7 +113,7 @@ class _AddressMapPage extends State { List
poiList; - searchPoi(LatLng latLng) async { + searchPoi(BMFCoordinate latLng) async { keyWord = textEditingController.text; var addressPoi = await apiService.searchPoi( "${latLng.latitude}", "${latLng.longitude}", keyWord, 20, 1); @@ -139,45 +138,87 @@ class _AddressMapPage extends State { setState(() {}); } -//{"parent":[],"distance":"7","pcode":"420000","importance":[], -// "recommend":"0","type":"商务住宅;住宅区;住宅区","photos":[],"discount_num":"0","gridcode":"4514626711", -// "typecode":"120300","shopinfo":"0","poiweight":[],"citycode":"027","adname":"武昌区","children":[], -// "alias":[],"tel":[],"id":"B0G2YMOFHL","tag":[],"event":[],"entr_location":[],"indoor_map":"0", -// "email":[],"timestamp":"2021-06-02 00:19:39","website":[],"address":"中北路86号","adcode":"420106", -// "pname":"湖北省","biz_type":[],"cityname":"武汉市","postcode":[],"match":"0","business_area":"中北路", -// "indoor_data":,"childtype":[],"exit_location":[], -// "name":"万象春天","location":"114.343968,30.554595","shopid":[],"navi_poiid":[],"groupbuy_num":"0"} startLocation() async { - // await AmapCore.init('feaae7986201b571cace1b83728be5bb'); - if (await Permission.locationWhenInUse.serviceStatus.isEnabled) { - // bool isShown = await Permission.contacts.shouldShowRequestRationale; - // if (isShown) { - // SmartDialog.showToast("shouldShowRequest"); - // } - if (await Permission.location.isPermanentlyDenied) { - //openAppSettings - } else if (await Permission.location.isGranted) { - aMapFlutterLocation.startLocation(); + if (!(await Permission.locationWhenInUse.serviceStatus.isEnabled)) { + enableLocation(); + return; + } + + if (await Permission.location.isPermanentlyDenied) { + requestDialog(); + } else if (await Permission.location.isGranted) { + SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai); + aMapFlutterLocation.startLocation(); + Future.delayed(Duration(seconds: 6), () { + SmartDialog.dismiss(); + }); + } else if (await Permission.location.isUndetermined) { + await Permission.location.request(); + } else { + if (Platform.isIOS) { + //去设置中心 + requestDialog(); } else { await Permission.location.request(); - startLocation(); } - } else { - //enabledLocation - // _mapController.getMapContentApprovalNumber() - // _mapController } } - AMapController _mapController; + enableLocation() { + showCupertinoDialog( + context: context, + builder: (context) { + return RequestPermission( + "assets/image/icon_permission_location_bg.png", + S.of(context).nindingweigongnengweikaiqi, + S.of(context).weilexiangnintuijianfujindemendianxinxi, + S.of(context).dakaidingwei, + (result) async { + if (result) { + final AndroidIntent intent = AndroidIntent( + action: 'action_location_source_settings', + package: "com.zsw.huixiang"); + await intent.launch(); + // startLocation(); + } + }, + heightRatioWithWidth: 0.82, + ); + }, + ); + } - void onMapCreated(AMapController controller) { + requestDialog() { + showCupertinoDialog( + context: context, + builder: (context) { + return RequestPermission( + "assets/image/icon_permission_location_bg.png", + S.of(context).nindingweiquanxianweiyunxu, + S.of(context).weilexiangnintuijianfujindemendianxinxi, + S.of(context).kaiqiquanxian, + (result) async { + if (result) { + await openAppSettings(); + if (await Permission.location.isGranted) { + startLocation(); + } + } + }, + heightRatioWithWidth: 0.82, + ); + }); + } + + BMFMapController _mapController; + + void onMapCreated(BMFMapController controller) { setState(() { _mapController = controller; }); } - saveLatLng(LatLng latLng) async { + saveLatLng(BMFCoordinate latLng) async { SharedPreferences prefs = await SharedPreferences.getInstance(); await prefs.setString("latitude", "${latLng.latitude}"); await prefs.setString("longitude", "${latLng.longitude}"); @@ -187,25 +228,24 @@ class _AddressMapPage extends State { SharedPreferences.getInstance().then((value) => { setState(() { if (_mapController != null) { - _mapController - .moveCamera(CameraUpdate.newCameraPosition(CameraPosition( - target: LatLng(double.tryParse(value.getString("latitude")), - double.tryParse(value.getString("longitude"))), - zoom: 15.0, - ))); + _mapController.updateMapOptions( + BMFMapOptions( + center: BMFCoordinate( + double.tryParse(value.getString("latitude")), + double.tryParse(value.getString("longitude"))), + zoomLevel: 15, + ), + ); } }) }); } - AMapWidget map; - LatLng center = LatLng(30.553111, 114.342366); + BMFMapWidget map; + BMFCoordinate center = BMFCoordinate(30.553111, 114.342366); @override Widget build(BuildContext context) { - AMapApiKey aMapApiKeys = AMapApiKey( - androidKey: 'f39d1daa020a56f208eb2519f63e9534', - iosKey: 'feaae7986201b571cace1b83728be5bb'); return Scaffold( body: Column( children: [ @@ -213,29 +253,28 @@ class _AddressMapPage extends State { child: Stack( children: [ Container( - child: AMapWidget( - initialCameraPosition: CameraPosition( - target: LatLng(30.553111, 114.342366), - zoom: 12.0, + child: BMFMapWidget( + mapOptions: BMFMapOptions( + center: BMFCoordinate(30.553111, 114.342366), + zoomLevel: 12, ), - onMapCreated: onMapCreated, - onCameraMoveEnd: (cameraPosition) { - center = cameraPosition.target; - searchPoi(center); - }, - onCameraMove: (cameraPosition) { - center = cameraPosition.target; - setState(() {}); - }, - apiKey: aMapApiKeys, + onBMFMapCreated: onMapCreated, + // onCameraMoveEnd: (cameraPosition) { + // center = cameraPosition.target; + // searchPoi(center); + // }, + // onCameraMove: (cameraPosition) { + // center = cameraPosition.target; + // setState(() {}); + // }, // markers: [Marker(position: center)].toSet(), - touchPoiEnabled: true, - scrollGesturesEnabled: true, - customStyleOptions: _customStyleOptions, - gestureRecognizers: >[ - Factory( - () => EagerGestureRecognizer()) - ].toSet(), + // touchPoiEnabled: true, + // scrollGesturesEnabled: true, + // customStyleOptions: _customStyleOptions, + // gestureRecognizers: >[ + // Factory( + // () => EagerGestureRecognizer()) + // ].toSet(), ), ), Center( diff --git a/lib/main.dart b/lib/main.dart index cda30c1b..091f68a7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -5,6 +5,7 @@ import 'package:event_bus/event_bus.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_bmflocation/bdmap_location_flutter_plugin.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/address/address_map_page.dart'; import 'package:huixiang/address/edit_address_page.dart'; @@ -57,6 +58,7 @@ import 'package:sharesdk_plugin/sharesdk_interface.dart'; import 'package:sharesdk_plugin/sharesdk_register.dart'; import 'package:tpns_flutter_plugin/android/xg_android_api.dart'; import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart'; +import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'home/guide_page.dart'; import 'main_page.dart'; @@ -112,8 +114,16 @@ initSdk() async { "64020361b8ec4c99936c0e3999a9f249", "https://hx.lotus-wallet.com/app/"); shareSDKRegister.setupFacebook( "523308712059457", "d3a1b6377100871799d8973fbe84794a", "回乡"); - SharesdkPlugin.regist(shareSDKRegister); + + if(Platform.isIOS){ + LocationFlutterPlugin.setApiKey("ylW2QPlsbERkho7jOgU4GQSeawmdUIoR"); + BMFMapSDK.setApiKeyAndCoordType( + '7IACaFNxOX2EMauupIZisjI8XSxe09ER', BMF_COORD_TYPE.BD09LL); + } else if(Platform.isAndroid) { + BMFMapSDK.setCoordType(BMF_COORD_TYPE.BD09LL); + } + } EventBus eventBus = EventBus(sync: true); diff --git a/lib/order/store_selector_page.dart b/lib/order/store_selector_page.dart index 3395da26..1b706de7 100644 --- a/lib/order/store_selector_page.dart +++ b/lib/order/store_selector_page.dart @@ -1,8 +1,11 @@ -import 'package:amap_flutter_location/amap_flutter_location.dart'; -import 'package:amap_flutter_location/amap_location_option.dart'; +import 'dart:io'; + +import 'package:android_intent_plus/android_intent.dart'; import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; +import 'package:flutter_bmflocation/bdmap_location_flutter_plugin.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; @@ -11,9 +14,9 @@ import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/view_widget/icon_text.dart'; import 'package:huixiang/view_widget/loading_view.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:huixiang/view_widget/request_permission.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:shared_preferences/shared_preferences.dart'; -import 'package:amap_flutter_base/amap_flutter_base.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class StoreSelectorPage extends StatefulWidget { @@ -26,13 +29,12 @@ class StoreSelectorPage extends StatefulWidget { class _StoreSelectorPage extends State { ApiService apiService; - AMapFlutterLocation aMapFlutterLocation; + LocationFlutterPlugin aMapFlutterLocation; @override void dispose() { super.dispose(); aMapFlutterLocation.stopLocation(); - aMapFlutterLocation.destroy(); } @override @@ -45,20 +47,18 @@ class _StoreSelectorPage extends State { }); if (aMapFlutterLocation == null) { - AMapFlutterLocation.setApiKey("f39d1daa020a56f208eb2519f63e9534", - "feaae7986201b571cace1b83728be5bb"); - aMapFlutterLocation = AMapFlutterLocation(); - aMapFlutterLocation.onLocationChanged().listen((event) { + aMapFlutterLocation = LocationFlutterPlugin(); + aMapFlutterLocation.onResultCallback().listen((event) { if (event != null && event["latitude"] != null && event["longitude"] != null) { print("location: $event"); aMapFlutterLocation.stopLocation(); if (event["latitude"] is String && event["longitude"] is String) { - latLng = LatLng(double.tryParse(event["latitude"]), + latLng = BMFCoordinate(double.tryParse(event["latitude"]), double.tryParse(event["longitude"])); } else { - latLng = LatLng(event["latitude"], event["longitude"]); + latLng = BMFCoordinate(event["latitude"], event["longitude"]); } if (Navigator.of(context).canPop()) { Navigator.of(context).pop(); @@ -70,18 +70,31 @@ class _StoreSelectorPage extends State { } }); } - aMapFlutterLocation.setLocationOption(AMapLocationOption( - needAddress: true, - onceLocation: true, - locationInterval: 100000, - locationMode: AMapLocationMode.Hight_Accuracy, - desiredAccuracy: DesiredAccuracy.ThreeKilometers, - pausesLocationUpdatesAutomatically: true, - )); + + aMapFlutterLocation.prepareLoc({ + "coorType": "bd09ll", + "isNeedAddres": false, + "isNeedAltitude": false, + "isNeedLocationPoiList": false, + "isNeedLocationDescribe": false, + "isNeedNewVersionRgc": false, + "scanspan": 0, + "openGps": true, + "locationMode": 2, + }, { + "locationMode": "kCLLocationAccuracyBest", + "locationTimeout": 10, + "reGeocodeTimeout": 10, + "activityType": "CLActivityTypeAutomotiveNavigation", + "BMKLocationCoordinateType": "BMKLocationCoordinateTypeBMK09LL", + "BMKLocationCoordinateType": "BMKLocationCoordinateTypeBMK09LL", + "isNeedNewVersionRgc": false, + }); + startLocation(); } - saveLatLng(LatLng latLng, province, city, district) async { + saveLatLng(BMFCoordinate latLng, province, city, district) async { SharedPreferences prefs = await SharedPreferences.getInstance(); await prefs.setString("latitude", "${latLng.latitude}"); await prefs.setString("longitude", "${latLng.longitude}"); @@ -91,40 +104,80 @@ class _StoreSelectorPage extends State { } List storeList; - LatLng latLng; + BMFCoordinate latLng; startLocation() async { - if (await Permission.locationWhenInUse.serviceStatus.isEnabled) { - // bool isShown = await Permission.contacts.shouldShowRequestRationale; - // if (isShown) { - // SmartDialog.showToast("shouldShowRequestRationale"); - // } - if (await Permission.location.isPermanentlyDenied) { - openAppSettings(); - getLatLng(); - } else if (await Permission.location.isGranted) { - showCupertinoDialog( - context: context, - barrierDismissible: true, - builder: (context) { - return LoadingView(); - }); - aMapFlutterLocation.startLocation(); + if (!(await Permission.locationWhenInUse.serviceStatus.isEnabled)) { + enableLocation(); + return; + } + + if (await Permission.location.isPermanentlyDenied) { + requestDialog(); + } else if (await Permission.location.isGranted) { + SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai); + aMapFlutterLocation.startLocation(); + Future.delayed(Duration(seconds: 6), () { + SmartDialog.dismiss(); + }); + } else if (await Permission.location.isUndetermined) { + await Permission.location.request(); + } else { + if (Platform.isIOS) { + //去设置中心 + requestDialog(); } else { - PermissionStatus permissionStatus = await Permission.location.request(); - if (permissionStatus.isGranted) { - startLocation(); - } else { - openAppSettings(); - getLatLng(); - } + await Permission.location.request(); } - } else { - //enabledLocation - getLatLng(); } } + enableLocation() { + showCupertinoDialog( + context: context, + builder: (context) { + return RequestPermission( + "assets/image/icon_permission_location_bg.png", + S.of(context).nindingweigongnengweikaiqi, + S.of(context).weilexiangnintuijianfujindemendianxinxi, + S.of(context).dakaidingwei, + (result) async { + if (result) { + final AndroidIntent intent = AndroidIntent( + action: 'action_location_source_settings', + package: "com.zsw.huixiang"); + await intent.launch(); + // startLocation(); + } + }, + heightRatioWithWidth: 0.82, + ); + }, + ); + } + + requestDialog() { + showCupertinoDialog( + context: context, + builder: (context) { + return RequestPermission( + "assets/image/icon_permission_location_bg.png", + S.of(context).nindingweiquanxianweiyunxu, + S.of(context).weilexiangnintuijianfujindemendianxinxi, + S.of(context).kaiqiquanxian, + (result) async { + if (result) { + await openAppSettings(); + if (await Permission.location.isGranted) { + startLocation(); + } + } + }, + heightRatioWithWidth: 0.82, + ); + }); + } + getLatLng() async { SharedPreferences.getInstance().then( (value) => { @@ -134,7 +187,7 @@ class _StoreSelectorPage extends State { value.containsKey("city") && value.containsKey("district")) { - latLng = LatLng(double.tryParse(value.getString("latitude")), + latLng = BMFCoordinate(double.tryParse(value.getString("latitude")), double.tryParse(value.getString("longitude"))), queryStore( value.getString("latitude"), diff --git a/lib/union/store_details_page.dart b/lib/union/store_details_page.dart index a75b8024..81d01f64 100644 --- a/lib/union/store_details_page.dart +++ b/lib/union/store_details_page.dart @@ -119,11 +119,6 @@ class _StoreDetailsPage extends State { SharesdkPlugin.share(platform, params, (state, userData, contentEntity, error) { print("share!$state"); - print("share!$platform"); - print("share!$userData"); - print("share!$contentEntity"); - print("share!$error"); - print("share!"); }); }); }); @@ -239,11 +234,6 @@ class _StoreDetailsPage extends State { }, customRender: { "video": (context, parsedChild, attributes, element) { - print("video attributes: ${element.attributes}"); - print("video attributes: ${element.attributeSpans}"); - print( - "video attributes: ${element.children.first.attributes["src"]}"); - print("video attributes: $parsedChild"); return videoWidget( double.tryParse(attributes['width'] ?? ""), double.tryParse(element.attributes['height'] ?? ""), @@ -251,8 +241,6 @@ class _StoreDetailsPage extends State { element.attributes["sandbox"]); }, "iframe": (context, parsedChild, attributes, element) { - print("iframe attributes: ${element.toString()}"); - print("iframe attributes: $parsedChild"); return videoWidget( double.tryParse(attributes['width'] ?? ""), double.tryParse(element.attributes['height'] ?? ""), diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 586b1c7c..2629fd36 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -1,15 +1,14 @@ import 'dart:io'; import 'dart:ui'; -import 'package:amap_flutter_location/amap_flutter_location.dart'; -import 'package:amap_flutter_location/amap_location_option.dart'; import 'package:android_intent_plus/android_intent.dart'; import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; +import 'package:flutter_bmflocation/bdmap_location_flutter_plugin.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/main.dart'; @@ -21,15 +20,13 @@ import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/icon_text.dart'; import 'package:huixiang/view_widget/item_title.dart'; -import 'package:amap_flutter_base/amap_flutter_base.dart'; -import 'package:amap_flutter_map/amap_flutter_map.dart'; import 'package:huixiang/view_widget/request_permission.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; -import 'dart:typed_data'; import 'package:flutter/rendering.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; class UnionPage extends StatefulWidget { @override @@ -41,27 +38,15 @@ class UnionPage extends StatefulWidget { class _UnionPage extends State with AutomaticKeepAliveClientMixin, WidgetsBindingObserver { //默认设置为不使用自定义地图,如果需要直接显示,在初始化是设置为true - CustomStyleOptions _customStyleOptions = CustomStyleOptions(false); //加载自定义地图样式 void _loadCustomData() async { - if (null == _customStyleOptions) { - _customStyleOptions = CustomStyleOptions(false); - } - ByteData styleByteData = - await rootBundle.load('assets/map_style/style.data'); - _customStyleOptions.styleData = styleByteData.buffer.asUint8List(); - ByteData styleExtraByteData = - await rootBundle.load('assets/map_style/style_extra.data'); - _customStyleOptions.styleExtraData = - styleExtraByteData.buffer.asUint8List(); - //如果需要加载完成后直接展示自定义地图,可以通过setState修改CustomStyleOptions的enable为true setState(() { - _customStyleOptions.enabled = true; + _mapController.setCustomMapStyle('assets/map_style/chatian.sty', 0); }); } - AMapFlutterLocation aMapFlutterLocation; + LocationFlutterPlugin aMapFlutterLocation; RefreshController refreshController = RefreshController(initialRefresh: false); @@ -70,7 +55,6 @@ class _UnionPage extends State super.dispose(); WidgetsBinding.instance.removeObserver(this); aMapFlutterLocation.stopLocation(); - aMapFlutterLocation.destroy(); refreshController.dispose(); } @@ -105,19 +89,17 @@ class _UnionPage extends State WidgetsBinding.instance.addObserver(this); if (aMapFlutterLocation == null) { - AMapFlutterLocation.setApiKey("f39d1daa020a56f208eb2519f63e9534", - "feaae7986201b571cace1b83728be5bb"); - aMapFlutterLocation = AMapFlutterLocation(); - aMapFlutterLocation.onLocationChanged().listen((event) { + aMapFlutterLocation = LocationFlutterPlugin(); + aMapFlutterLocation.onResultCallback().listen((event) { if (event != null && event["latitude"] != null && event["longitude"] != null) { print("location: $event"); if (event["latitude"] is String && event["longitude"] is String) { - latLng = LatLng(double.tryParse(event["latitude"]), + latLng = BMFCoordinate(double.tryParse(event["latitude"]), double.tryParse(event["longitude"])); } else { - latLng = LatLng(event["latitude"], event["longitude"]); + latLng = BMFCoordinate(event["latitude"], event["longitude"]); } saveLatLng( latLng, event["province"], event["city"], event["district"]); @@ -129,12 +111,10 @@ class _UnionPage extends State event["district"], editingController.text); if (_mapController != null) - _mapController.moveCamera( - CameraUpdate.newCameraPosition(CameraPosition( - target: latLng, - zoom: 15.0, - )), - ); + _mapController.updateMapOptions(BMFMapOptions( + center: latLng, + zoomLevel: 15, + )); } }); @@ -146,15 +126,25 @@ class _UnionPage extends State }); } - aMapFlutterLocation.setLocationOption(AMapLocationOption( - needAddress: true, - onceLocation: true, - locationMode: AMapLocationMode.Hight_Accuracy, - desiredAccuracy: DesiredAccuracy.HundredMeters, - desiredLocationAccuracyAuthorizationMode: - AMapLocationAccuracyAuthorizationMode.FullAndReduceAccuracy, - pausesLocationUpdatesAutomatically: true, - )); + aMapFlutterLocation.prepareLoc({ + "coorType": "bd09ll", + "isNeedAddres": false, + "isNeedAltitude": false, + "isNeedLocationPoiList": false, + "isNeedLocationDescribe": false, + "isNeedNewVersionRgc": false, + "scanspan": 0, + "openGps": true, + "locationMode": 2, + }, { + "locationMode": "kCLLocationAccuracyBest", + "locationTimeout": 10, + "reGeocodeTimeout": 10, + "activityType": "CLActivityTypeAutomotiveNavigation", + "BMKLocationCoordinateType": "BMKLocationCoordinateTypeBMK09LL", + "BMKLocationCoordinateType": "BMKLocationCoordinateTypeBMK09LL", + "isNeedNewVersionRgc": false, + }); _loadCustomData(); @@ -162,9 +152,9 @@ class _UnionPage extends State startLocation(); } - LatLng latLng; + BMFCoordinate latLng; - saveLatLng(LatLng latLng, province, city, district) async { + saveLatLng(BMFCoordinate latLng, province, city, district) async { SharedPreferences prefs = await SharedPreferences.getInstance(); await prefs.setString("latitude", "${latLng.latitude}"); await prefs.setString("longitude", "${latLng.longitude}"); @@ -186,7 +176,7 @@ class _UnionPage extends State value.containsKey("city") && value.containsKey("district")) { - latLng = LatLng(double.tryParse(value.getString("latitude")), + latLng = BMFCoordinate(double.tryParse(value.getString("latitude")), double.tryParse(value.getString("longitude"))), queryStore( value.getString("latitude"), @@ -198,14 +188,10 @@ class _UnionPage extends State ), setState(() { if (_mapController != null) { - _mapController.moveCamera( - CameraUpdate.newCameraPosition( - CameraPosition( - target: latLng, - zoom: 15.0, - ), - ), - ); + _mapController.updateMapOptions(BMFMapOptions( + center: latLng, + zoomLevel: 15, + )); } }) } @@ -235,7 +221,7 @@ class _UnionPage extends State storeList = (baseData.data as List) .map((e) => Store.fromJson(e)) .toList(); - buildMarker(); + // buildMarker(); refreshController.refreshCompleted(); if (mounted) setState(() {}); } else { @@ -243,34 +229,20 @@ class _UnionPage extends State } } - RepaintBoundary repaintBoundary; - - buildMarker() async { - markers.clear(); - - BitmapDescriptor bitmapDescriptor = await BitmapDescriptor.fromAssetImage( - ImageConfiguration( - bundle: DefaultAssetBundle.of(context), - devicePixelRatio: MediaQuery.of(context)?.devicePixelRatio ?? 1.0, - locale: Localizations.localeOf(context), - textDirection: Directionality.of(context), - size: Size(35.w, 35.h), - platform: defaultTargetPlatform, - ), - "assets/image/icon_map_marker.png"); - - markers.addAll(storeList.map((element) => Marker( - position: LatLng(double.tryParse(element.latitude), - double.tryParse(element.longitude)), - anchor: Offset(0.5, 0.9), - clickable: false, - icon: bitmapDescriptor, - infoWindowEnable: true, - ))); - if (mounted) setState(() {}); - } - - List markers = []; + // buildMarker() async { + // markers.clear(); + // markers.addAll(storeList.map((element) => BMFMarker( + // position: BMFCoordinate(double.tryParse(element.latitude), + // double.tryParse(element.longitude)), + // centerOffset: BMFPoint(0.5, 0.9), + // enabled: false, + // icon: "assets/image/icon_map_marker.png", + // draggable: false, + // ))); + // if (mounted) setState(() {}); + // } + // + // List markers = []; @override Widget build(BuildContext context) { @@ -290,7 +262,7 @@ class _UnionPage extends State PreferredSize( preferredSize: Size(double.infinity, 52.h), child: Container( - padding: EdgeInsets.only(top: 26.5.h), + padding: EdgeInsets.only(top: 6.h), color: Color(0xFFFAFAFA), child: ItemTitle( text: S.of(context).jingbilianmenghuiyuandian, @@ -306,24 +278,17 @@ class _UnionPage extends State // headerSliverBuilder: (context, inner) { // return [ // SliverOverlapAbsorber( - // sliver: buildSliverAppBar(AMapWidget( - // initialCameraPosition: CameraPosition( - // target: LatLng(30.553111, 114.342366), - // zoom: 12.0, + // sliver: buildSliverAppBar(BMFMapWidget( + // mapOptions: BMFMapOptions( + // center: BMFCoordinate(30.553111, 114.342366), + // zoomLevel: 12, // ), - // onMapCreated: onMapCreated, - // apiKey: aMapApiKeys, - // touchPoiEnabled: true, - // markers: markers.toSet(), - // scrollGesturesEnabled: true, - // customStyleOptions: _customStyleOptions, - // onPoiTouched: (poiTouch) { - // FocusScope.of(context).requestFocus(FocusNode()); - // }, - // gestureRecognizers: >[ - // Factory( - // () => EagerGestureRecognizer()), - // ].toSet(), + // onBMFMapCreated: onMapCreated, + // // customStyleOptions: _customStyleOptions, + // // gestureRecognizers: >[ + // // Factory( + // // () => EagerGestureRecognizer()), + // // ].toSet(), // )), // handle: // NestedScrollView.sliverOverlapAbsorberHandleFor(context), @@ -368,7 +333,7 @@ class _UnionPage extends State itemCount: storeList == null ? 0 : storeList.length, // padding: EdgeInsets.only(top: 8.h, bottom: 84.h + (375.h - 88.h) + 4.h), padding: EdgeInsets.only( - top: 17.h, bottom: 84.h /* + (375.h - 88.h) + 4.h*/), + top: 8.h, bottom: 84.h /* + (375.h - 88.h) + 4.h*/), physics: NeverScrollableScrollPhysics(), itemBuilder: (context, position) { return GestureDetector( @@ -460,10 +425,10 @@ class _UnionPage extends State }); } - AMapController _mapController; + BMFMapController _mapController; TextEditingController editingController = TextEditingController(); - void onMapCreated(AMapController controller) { + void onMapCreated(BMFMapController controller) { _mapController = controller; } @@ -473,16 +438,17 @@ class _UnionPage extends State margin: EdgeInsets.fromLTRB(16.w, 40, 16.w, 0), padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h), decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(4)), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ) - ]), + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(4)), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + ), child: TextField( textInputAction: TextInputAction.search, onEditingComplete: () { @@ -513,81 +479,81 @@ class _UnionPage extends State ); } - Widget buildSliverAppBar(AMapWidget map) { - return SliverAppBar( - // 滑上去时搜索隐藏 - // floating: true, - // snap: true, - pinned: true, - backgroundColor: Color(0xFFFAFAFA), - elevation: 0, - automaticallyImplyLeading: false, - title: Container( - height: 36.h, - margin: EdgeInsets.fromLTRB(16.w, 0, 16.w, 0), - padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(4)), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ) - ]), - child: TextField( - textInputAction: TextInputAction.search, - onEditingComplete: () { - startLocation(); - }, - controller: editingController, - cursorHeight: 30.h, - decoration: InputDecoration( - contentPadding: EdgeInsets.symmetric(vertical: 12.h), - prefixIcon: Icon( - Icons.search, - size: 24, - color: Colors.black, - ), - suffixIcon: InkWell( - onTap: () { - editingController.clear(); - }, - child: Icon( - Icons.close, - size: 19, - color: Colors.grey, - ), - ), - border: InputBorder.none, - ), - ), - ), - flexibleSpace: FlexibleSpaceBar( - background: Container( - child: map, - ), - ), - expandedHeight: 375.h, - bottom: PreferredSize( - preferredSize: Size(double.infinity, 52.h), - child: Container( - padding: EdgeInsets.only(top: 6.h), - color: Color(0xFFFAFAFA), - child: ItemTitle( - text: S.of(context).jingbilianmenghuiyuandian, - imgPath: "assets/image/icon_union_store.png", - ), - ), - ), - ); - } + // Widget buildSliverAppBar(BMFMapWidget map) { + // return SliverAppBar( + // // 滑上去时搜索隐藏 + // // floating: true, + // // snap: true, + // pinned: true, + // backgroundColor: Color(0xFFFAFAFA), + // elevation: 0, + // automaticallyImplyLeading: false, + // title: Container( + // height: 36.h, + // margin: EdgeInsets.fromLTRB(16.w, 0, 16.w, 0), + // padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h), + // decoration: BoxDecoration( + // color: Colors.white, + // borderRadius: BorderRadius.all(Radius.circular(4)), + // boxShadow: [ + // BoxShadow( + // color: Colors.black.withAlpha(12), + // offset: Offset(0, 3), + // blurRadius: 14, + // spreadRadius: 0, + // ) + // ]), + // child: TextField( + // textInputAction: TextInputAction.search, + // onEditingComplete: () { + // startLocation(); + // }, + // controller: editingController, + // cursorHeight: 30.h, + // decoration: InputDecoration( + // contentPadding: EdgeInsets.symmetric(vertical: 12.h), + // prefixIcon: Icon( + // Icons.search, + // size: 24, + // color: Colors.black, + // ), + // suffixIcon: InkWell( + // onTap: () { + // editingController.clear(); + // }, + // child: Icon( + // Icons.close, + // size: 19, + // color: Colors.grey, + // ), + // ), + // border: InputBorder.none, + // ), + // ), + // ), + // flexibleSpace: FlexibleSpaceBar( + // background: Container( + // child: map, + // ), + // ), + // expandedHeight: 375.h, + // bottom: PreferredSize( + // preferredSize: Size(double.infinity, 52.h), + // child: Container( + // padding: EdgeInsets.only(top: 6.h), + // color: Color(0xFFFAFAFA), + // child: ItemTitle( + // text: S.of(context).jingbilianmenghuiyuandian, + // imgPath: "assets/image/icon_union_store.png", + // ), + // ), + // ), + // ); + // } Widget buildStoreItem(Store store, position) { return Container( - margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 16.h), + margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 8.h), padding: EdgeInsets.fromLTRB(20.w, 20.h, 20.w, 20.h), decoration: BoxDecoration( color: Colors.white, @@ -651,6 +617,9 @@ class _UnionPage extends State ), ], ), + SizedBox( + height: 4.h, + ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, @@ -689,6 +658,10 @@ class _UnionPage extends State ), ], ), + // Expanded( + // child: Container(), + // flex: 1, + // ), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/view_widget/mine_vip_view.dart b/lib/view_widget/mine_vip_view.dart index 7ef8a40c..44b1275f 100644 --- a/lib/view_widget/mine_vip_view.dart +++ b/lib/view_widget/mine_vip_view.dart @@ -94,7 +94,7 @@ class MineVipView extends StatelessWidget { } } return AspectRatio( - aspectRatio: 1.8, + aspectRatio: 1.7, child: Container( margin: EdgeInsets.fromLTRB(padding.w, 16.h, padding.w, 8.h), decoration: BoxDecoration( @@ -110,7 +110,7 @@ class MineVipView extends StatelessWidget { offset: Offset(0, 3), blurRadius: 14, spreadRadius: 0, - ) + ), ], ), child: Column( @@ -246,12 +246,12 @@ class MineVipView extends StatelessWidget { Icons.qr_code, size: 24, color: Colors.white, - ) + ), ], - ) + ), ], ), - ) + ), ], ), ), diff --git a/pubspec.lock b/pubspec.lock index f02aa419..6dc89927 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -8,27 +8,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "14.0.0" - amap_flutter_base: - dependency: transitive - description: - name: amap_flutter_base - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.2" - amap_flutter_location: - dependency: "direct main" - description: - name: amap_flutter_location - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.0" - amap_flutter_map: - dependency: "direct main" - description: - name: amap_flutter_map - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.2" analyzer: dependency: transitive description: @@ -300,6 +279,34 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_baidu_mapapi_base: + dependency: "direct main" + description: + name: flutter_baidu_mapapi_base + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.1" + flutter_baidu_mapapi_map: + dependency: "direct main" + description: + name: flutter_baidu_mapapi_map + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.1" + flutter_baidu_mapapi_search: + dependency: "direct main" + description: + name: flutter_baidu_mapapi_search + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.1" + flutter_baidu_mapapi_utils: + dependency: "direct main" + description: + name: flutter_baidu_mapapi_utils + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.1" flutter_cache_manager: dependency: transitive description: @@ -851,7 +858,7 @@ packages: name: stream_transform url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0" + version: "2.0.0" string_scanner: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index e0d55bf0..68b17f91 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -43,16 +43,18 @@ dependencies: flutter_staggered_grid_view: ^0.4.0 # Null safety pull_to_refresh: ^2.0.0 # Null safety -# permission_handler: ^8.1.3 permission_handler: ^5.0.1+1 - amap_flutter_map: ^1.0.0 - amap_flutter_location: ^2.0.0 # Null safety + +# flutter_bmflocation: ^1.0.4 + flutter_baidu_mapapi_base: ^2.0.1 + flutter_baidu_mapapi_map: ^2.0.1 + flutter_baidu_mapapi_search: ^2.0.1 + flutter_baidu_mapapi_utils: ^2.0.1 dio: ^3.0.10 rxdart: ^0.26.0 retrofit: ^1.3.4+1 json_annotation: ^3.1.1 -# webview_flutter: ^1.0.7 logger: ^1.0.0 android_intent_plus: ^1.0.2