expo-gaode-map-navigation 1.1.5-next.1 → 1.1.5-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/android/build.gradle +10 -0
  2. package/android/src/main/cpp/CMakeLists.txt +24 -0
  3. package/android/src/main/cpp/cluster_jni.cpp +848 -0
  4. package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapModule.kt +616 -92
  5. package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapOfflineModule.kt +493 -0
  6. package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapView.kt +230 -14
  7. package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapViewModule.kt +37 -27
  8. package/android/src/main/java/expo/modules/gaodemap/map/MapPreloadManager.kt +494 -0
  9. package/android/src/main/java/expo/modules/gaodemap/map/companion/BitmapDescriptorCache.kt +30 -0
  10. package/android/src/main/java/expo/modules/gaodemap/map/companion/IconBitmapCache.kt +37 -0
  11. package/android/src/main/java/expo/modules/gaodemap/map/managers/UIManager.kt +76 -0
  12. package/android/src/main/java/expo/modules/gaodemap/map/modules/LocationManager.kt +15 -3
  13. package/android/src/main/java/expo/modules/gaodemap/map/modules/SDKInitializer.kt +4 -59
  14. package/android/src/main/java/expo/modules/gaodemap/map/overlays/CircleView.kt +9 -12
  15. package/android/src/main/java/expo/modules/gaodemap/map/overlays/CircleViewModule.kt +5 -6
  16. package/android/src/main/java/expo/modules/gaodemap/map/overlays/ClusterView.kt +539 -66
  17. package/android/src/main/java/expo/modules/gaodemap/map/overlays/ClusterViewModule.kt +17 -1
  18. package/android/src/main/java/expo/modules/gaodemap/map/overlays/HeatMapView.kt +165 -33
  19. package/android/src/main/java/expo/modules/gaodemap/map/overlays/HeatMapViewModule.kt +15 -3
  20. package/android/src/main/java/expo/modules/gaodemap/map/overlays/MarkerView.kt +1249 -672
  21. package/android/src/main/java/expo/modules/gaodemap/map/overlays/MarkerViewModule.kt +40 -17
  22. package/android/src/main/java/expo/modules/gaodemap/map/overlays/MultiPointView.kt +177 -22
  23. package/android/src/main/java/expo/modules/gaodemap/map/overlays/MultiPointViewModule.kt +11 -3
  24. package/android/src/main/java/expo/modules/gaodemap/map/overlays/PolygonView.kt +57 -14
  25. package/android/src/main/java/expo/modules/gaodemap/map/overlays/PolygonViewModule.kt +9 -5
  26. package/android/src/main/java/expo/modules/gaodemap/map/overlays/PolylineView.kt +90 -63
  27. package/android/src/main/java/expo/modules/gaodemap/map/overlays/PolylineViewModule.kt +7 -3
  28. package/android/src/main/java/expo/modules/gaodemap/map/services/LocationForegroundService.kt +3 -2
  29. package/android/src/main/java/expo/modules/gaodemap/map/utils/BitmapDescriptorCache.kt +20 -0
  30. package/android/src/main/java/expo/modules/gaodemap/map/utils/ClusterNative.kt +13 -0
  31. package/android/src/main/java/expo/modules/gaodemap/map/utils/ColorParser.kt +20 -0
  32. package/android/src/main/java/expo/modules/gaodemap/map/utils/GeometryUtils.kt +515 -0
  33. package/android/src/main/java/expo/modules/gaodemap/map/utils/LatLngParser.kt +91 -0
  34. package/android/src/main/java/expo/modules/gaodemap/map/utils/PermissionHelper.kt +248 -0
  35. package/build/ExpoGaodeMapNaviView.d.ts +7 -7
  36. package/build/ExpoGaodeMapNaviView.js +8 -8
  37. package/build/index.d.ts +1 -1
  38. package/build/index.js +2 -2
  39. package/build/map/ExpoGaodeMapModule.d.ts +2 -201
  40. package/build/map/ExpoGaodeMapModule.js +584 -14
  41. package/build/map/ExpoGaodeMapOfflineModule.d.ts +139 -0
  42. package/build/map/ExpoGaodeMapOfflineModule.js +8 -0
  43. package/build/map/ExpoGaodeMapView.js +66 -58
  44. package/build/map/components/FoldableMapView.d.ts +38 -0
  45. package/build/map/components/FoldableMapView.js +209 -0
  46. package/build/map/components/MapContext.d.ts +12 -0
  47. package/build/map/components/MapContext.js +54 -0
  48. package/build/map/components/MapUI.d.ts +18 -0
  49. package/build/map/components/MapUI.js +29 -0
  50. package/build/map/components/overlays/Circle.js +34 -3
  51. package/build/map/components/overlays/Cluster.d.ts +3 -1
  52. package/build/map/components/overlays/Cluster.js +31 -2
  53. package/build/map/components/overlays/HeatMap.d.ts +3 -1
  54. package/build/map/components/overlays/HeatMap.js +33 -3
  55. package/build/map/components/overlays/Marker.d.ts +1 -1
  56. package/build/map/components/overlays/Marker.js +37 -32
  57. package/build/map/components/overlays/MultiPoint.js +1 -1
  58. package/build/map/components/overlays/Polygon.js +30 -3
  59. package/build/map/components/overlays/Polyline.js +36 -3
  60. package/build/map/index.d.ts +25 -5
  61. package/build/map/index.js +59 -18
  62. package/build/map/types/common.types.d.ts +40 -0
  63. package/build/map/types/common.types.js +0 -4
  64. package/build/map/types/index.d.ts +3 -2
  65. package/build/map/types/map-view.types.d.ts +108 -3
  66. package/build/map/types/native-module.types.d.ts +363 -0
  67. package/build/map/types/native-module.types.js +5 -0
  68. package/build/map/types/offline.types.d.ts +132 -0
  69. package/build/map/types/offline.types.js +5 -0
  70. package/build/map/types/overlays.types.d.ts +137 -24
  71. package/build/map/utils/ErrorHandler.d.ts +110 -0
  72. package/build/map/utils/ErrorHandler.js +421 -0
  73. package/build/map/utils/GeoUtils.d.ts +20 -0
  74. package/build/map/utils/GeoUtils.js +76 -0
  75. package/build/map/utils/OfflineMapManager.d.ts +148 -0
  76. package/build/map/utils/OfflineMapManager.js +217 -0
  77. package/build/map/utils/PermissionUtils.d.ts +91 -0
  78. package/build/map/utils/PermissionUtils.js +255 -0
  79. package/build/map/utils/PlatformDetector.d.ts +102 -0
  80. package/build/map/utils/PlatformDetector.js +186 -0
  81. package/build/types/naviview.types.d.ts +1 -1
  82. package/expo-module.config.json +12 -10
  83. package/ios/ExpoGaodeMapNavigation.podspec +9 -0
  84. package/ios/map/ExpoGaodeMapModule.swift +485 -75
  85. package/ios/map/ExpoGaodeMapOfflineModule.swift +479 -0
  86. package/ios/map/ExpoGaodeMapView.swift +611 -62
  87. package/ios/map/ExpoGaodeMapViewModule.swift +48 -26
  88. package/ios/map/MapPreloadManager.swift +348 -0
  89. package/ios/map/cpp/ClusterEngine.cpp +110 -0
  90. package/ios/map/cpp/ClusterEngine.hpp +20 -0
  91. package/ios/map/cpp/ColorParser.cpp +135 -0
  92. package/ios/map/cpp/ColorParser.hpp +14 -0
  93. package/ios/map/cpp/GeometryEngine.cpp +574 -0
  94. package/ios/map/cpp/GeometryEngine.hpp +159 -0
  95. package/ios/map/cpp/QuadTree.cpp +92 -0
  96. package/ios/map/cpp/QuadTree.hpp +42 -0
  97. package/ios/map/cpp/README.md +55 -0
  98. package/ios/map/cpp/tests/benchmark_js.js +41 -0
  99. package/ios/map/cpp/tests/run.sh +17 -0
  100. package/ios/map/cpp/tests/test_main.cpp +276 -0
  101. package/ios/map/managers/UIManager.swift +72 -1
  102. package/ios/map/modules/LocationManager.swift +114 -165
  103. package/ios/map/overlays/CircleView.swift +16 -32
  104. package/ios/map/overlays/CircleViewModule.swift +12 -12
  105. package/ios/map/overlays/ClusterAnnotation.swift +32 -0
  106. package/ios/map/overlays/ClusterView.swift +331 -45
  107. package/ios/map/overlays/ClusterViewModule.swift +20 -6
  108. package/ios/map/overlays/HeatMapView.swift +135 -32
  109. package/ios/map/overlays/HeatMapViewModule.swift +20 -8
  110. package/ios/map/overlays/MarkerView.swift +613 -130
  111. package/ios/map/overlays/MarkerViewModule.swift +38 -18
  112. package/ios/map/overlays/MultiPointView.swift +168 -10
  113. package/ios/map/overlays/MultiPointViewModule.swift +27 -5
  114. package/ios/map/overlays/PolygonView.swift +62 -23
  115. package/ios/map/overlays/PolygonViewModule.swift +18 -12
  116. package/ios/map/overlays/PolylineView.swift +21 -13
  117. package/ios/map/overlays/PolylineViewModule.swift +18 -12
  118. package/ios/map/utils/ClusterNative.h +96 -0
  119. package/ios/map/utils/ClusterNative.mm +377 -0
  120. package/ios/map/utils/ColorParser.swift +12 -1
  121. package/ios/map/utils/CppBridging.mm +13 -0
  122. package/ios/map/utils/GeometryUtils.swift +34 -0
  123. package/ios/map/utils/LatLngParser.swift +87 -0
  124. package/ios/map/utils/PermissionManager.swift +135 -6
  125. package/package.json +1 -1
  126. package/build/map/ExpoGaodeMap.types.d.ts +0 -41
  127. package/build/map/ExpoGaodeMap.types.js +0 -24
  128. package/build/map/utils/EventManager.d.ts +0 -10
  129. package/build/map/utils/EventManager.js +0 -26
  130. package/build/map/utils/ModuleLoader.d.ts +0 -73
  131. package/build/map/utils/ModuleLoader.js +0 -112
@@ -0,0 +1,248 @@
1
+ package expo.modules.gaodemap.map.utils
2
+
3
+ import android.Manifest
4
+ import android.app.Activity
5
+ import android.content.Context
6
+ import android.content.Intent
7
+ import android.content.pm.PackageManager
8
+ import android.net.Uri
9
+ import android.os.Build
10
+ import android.provider.Settings
11
+ import androidx.core.app.ActivityCompat
12
+ import androidx.core.content.ContextCompat
13
+
14
+ /**
15
+ * Android 14+ 权限适配助手
16
+ *
17
+ * 主要变化:
18
+ * 1. Android 14 (API 34) 引入了更精细的位置权限
19
+ * 2. 需要同时请求前台和后台位置权限
20
+ * 3. 权限请求流程更加严格
21
+ */
22
+ object PermissionHelper {
23
+
24
+ /**
25
+ * 位置权限类型
26
+ */
27
+ enum class LocationPermissionType {
28
+ FOREGROUND, // 仅前台位置
29
+ BACKGROUND, // 后台位置
30
+ FOREGROUND_AND_BACKGROUND // 前台+后台
31
+ }
32
+
33
+ /**
34
+ * 权限状态
35
+ */
36
+ data class PermissionStatus(
37
+ val granted: Boolean,
38
+ val shouldShowRationale: Boolean,
39
+ val isPermanentlyDenied: Boolean,
40
+ val fineLocation: Boolean = false,
41
+ val coarseLocation: Boolean = false,
42
+ val backgroundLocation: Boolean = false
43
+
44
+ )
45
+
46
+ /**
47
+ * 检查是否为 Android 14+
48
+ */
49
+ fun isAndroid14Plus(): Boolean {
50
+ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE // API 34
51
+ }
52
+
53
+ /**
54
+ * 检查是否为 Android 10+(引入后台位置权限)
55
+ */
56
+ fun isAndroid10Plus(): Boolean {
57
+ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q // API 29
58
+ }
59
+
60
+ /**
61
+ * 获取需要请求的前台位置权限列表
62
+ */
63
+ fun getForegroundLocationPermissions(): Array<String> {
64
+ return arrayOf(
65
+ Manifest.permission.ACCESS_FINE_LOCATION,
66
+ Manifest.permission.ACCESS_COARSE_LOCATION
67
+ )
68
+ }
69
+
70
+ /**
71
+ * 获取后台位置权限
72
+ */
73
+ fun getBackgroundLocationPermission(): String? {
74
+ return if (isAndroid10Plus()) {
75
+ Manifest.permission.ACCESS_BACKGROUND_LOCATION
76
+ } else {
77
+ null
78
+ }
79
+ }
80
+
81
+ /**
82
+ * 检查前台位置权限状态
83
+ */
84
+ fun checkForegroundLocationPermission(context: Context): PermissionStatus {
85
+ val fineGranted = ContextCompat.checkSelfPermission(
86
+ context,
87
+ Manifest.permission.ACCESS_FINE_LOCATION
88
+ ) == PackageManager.PERMISSION_GRANTED
89
+
90
+ val coarseGranted = ContextCompat.checkSelfPermission(
91
+ context,
92
+ Manifest.permission.ACCESS_COARSE_LOCATION
93
+ ) == PackageManager.PERMISSION_GRANTED
94
+
95
+ val granted = fineGranted && coarseGranted
96
+
97
+ val activity = context as? Activity
98
+ val shouldShowRationale = if (activity != null && !granted) {
99
+ ActivityCompat.shouldShowRequestPermissionRationale(
100
+ activity,
101
+ Manifest.permission.ACCESS_FINE_LOCATION
102
+ )
103
+ } else {
104
+ false
105
+ }
106
+
107
+ return PermissionStatus(
108
+ granted = granted,
109
+ shouldShowRationale = shouldShowRationale,
110
+ isPermanentlyDenied = !granted && !shouldShowRationale && activity != null,
111
+ fineLocation = fineGranted,
112
+ coarseLocation = coarseGranted
113
+ )
114
+ }
115
+
116
+ /**
117
+ * 检查后台位置权限状态
118
+ */
119
+ fun checkBackgroundLocationPermission(context: Context): PermissionStatus {
120
+ val permission = getBackgroundLocationPermission()
121
+ if (permission == null) {
122
+ // Android 10 以下不支持后台位置权限
123
+ return PermissionStatus(
124
+ granted = true,
125
+ shouldShowRationale = false,
126
+ isPermanentlyDenied = false,
127
+ backgroundLocation = true
128
+ )
129
+ }
130
+
131
+ val granted = ContextCompat.checkSelfPermission(
132
+ context,
133
+ permission
134
+ ) == PackageManager.PERMISSION_GRANTED
135
+
136
+ val activity = context as? Activity
137
+ val shouldShowRationale = if (activity != null && !granted) {
138
+ ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)
139
+ } else {
140
+ false
141
+ }
142
+
143
+ return PermissionStatus(
144
+ granted = granted,
145
+ shouldShowRationale = shouldShowRationale,
146
+ isPermanentlyDenied = !granted && !shouldShowRationale && activity != null,
147
+ backgroundLocation = granted
148
+ )
149
+ }
150
+
151
+ /**
152
+ * 检查完整位置权限状态(前台+后台)
153
+ */
154
+ fun checkFullLocationPermission(context: Context): PermissionStatus {
155
+ val foreground = checkForegroundLocationPermission(context)
156
+ val background = checkBackgroundLocationPermission(context)
157
+
158
+ return PermissionStatus(
159
+ granted = foreground.granted && background.granted,
160
+ shouldShowRationale = foreground.shouldShowRationale || background.shouldShowRationale,
161
+ isPermanentlyDenied = foreground.isPermanentlyDenied || background.isPermanentlyDenied,
162
+ fineLocation = foreground.fineLocation,
163
+ coarseLocation = foreground.coarseLocation,
164
+ backgroundLocation = background.backgroundLocation
165
+ )
166
+ }
167
+
168
+ /**
169
+ * 请求前台位置权限
170
+ * Android 14+ 推荐的请求流程
171
+ */
172
+ fun requestForegroundLocationPermission(activity: Activity, requestCode: Int) {
173
+ val permissions = getForegroundLocationPermissions()
174
+ ActivityCompat.requestPermissions(activity, permissions, requestCode)
175
+ }
176
+
177
+ /**
178
+ * 请求后台位置权限
179
+ * 注意:必须在前台权限已授予后才能请求
180
+ */
181
+ fun requestBackgroundLocationPermission(activity: Activity, requestCode: Int): Boolean {
182
+ val permission = getBackgroundLocationPermission()
183
+ if (permission == null) {
184
+ return false
185
+ }
186
+
187
+ // 检查前台权限是否已授予
188
+ val foregroundStatus = checkForegroundLocationPermission(activity)
189
+ if (!foregroundStatus.granted) {
190
+ return false
191
+ }
192
+
193
+ ActivityCompat.requestPermissions(activity, arrayOf(permission), requestCode)
194
+ return true
195
+ }
196
+
197
+ /**
198
+ * 打开应用设置页面
199
+ * 用于引导用户手动授予权限
200
+ */
201
+ fun openAppSettings(context: Context) {
202
+ val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
203
+ data = Uri.fromParts("package", context.packageName, null)
204
+ flags = Intent.FLAG_ACTIVITY_NEW_TASK
205
+ }
206
+ context.startActivity(intent)
207
+ }
208
+
209
+ /**
210
+ * 获取权限请求的推荐提示文案(Android 14+ 优化)
211
+ */
212
+ fun getPermissionRationale(
213
+ type: LocationPermissionType,
214
+ isAndroid14: Boolean = isAndroid14Plus()
215
+ ): String {
216
+ return when (type) {
217
+ LocationPermissionType.FOREGROUND -> {
218
+ if (isAndroid14) {
219
+ "为了在地图上显示您的位置,应用需要访问您的位置信息。\n\n" +
220
+ "您可以选择:\n" +
221
+ "• 仅在使用应用时允许\n" +
222
+ "• 每次询问\n\n" +
223
+ "我们不会在后台收集您的位置数据。"
224
+ } else {
225
+ "为了在地图上显示您的位置,应用需要访问您的位置信息。"
226
+ }
227
+ }
228
+ LocationPermissionType.BACKGROUND -> {
229
+ if (isAndroid14) {
230
+ "为了在后台更新您的位置(如导航、轨迹记录),应用需要始终访问位置权限。\n\n" +
231
+ "您可以随时在设置中更改此权限。"
232
+ } else {
233
+ "为了在后台更新您的位置,应用需要始终访问位置权限。"
234
+ }
235
+ }
236
+ LocationPermissionType.FOREGROUND_AND_BACKGROUND -> {
237
+ if (isAndroid14) {
238
+ "应用需要位置权限来提供以下功能:\n" +
239
+ "• 在地图上显示您的位置(前台)\n" +
240
+ "• 后台导航和轨迹记录(后台)\n\n" +
241
+ "我们会先请求前台权限,然后再请求后台权限。"
242
+ } else {
243
+ "应用需要位置权限来显示地图位置和后台导航功能。"
244
+ }
245
+ }
246
+ }
247
+ }
248
+ }
@@ -1,9 +1,9 @@
1
1
  import * as React from 'react';
2
- import type { Coordinates, NaviViewProps } from './types';
2
+ import type { Coordinates, ExpoGaodeMapNaviViewProps } from './types';
3
3
  /**
4
- * NaviView Ref 类型
4
+ * ExpoGaodeMapNaviView Ref 类型
5
5
  */
6
- export interface NaviViewRef {
6
+ export interface ExpoGaodeMapNaviViewRef {
7
7
  /**
8
8
  * 开始导航
9
9
  */
@@ -26,11 +26,11 @@ export interface NaviViewRef {
26
26
  *
27
27
  * @example
28
28
  * ```tsx
29
- * import { NaviView } from 'expo-gaode-map-navigation';
29
+ * import { ExpoGaodeMapNaviView } from 'expo-gaode-map-navigation';
30
30
  *
31
31
  * function NavigationScreen() {
32
32
  * return (
33
- * <NaviView
33
+ * <ExpoGaodeMapNaviView
34
34
  * style={{ flex: 1 }}
35
35
  * naviType={0} // GPS 导航
36
36
  * showCamera={true}
@@ -46,5 +46,5 @@ export interface NaviViewRef {
46
46
  * }
47
47
  * ```
48
48
  */
49
- export declare const NaviView: React.ForwardRefExoticComponent<NaviViewProps & React.RefAttributes<NaviViewRef>>;
50
- export default NaviView;
49
+ export declare const ExpoGaodeMapNaviView: React.ForwardRefExoticComponent<ExpoGaodeMapNaviViewProps & React.RefAttributes<ExpoGaodeMapNaviViewRef>>;
50
+ export default ExpoGaodeMapNaviView;
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.NaviView = void 0;
36
+ exports.ExpoGaodeMapNaviView = void 0;
37
37
  const expo_modules_core_1 = require("expo-modules-core");
38
38
  const React = __importStar(require("react"));
39
39
  const NativeView = (0, expo_modules_core_1.requireNativeViewManager)('ExpoGaodeMapNaviView');
@@ -50,11 +50,11 @@ const NativeView = (0, expo_modules_core_1.requireNativeViewManager)('ExpoGaodeM
50
50
  *
51
51
  * @example
52
52
  * ```tsx
53
- * import { NaviView } from 'expo-gaode-map-navigation';
53
+ * import { ExpoGaodeMapNaviView } from 'expo-gaode-map-navigation';
54
54
  *
55
55
  * function NavigationScreen() {
56
56
  * return (
57
- * <NaviView
57
+ * <ExpoGaodeMapNaviView
58
58
  * style={{ flex: 1 }}
59
59
  * naviType={0} // GPS 导航
60
60
  * showCamera={true}
@@ -70,13 +70,13 @@ const NativeView = (0, expo_modules_core_1.requireNativeViewManager)('ExpoGaodeM
70
70
  * }
71
71
  * ```
72
72
  */
73
- exports.NaviView = React.forwardRef((props, ref) => {
73
+ exports.ExpoGaodeMapNaviView = React.forwardRef((props, ref) => {
74
74
  const nativeRef = React.useRef(null);
75
75
  // 创建 API 引用
76
76
  const apiRef = React.useMemo(() => ({
77
77
  startNavigation: async (start, end, type) => {
78
78
  if (!nativeRef.current)
79
- throw new Error('NaviView not initialized');
79
+ throw new Error('ExpoGaodeMapNaviView not initialized');
80
80
  // 将对象解构为单独的参数传递给原生层
81
81
  const startLat = start?.latitude ?? 0;
82
82
  const startLng = start?.longitude ?? 0;
@@ -86,7 +86,7 @@ exports.NaviView = React.forwardRef((props, ref) => {
86
86
  },
87
87
  stopNavigation: async () => {
88
88
  if (!nativeRef.current)
89
- throw new Error('NaviView not initialized');
89
+ throw new Error('ExpoGaodeMapNaviView not initialized');
90
90
  return nativeRef.current.stopNavigation();
91
91
  },
92
92
  }), []);
@@ -94,5 +94,5 @@ exports.NaviView = React.forwardRef((props, ref) => {
94
94
  React.useImperativeHandle(ref, () => apiRef, [apiRef]);
95
95
  return <NativeView ref={nativeRef} {...props}/>;
96
96
  });
97
- exports.NaviView.displayName = 'NaviView';
98
- exports.default = exports.NaviView;
97
+ exports.ExpoGaodeMapNaviView.displayName = 'ExpoGaodeMapNaviView';
98
+ exports.default = exports.ExpoGaodeMapNaviView;
package/build/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from './map';
2
2
  import { RouteType, DriveStrategy, WalkStrategy, RideStrategy, TruckSize, TravelStrategy } from './types';
3
3
  import type { NaviPoint, RouteOptions, DriveRouteOptions, WalkRouteOptions, RideRouteOptions, EBikeRouteOptions, TruckRouteOptions, RouteResult, DriveRouteResult, IndependentRouteResult, IndependentDriveRouteOptions, IndependentTruckRouteOptions, IndependentWalkRouteOptions, IndependentRideRouteOptions, SelectIndependentRouteOptions, StartNaviWithIndependentPathOptions, ClearIndependentRouteOptions, MotorcycleRouteOptions, IndependentMotorcycleRouteOptions } from './types';
4
- export { NaviView, type NaviViewRef } from './ExpoGaodeMapNaviView';
4
+ export { ExpoGaodeMapNaviView, type ExpoGaodeMapNaviViewRef } from './ExpoGaodeMapNaviView';
5
5
  /**
6
6
  * 初始化导航模块(可选)
7
7
  */
package/build/index.js CHANGED
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.TravelStrategy = exports.TruckSize = exports.RideStrategy = exports.WalkStrategy = exports.DriveStrategy = exports.RouteType = exports.NaviView = void 0;
20
+ exports.TravelStrategy = exports.TruckSize = exports.RideStrategy = exports.WalkStrategy = exports.DriveStrategy = exports.RouteType = exports.ExpoGaodeMapNaviView = void 0;
21
21
  exports.initNavigation = initNavigation;
22
22
  exports.destroyAllCalculators = destroyAllCalculators;
23
23
  exports.calculateRoute = calculateRoute;
@@ -47,7 +47,7 @@ Object.defineProperty(exports, "TruckSize", { enumerable: true, get: function ()
47
47
  Object.defineProperty(exports, "TravelStrategy", { enumerable: true, get: function () { return types_1.TravelStrategy; } });
48
48
  // 导出官方导航界面组件
49
49
  var ExpoGaodeMapNaviView_1 = require("./ExpoGaodeMapNaviView");
50
- Object.defineProperty(exports, "NaviView", { enumerable: true, get: function () { return ExpoGaodeMapNaviView_1.NaviView; } });
50
+ Object.defineProperty(exports, "ExpoGaodeMapNaviView", { enumerable: true, get: function () { return ExpoGaodeMapNaviView_1.ExpoGaodeMapNaviView; } });
51
51
  /**
52
52
  * 初始化导航模块(可选)
53
53
  */
@@ -1,204 +1,5 @@
1
- /**
2
- * 高德地图原生模块
3
- * 提供 SDK 初始化、定位、权限管理等功能
4
- */
5
- import { NativeModule } from 'expo';
6
- import type { ExpoGaodeMapModuleEvents } from './ExpoGaodeMap.types';
7
- import type { LatLng, CoordinateType, Coordinates, ReGeocode, LocationMode, LocationAccuracy, LocationListener } from './types';
8
- /**
9
- * SDK 配置参数
10
- */
11
- export interface SDKConfig {
12
- /** Android 平台的高德地图 API Key */
13
- androidKey?: string;
14
- /** iOS 平台的高德地图 API Key */
15
- iosKey?: string;
16
- /** web api key:若要使用 web-api 相关功能,建议在初始化时提供 */
17
- webKey?: string;
18
- }
19
- /**
20
- * 权限状态
21
- */
22
- export interface PermissionStatus {
23
- /** 是否已授权 */
24
- granted: boolean;
25
- /** iOS 权限状态字符串 */
26
- status?: 'notDetermined' | 'restricted' | 'denied' | 'authorizedAlways' | 'authorizedWhenInUse' | 'unknown';
27
- /** Android 精确位置权限 */
28
- fineLocation?: boolean;
29
- /** Android 粗略位置权限 */
30
- coarseLocation?: boolean;
31
- }
32
- /**
33
- * 高德地图原生模块类声明
34
- */
35
- declare class ExpoGaodeMapModule extends NativeModule<ExpoGaodeMapModuleEvents> {
36
- /**
37
- * 更新隐私合规状态
38
- * 必须在用户同意隐私协议后调用
39
- * @param hasAgreed 用户是否已同意隐私协议
40
- */
41
- updatePrivacyCompliance(hasAgreed: boolean): void;
42
- /**
43
- * 初始化高德地图 SDK
44
- * @param config SDK 配置参数,包含 Android 和 iOS 的 API Key
45
- */
46
- initSDK(config: SDKConfig): void;
47
- /**
48
- * 获取高德地图 SDK 版本号
49
- * @returns SDK 版本字符串
50
- */
51
- getVersion(): string;
52
- /**
53
- * 开始连续定位
54
- * 启动后会持续接收位置更新,通过 onLocationUpdate 事件回调
55
- */
56
- start(): void;
57
- /**
58
- * 停止定位
59
- * 停止接收位置更新
60
- */
61
- stop(): void;
62
- /**
63
- * 检查是否正在定位
64
- * @returns Promise<boolean> 是否正在定位
65
- */
66
- isStarted(): Promise<boolean>;
67
- /**
68
- * 获取当前位置(单次定位)
69
- * @returns Promise<Coordinates | ReGeocode> 位置信息,包含坐标和可选的逆地理编码信息
70
- */
71
- getCurrentLocation(): Promise<Coordinates | ReGeocode>;
72
- /**
73
- * 坐标转换
74
- * 将其他坐标系的坐标转换为高德地图使用的 GCJ-02 坐标系
75
- * @param coordinate 需要转换的坐标
76
- * @param type 原坐标系类型
77
- * @returns Promise<LatLng> 转换后的 GCJ-02 坐标
78
- */
79
- coordinateConvert(coordinate: LatLng, type: CoordinateType): Promise<LatLng>;
80
- /**
81
- * 设置是否返回逆地理编码信息
82
- * @param isReGeocode true: 返回地址信息; false: 只返回坐标
83
- */
84
- setLocatingWithReGeocode(isReGeocode: boolean): void;
85
- /**
86
- * 设置定位模式(Android)
87
- * @param mode 定位模式:0-低功耗, 1-仅设备, 2-高精度
88
- */
89
- setLocationMode(mode: LocationMode): void;
90
- /**
91
- * 设置定位间隔(毫秒)
92
- * @param interval 定位间隔时间,单位毫秒,默认 2000ms
93
- */
94
- setInterval(interval: number): void;
95
- /**
96
- * 设置是否单次定位(Android)
97
- * @param isOnceLocation true: 单次定位; false: 连续定位
98
- */
99
- setOnceLocation(isOnceLocation: boolean): void;
100
- /**
101
- * 设置是否使用设备传感器(Android)
102
- * @param sensorEnable true: 使用传感器; false: 不使用
103
- */
104
- setSensorEnable(sensorEnable: boolean): void;
105
- /**
106
- * 设置是否允许 WiFi 扫描(Android)
107
- * @param wifiScan true: 允许; false: 不允许
108
- */
109
- setWifiScan(wifiScan: boolean): void;
110
- /**
111
- * 设置是否 GPS 优先(Android)
112
- * @param gpsFirst true: GPS 优先; false: 网络优先
113
- */
114
- setGpsFirst(gpsFirst: boolean): void;
115
- /**
116
- * 设置是否等待 WiFi 列表刷新(Android)
117
- * @param onceLocationLatest true: 等待; false: 不等待
118
- */
119
- setOnceLocationLatest(onceLocationLatest: boolean): void;
120
- /**
121
- * 设置逆地理编码语言
122
- * @param language 语言代码,如 "zh-CN", "en"
123
- */
124
- setGeoLanguage(language: string): void;
125
- /**
126
- * 设置是否使用缓存策略(Android)
127
- * @param locationCacheEnable true: 使用缓存; false: 不使用
128
- */
129
- setLocationCacheEnable(locationCacheEnable: boolean): void;
130
- /**
131
- * 设置网络请求超时时间(Android)
132
- * @param httpTimeOut 超时时间,单位毫秒
133
- */
134
- setHttpTimeOut(httpTimeOut: number): void;
135
- /**
136
- * 设置期望的定位精度(iOS)
137
- * @param accuracy 精度级别:0-最佳, 1-10米, 2-100米, 3-1公里, 4-3公里
138
- */
139
- setDesiredAccuracy(accuracy: LocationAccuracy): void;
140
- /**
141
- * 设置定位超时时间(秒)
142
- * @param timeout 超时时间,单位秒,默认 10 秒
143
- */
144
- setLocationTimeout(timeout: number): void;
145
- /**
146
- * 设置逆地理编码超时时间(秒)
147
- * @param timeout 超时时间,单位秒,默认 5 秒
148
- */
149
- setReGeocodeTimeout(timeout: number): void;
150
- /**
151
- * 设置距离过滤器(米)(iOS)
152
- * 只有移动超过指定距离才会更新位置
153
- * @param distance 距离阈值,单位米
154
- */
155
- setDistanceFilter(distance: number): void;
156
- /**
157
- * 设置是否自动暂停位置更新(iOS)
158
- * @param pauses true: 自动暂停; false: 不暂停
159
- */
160
- setPausesLocationUpdatesAutomatically(pauses: boolean): void;
161
- /**
162
- * 设置是否允许后台定位(iOS)
163
- * @param allows true: 允许; false: 不允许
164
- */
165
- setAllowsBackgroundLocationUpdates(allows: boolean): void;
166
- /**
167
- * 设置定位协议
168
- * @param protocol 协议类型
169
- */
170
- setLocationProtocol(protocol: string): void;
171
- /**
172
- * 开始更新设备方向(罗盘朝向)
173
- * 通过 onHeadingUpdate 事件接收方向更新
174
- * @platform ios
175
- */
176
- startUpdatingHeading(): void;
177
- /**
178
- * 停止更新设备方向
179
- * @platform ios
180
- */
181
- stopUpdatingHeading(): void;
182
- /**
183
- * 检查位置权限状态
184
- * @returns Promise<PermissionStatus> 权限状态
185
- */
186
- checkLocationPermission(): Promise<PermissionStatus>;
187
- /**
188
- * 请求位置权限
189
- * @returns Promise<PermissionStatus> 请求后的权限状态
190
- */
191
- requestLocationPermission(): Promise<PermissionStatus>;
192
- /**
193
- * 添加定位监听器(便捷方法)
194
- * 封装了 addListener,提供更简洁的 API
195
- * @param listener 定位回调函数
196
- * @returns 订阅对象,调用 remove() 取消监听
197
- */
198
- addLocationListener(listener: LocationListener): {
199
- remove: () => void;
200
- };
201
- }
1
+ import type { ExpoGaodeMapModule } from './types/native-module.types';
2
+ import { SDKConfig } from './types/common.types';
202
3
  /**
203
4
  * 获取最近一次 initSDK 的配置
204
5
  */