react-native-google-maps-plus 1.3.0-dev.8 → 1.3.0-dev.9

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 (44) hide show
  1. package/android/src/main/java/com/rngooglemapsplus/GoogleMapsViewImpl.kt +24 -78
  2. package/android/src/main/java/com/rngooglemapsplus/LocationHandler.kt +38 -36
  3. package/android/src/main/java/com/rngooglemapsplus/extensions/LocationExtension.kt +59 -0
  4. package/ios/GoogleMapViewImpl.swift +17 -63
  5. package/ios/MapMarkerBuilder.swift +2 -2
  6. package/ios/RNGoogleMapsPlusView.swift +6 -0
  7. package/ios/extensions/CLLocation+Extension.swift +27 -0
  8. package/lib/module/GoogleMapsPlus.js +7 -0
  9. package/lib/module/GoogleMapsPlus.js.map +1 -0
  10. package/lib/module/index.js +3 -5
  11. package/lib/module/index.js.map +1 -1
  12. package/lib/module/types.js.map +1 -1
  13. package/lib/nitrogen/generated/shared/json/RNGoogleMapsPlusViewConfig.json +44 -0
  14. package/lib/typescript/src/GoogleMapsPlus.d.ts +5 -0
  15. package/lib/typescript/src/GoogleMapsPlus.d.ts.map +1 -0
  16. package/lib/typescript/src/index.d.ts +3 -3
  17. package/lib/typescript/src/index.d.ts.map +1 -1
  18. package/lib/typescript/src/types.d.ts +25 -0
  19. package/lib/typescript/src/types.d.ts.map +1 -1
  20. package/nitrogen/generated/android/c++/JFunc_void_RNLocation.hpp +6 -0
  21. package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusViewSpec.cpp +8 -0
  22. package/nitrogen/generated/android/c++/JRNLocation.hpp +32 -2
  23. package/nitrogen/generated/android/c++/JRNLocationAndroid.hpp +82 -0
  24. package/nitrogen/generated/android/c++/JRNLocationIOS.hpp +77 -0
  25. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNLocation.kt +19 -1
  26. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNLocationAndroid.kt +50 -0
  27. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNLocationIOS.kt +47 -0
  28. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/views/HybridRNGoogleMapsPlusViewManager.kt +7 -2
  29. package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Bridge.hpp +36 -0
  30. package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Umbrella.hpp +6 -0
  31. package/nitrogen/generated/ios/c++/HybridRNGoogleMapsPlusViewSpecSwift.hpp +6 -0
  32. package/nitrogen/generated/ios/c++/views/HybridRNGoogleMapsPlusViewComponent.mm +8 -0
  33. package/nitrogen/generated/ios/swift/RNLocation.swift +92 -2
  34. package/nitrogen/generated/ios/swift/RNLocationAndroid.swift +215 -0
  35. package/nitrogen/generated/ios/swift/RNLocationIOS.swift +185 -0
  36. package/nitrogen/generated/shared/c++/RNLocation.hpp +33 -2
  37. package/nitrogen/generated/shared/c++/RNLocationAndroid.hpp +104 -0
  38. package/nitrogen/generated/shared/c++/RNLocationIOS.hpp +99 -0
  39. package/package.json +6 -13
  40. package/src/GoogleMapsPlus.tsx +20 -0
  41. package/src/index.tsx +6 -14
  42. package/src/types.ts +27 -0
  43. package/lib/module/package.json +0 -1
  44. package/lib/typescript/package.json +0 -1
@@ -2,7 +2,6 @@ package com.rngooglemapsplus
2
2
 
3
3
  import android.annotation.SuppressLint
4
4
  import android.graphics.Bitmap
5
- import android.location.Location
6
5
  import android.util.Base64
7
6
  import android.util.Size
8
7
  import android.widget.FrameLayout
@@ -40,6 +39,7 @@ import com.rngooglemapsplus.extensions.toLocationErrorCode
40
39
  import com.rngooglemapsplus.extensions.toRNIndoorBuilding
41
40
  import com.rngooglemapsplus.extensions.toRNIndoorLevel
42
41
  import com.rngooglemapsplus.extensions.toRnLatLng
42
+ import com.rngooglemapsplus.extensions.toRnLocation
43
43
  import java.io.ByteArrayInputStream
44
44
  import java.io.ByteArrayOutputStream
45
45
  import java.io.File
@@ -65,6 +65,7 @@ class GoogleMapsViewImpl(
65
65
  LifecycleEventListener {
66
66
  private var initialized = false
67
67
  private var mapReady = false
68
+ private var destroyed = false
68
69
  private var googleMap: GoogleMap? = null
69
70
  private var mapView: MapView? = null
70
71
 
@@ -83,7 +84,6 @@ class GoogleMapsViewImpl(
83
84
  private val kmlLayersById = mutableMapOf<String, KmlLayer>()
84
85
 
85
86
  private var cameraMoveReason = -1
86
- private var lastSubmittedLocation: Location? = null
87
87
  private var lastSubmittedCameraPosition: CameraPosition? = null
88
88
 
89
89
  init {
@@ -143,8 +143,8 @@ class GoogleMapsViewImpl(
143
143
  googleMap?.setOnMapClickListener(this@GoogleMapsViewImpl)
144
144
  googleMap?.setOnMarkerDragListener(this@GoogleMapsViewImpl)
145
145
  }
146
+ applyProps()
146
147
  initLocationCallbacks()
147
- applyPending()
148
148
  mapReady = true
149
149
  onMapReady?.invoke(true)
150
150
  }
@@ -241,18 +241,7 @@ class GoogleMapsViewImpl(
241
241
 
242
242
  fun initLocationCallbacks() {
243
243
  locationHandler.onUpdate = { location ->
244
- // / only the coordinated are relevant right now
245
- if (lastSubmittedLocation?.latitude != location.latitude || lastSubmittedLocation?.longitude != location.longitude ||
246
- lastSubmittedLocation?.bearing != location.bearing
247
- ) {
248
- onLocationUpdate?.invoke(
249
- RNLocation(
250
- RNLatLng(location.latitude, location.longitude),
251
- location.bearing.toDouble(),
252
- ),
253
- )
254
- }
255
- lastSubmittedLocation = location
244
+ onLocationUpdate?.invoke(location.toRnLocation())
256
245
  }
257
246
 
258
247
  locationHandler.onError = { error ->
@@ -261,65 +250,18 @@ class GoogleMapsViewImpl(
261
250
  locationHandler.start()
262
251
  }
263
252
 
264
- fun applyPending() {
265
- onUi {
266
- mapPadding?.let {
267
- googleMap?.setPadding(
268
- it.left.dpToPx().toInt(),
269
- it.top.dpToPx().toInt(),
270
- it.right.dpToPx().toInt(),
271
- it.bottom.dpToPx().toInt(),
272
- )
273
- }
274
-
275
- uiSettings?.let { v ->
276
- googleMap?.uiSettings?.apply {
277
- v.allGesturesEnabled?.let { setAllGesturesEnabled(it) }
278
- v.compassEnabled?.let { isCompassEnabled = it }
279
- v.indoorLevelPickerEnabled?.let { isIndoorLevelPickerEnabled = it }
280
- v.mapToolbarEnabled?.let { isMapToolbarEnabled = it }
281
- v.myLocationButtonEnabled?.let {
282
- googleMap?.setLocationSource(locationHandler)
283
- isMyLocationButtonEnabled = it
284
- }
285
- v.rotateEnabled?.let { isRotateGesturesEnabled = it }
286
- v.scrollEnabled?.let { isScrollGesturesEnabled = it }
287
- v.scrollDuringRotateOrZoomEnabled?.let {
288
- isScrollGesturesEnabledDuringRotateOrZoom = it
289
- }
290
- v.tiltEnabled?.let { isTiltGesturesEnabled = it }
291
- v.zoomControlsEnabled?.let { isZoomControlsEnabled = it }
292
- v.zoomGesturesEnabled?.let { isZoomGesturesEnabled = it }
293
- }
294
- }
295
-
296
- buildingEnabled?.let {
297
- googleMap?.isBuildingsEnabled = it
298
- }
299
- trafficEnabled?.let {
300
- googleMap?.isTrafficEnabled = it
301
- }
302
- indoorEnabled?.let {
303
- googleMap?.isIndoorEnabled = it
304
- }
305
- googleMap?.setMapStyle(customMapStyle)
306
- mapType?.let {
307
- googleMap?.mapType = it
308
- }
309
- userInterfaceStyle?.let {
310
- googleMap?.mapColorScheme = it
311
- }
312
- mapZoomConfig?.let {
313
- googleMap?.setMinZoomPreference(it.min?.toFloat() ?: 2.0f)
314
- googleMap?.setMaxZoomPreference(it.max?.toFloat() ?: 21.0f)
315
- }
316
- }
317
-
318
- locationConfig?.let {
319
- locationHandler.priority = it.android?.priority?.toGooglePriority()
320
- locationHandler.interval = it.android?.interval?.toLong()
321
- locationHandler.minUpdateInterval = it.android?.minUpdateInterval?.toLong()
322
- }
253
+ fun applyProps() {
254
+ mapPadding = mapPadding
255
+ uiSettings = uiSettings
256
+ myLocationEnabled = myLocationEnabled
257
+ buildingEnabled = buildingEnabled
258
+ trafficEnabled = trafficEnabled
259
+ indoorEnabled = indoorEnabled
260
+ customMapStyle = customMapStyle
261
+ mapType = mapType
262
+ userInterfaceStyle = userInterfaceStyle
263
+ mapZoomConfig = mapZoomConfig
264
+ locationConfig = locationConfig
323
265
 
324
266
  if (pendingMarkers.isNotEmpty()) {
325
267
  pendingMarkers.forEach { (id, opts) ->
@@ -480,9 +422,11 @@ class GoogleMapsViewImpl(
480
422
  var locationConfig: RNLocationConfig? = null
481
423
  set(value) {
482
424
  field = value
483
- locationHandler.priority = value?.android?.priority?.toGooglePriority()
484
- locationHandler.interval = value?.android?.interval?.toLong()
485
- locationHandler.minUpdateInterval = value?.android?.minUpdateInterval?.toLong()
425
+ locationHandler.updateConfig(
426
+ value?.android?.priority?.toGooglePriority(),
427
+ value?.android?.interval?.toLong(),
428
+ value?.android?.minUpdateInterval?.toLong(),
429
+ )
486
430
  }
487
431
 
488
432
  var onMapError: ((RNMapErrorCode) -> Unit)? = null
@@ -919,7 +863,7 @@ class GoogleMapsViewImpl(
919
863
  onUi {
920
864
  heatmapsById.values.forEach { it.remove() }
921
865
  }
922
- circlesById.clear()
866
+ heatmapsById.clear()
923
867
  pendingHeatmaps.clear()
924
868
  }
925
869
 
@@ -968,6 +912,8 @@ class GoogleMapsViewImpl(
968
912
  }
969
913
 
970
914
  fun destroyInternal() {
915
+ if (destroyed) return
916
+ destroyed = true
971
917
  onUi {
972
918
  locationHandler.stop()
973
919
  markerBuilder.cancelAllJobs()
@@ -35,30 +35,28 @@ class LocationHandler(
35
35
  private var listener: LocationSource.OnLocationChangedListener? = null
36
36
  private var locationRequest: LocationRequest? = null
37
37
  private var locationCallback: LocationCallback? = null
38
-
39
- var priority: Int? = PRIORITY_DEFAULT
40
- set(value) {
41
- field = value ?: PRIORITY_DEFAULT
42
- start()
43
- }
44
-
45
- var interval: Long? = INTERVAL_DEFAULT
46
- set(value) {
47
- field = value ?: INTERVAL_DEFAULT
48
- buildLocationRequest()
49
- }
50
-
51
- var minUpdateInterval: Long? = MIN_UPDATE_INTERVAL
52
- set(value) {
53
- field = value ?: MIN_UPDATE_INTERVAL
54
- buildLocationRequest()
55
- }
38
+ private var priority: Int = PRIORITY_DEFAULT
39
+ private var interval: Long = INTERVAL_DEFAULT
40
+ private var minUpdateInterval: Long = MIN_UPDATE_INTERVAL
41
+ private var lastSubmittedLocation: Location? = null
42
+ private var isActive = false
56
43
 
57
44
  var onUpdate: ((Location) -> Unit)? = null
58
45
  var onError: ((RNLocationErrorCode) -> Unit)? = null
59
46
 
60
47
  init {
61
- buildLocationRequest()
48
+ buildLocationRequest(priority, interval, minUpdateInterval)
49
+ }
50
+
51
+ fun updateConfig(
52
+ priority: Int? = null,
53
+ interval: Long? = null,
54
+ minUpdateInterval: Long? = null,
55
+ ) {
56
+ this.priority = priority ?: PRIORITY_DEFAULT
57
+ this.interval = interval ?: INTERVAL_DEFAULT
58
+ this.minUpdateInterval = minUpdateInterval ?: MIN_UPDATE_INTERVAL
59
+ buildLocationRequest(this.priority, this.interval, this.minUpdateInterval)
62
60
  }
63
61
 
64
62
  fun showLocationDialog() {
@@ -108,11 +106,11 @@ class LocationHandler(
108
106
  }
109
107
 
110
108
  @Suppress("deprecation")
111
- private fun buildLocationRequest() {
112
- val priority = priority ?: Priority.PRIORITY_BALANCED_POWER_ACCURACY
113
- val interval = interval ?: INTERVAL_DEFAULT
114
- val minUpdateInterval = minUpdateInterval ?: MIN_UPDATE_INTERVAL
115
-
109
+ private fun buildLocationRequest(
110
+ priority: Int,
111
+ interval: Long,
112
+ minUpdateInterval: Long,
113
+ ) {
116
114
  locationRequest =
117
115
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
118
116
  LocationRequest
@@ -126,11 +124,13 @@ class LocationHandler(
126
124
  .setInterval(interval)
127
125
  .setFastestInterval(minUpdateInterval)
128
126
  }
129
- restartLocationUpdates()
130
127
  }
131
128
 
132
- private fun restartLocationUpdates() {
133
- stop()
129
+ @SuppressLint("MissingPermission")
130
+ fun start() {
131
+ if (isActive) return
132
+ isActive = true
133
+
134
134
  val playServicesStatus =
135
135
  GoogleApiAvailability
136
136
  .getInstance()
@@ -139,17 +139,13 @@ class LocationHandler(
139
139
  onError?.invoke(RNLocationErrorCode.PLAY_SERVICE_NOT_AVAILABLE)
140
140
  return
141
141
  }
142
- start()
143
- }
144
-
145
- @SuppressLint("MissingPermission")
146
- fun start() {
147
142
  try {
148
143
  fusedLocationClientProviderClient.lastLocation
149
144
  .addOnSuccessListener(
150
145
  OnSuccessListener { location ->
151
- if (location != null) {
146
+ if (location != null && location != lastSubmittedLocation) {
152
147
  onUpdate?.invoke(location)
148
+ lastSubmittedLocation = location
153
149
  }
154
150
  },
155
151
  ).addOnFailureListener { e ->
@@ -161,8 +157,11 @@ class LocationHandler(
161
157
  override fun onLocationResult(locationResult: LocationResult) {
162
158
  val location = locationResult.lastLocation
163
159
  if (location != null) {
164
- listener?.onLocationChanged(location)
165
- onUpdate?.invoke(location)
160
+ if (location != lastSubmittedLocation) {
161
+ lastSubmittedLocation = location
162
+ listener?.onLocationChanged(location)
163
+ onUpdate?.invoke(location)
164
+ }
166
165
  } else {
167
166
  onError?.invoke(RNLocationErrorCode.POSITION_UNAVAILABLE)
168
167
  }
@@ -186,9 +185,11 @@ class LocationHandler(
186
185
  }
187
186
 
188
187
  fun stop() {
189
- listener = null
188
+ if (!isActive) return
189
+ isActive = false
190
190
  if (locationCallback != null) {
191
191
  fusedLocationClientProviderClient.removeLocationUpdates(locationCallback!!)
192
+ fusedLocationClientProviderClient.flushLocations()
192
193
  locationCallback = null
193
194
  }
194
195
  }
@@ -199,6 +200,7 @@ class LocationHandler(
199
200
  }
200
201
 
201
202
  override fun deactivate() {
203
+ listener = null
202
204
  stop()
203
205
  }
204
206
  }
@@ -0,0 +1,59 @@
1
+ package com.rngooglemapsplus.extensions
2
+
3
+ import android.location.Location
4
+ import android.os.Build
5
+ import com.rngooglemapsplus.RNLatLng
6
+ import com.rngooglemapsplus.RNLocation
7
+ import com.rngooglemapsplus.RNLocationAndroid
8
+
9
+ fun Location.toRnLocation(): RNLocation =
10
+ RNLocation(
11
+ center = RNLatLng(latitude, longitude),
12
+ altitude = altitude,
13
+ accuracy = accuracy.toDouble(),
14
+ bearing = bearing.toDouble(),
15
+ speed = speed.toDouble(),
16
+ time = time.toDouble(),
17
+ android =
18
+ RNLocationAndroid(
19
+ provider = provider,
20
+ elapsedRealtimeNanos = elapsedRealtimeNanos.toDouble(),
21
+ bearingAccuracyDegrees =
22
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
23
+ bearingAccuracyDegrees.toDouble()
24
+ } else {
25
+ null
26
+ },
27
+ speedAccuracyMetersPerSecond =
28
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
29
+ speedAccuracyMetersPerSecond.toDouble()
30
+ } else {
31
+ null
32
+ },
33
+ verticalAccuracyMeters =
34
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
35
+ verticalAccuracyMeters.toDouble()
36
+ } else {
37
+ null
38
+ },
39
+ mslAltitudeMeters =
40
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
41
+ mslAltitudeMeters
42
+ } else {
43
+ null
44
+ },
45
+ mslAltitudeAccuracyMeters =
46
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
47
+ mslAltitudeAccuracyMeters.toDouble()
48
+ } else {
49
+ null
50
+ },
51
+ isMock =
52
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
53
+ isMock
54
+ } else {
55
+ isFromMockProvider
56
+ },
57
+ ),
58
+ ios = null,
59
+ )
@@ -11,6 +11,7 @@ GMSIndoorDisplayDelegate {
11
11
  private var mapView: GMSMapView?
12
12
  private var initialized = false
13
13
  private var mapReady = false
14
+ private var deInitialized = false
14
15
 
15
16
  private var pendingMarkers: [(id: String, marker: GMSMarker)] = []
16
17
  private var pendingPolylines: [(id: String, polyline: GMSPolyline)] = []
@@ -28,7 +29,6 @@ GMSIndoorDisplayDelegate {
28
29
 
29
30
  private var cameraMoveReasonIsGesture: Bool = false
30
31
  private var lastSubmittedCameraPosition: GMSCameraPosition?
31
- private var lastSubmittedLocation: CLLocation?
32
32
 
33
33
  init(
34
34
  frame: CGRect = .zero,
@@ -72,8 +72,8 @@ GMSIndoorDisplayDelegate {
72
72
  mapView?.autoresizingMask = [.flexibleWidth, .flexibleHeight]
73
73
  mapView?.paddingAdjustmentBehavior = .never
74
74
  mapView.map { addSubview($0) }
75
+ applyProps()
75
76
  initLocationCallbacks()
76
- applyPending()
77
77
  onMapReady?(true)
78
78
  mapReady = true
79
79
  }
@@ -82,18 +82,7 @@ GMSIndoorDisplayDelegate {
82
82
  private func initLocationCallbacks() {
83
83
  locationHandler.onUpdate = { [weak self] loc in
84
84
  guard let self = self else { return }
85
- if self.lastSubmittedLocation?.coordinate.latitude
86
- != loc.coordinate.latitude
87
- || self.lastSubmittedLocation?.coordinate.longitude
88
- != loc.coordinate.longitude {
89
- self.onLocationUpdate?(
90
- RNLocation(
91
- loc.coordinate.toRNLatLng(),
92
- loc.course
93
- )
94
- )
95
- }
96
- self.lastSubmittedLocation = loc
85
+ self.onLocationUpdate?(loc.toRnLocation())
97
86
  }
98
87
  locationHandler.onError = { [weak self] error in
99
88
  self?.onLocationError?(error)
@@ -102,55 +91,19 @@ GMSIndoorDisplayDelegate {
102
91
  }
103
92
 
104
93
  @MainActor
105
- private func applyPending() {
106
- mapPadding.map {
107
- mapView?.padding = UIEdgeInsets(
108
- top: $0.top,
109
- left: $0.left,
110
- bottom: $0.bottom,
111
- right: $0.right
112
- )
113
- }
94
+ private func applyProps() {
95
+ ({ self.uiSettings = self.uiSettings })()
96
+ ({ self.mapPadding = self.mapPadding })()
97
+ ({ self.myLocationEnabled = self.myLocationEnabled })()
98
+ ({ self.buildingEnabled = self.buildingEnabled })()
99
+ ({ self.trafficEnabled = self.trafficEnabled })()
100
+ ({ self.indoorEnabled = self.indoorEnabled })()
101
+ ({ self.customMapStyle = self.customMapStyle })()
102
+ ({ self.mapType = self.mapType })()
103
+ ({ self.userInterfaceStyle = self.userInterfaceStyle })()
104
+ ({ self.mapZoomConfig = self.mapZoomConfig })()
105
+ ({ self.locationConfig = self.locationConfig })()
114
106
 
115
- if let v = uiSettings {
116
- v.allGesturesEnabled.map { mapView?.settings.setAllGesturesEnabled($0) }
117
- v.compassEnabled.map { mapView?.settings.compassButton = $0 }
118
- v.indoorLevelPickerEnabled.map { mapView?.settings.indoorPicker = $0 }
119
- v.mapToolbarEnabled.map { _ in /* not supported */ }
120
- v.myLocationButtonEnabled.map { mapView?.settings.myLocationButton = $0 }
121
- v.rotateEnabled.map { mapView?.settings.rotateGestures = $0 }
122
- v.scrollEnabled.map { mapView?.settings.scrollGestures = $0 }
123
- v.scrollDuringRotateOrZoomEnabled.map {
124
- mapView?.settings.allowScrollGesturesDuringRotateOrZoom = $0
125
- }
126
- v.tiltEnabled.map { mapView?.settings.tiltGestures = $0 }
127
- v.zoomControlsEnabled.map { _ in /* not supported */ }
128
- v.zoomGesturesEnabled.map { mapView?.settings.zoomGestures = $0 }
129
- }
130
-
131
- myLocationEnabled.map { mapView?.isMyLocationEnabled = $0 }
132
- buildingEnabled.map { mapView?.isBuildingsEnabled = $0 }
133
- trafficEnabled.map { mapView?.isTrafficEnabled = $0 }
134
- indoorEnabled.map {
135
- mapView?.isIndoorEnabled = $0
136
- mapView?.indoorDisplay.delegate = $0 == true ? self : nil
137
- }
138
- customMapStyle.map { mapView?.mapStyle = $0 }
139
- mapType.map { mapView?.mapType = $0 }
140
- userInterfaceStyle.map { mapView?.overrideUserInterfaceStyle = $0 }
141
-
142
- mapZoomConfig.map {
143
- mapView?.setMinZoom(
144
- Float($0.min ?? 2),
145
- maxZoom: Float($0.max ?? 21)
146
- )
147
- }
148
-
149
- locationConfig.map {
150
- locationHandler.desiredAccuracy =
151
- $0.ios?.desiredAccuracy?.toCLLocationAccuracy
152
- locationHandler.distanceFilterMeters = $0.ios?.distanceFilterMeters
153
- }
154
107
  if !pendingMarkers.isEmpty {
155
108
  pendingMarkers.forEach { addMarkerInternal(id: $0.id, marker: $0.marker) }
156
109
  pendingMarkers.removeAll()
@@ -435,7 +388,6 @@ GMSIndoorDisplayDelegate {
435
388
  return
436
389
  }
437
390
 
438
- // Rückgabe
439
391
  if resultIsFile {
440
392
  let filename =
441
393
  "map_snapshot_\(Int(Date().timeIntervalSince1970)).\(format)"
@@ -660,6 +612,8 @@ GMSIndoorDisplayDelegate {
660
612
  }
661
613
 
662
614
  func deinitInternal() {
615
+ guard !deInitialized else { return }
616
+ deInitialized = true
663
617
  onMain {
664
618
  self.locationHandler.stop()
665
619
  self.markerBuilder.cancelAllIconTasks()
@@ -84,7 +84,7 @@ final class MapMarkerBuilder {
84
84
  m.tracksViewChanges = true
85
85
  m.icon = img
86
86
 
87
- if prev.anchor?.x != next.anchor?.x || prev.anchor?.y != next.anchor?.y{
87
+ if prev.anchor?.x != next.anchor?.x || prev.anchor?.y != next.anchor?.y {
88
88
  m.groundAnchor = CGPoint(
89
89
  x: next.anchor?.x ?? 0.5,
90
90
  y: next.anchor?.y ?? 1
@@ -104,7 +104,7 @@ final class MapMarkerBuilder {
104
104
  }
105
105
  }
106
106
  } else {
107
- if prev.anchor?.x != next.anchor?.x || prev.anchor?.y != next.anchor?.y{
107
+ if prev.anchor?.x != next.anchor?.x || prev.anchor?.y != next.anchor?.y {
108
108
  m.groundAnchor = CGPoint(
109
109
  x: next.anchor?.x ?? 0.5,
110
110
  y: next.anchor?.y ?? 1
@@ -30,6 +30,7 @@ final class RNGoogleMapsPlusView: HybridRNGoogleMapsPlusViewSpec {
30
30
  )
31
31
  }
32
32
 
33
+ @MainActor
33
34
  func afterUpdate() {
34
35
  if !propsInitialized {
35
36
  propsInitialized = true
@@ -45,6 +46,11 @@ final class RNGoogleMapsPlusView: HybridRNGoogleMapsPlusViewSpec {
45
46
  }
46
47
  }
47
48
 
49
+ @MainActor
50
+ func dispose() {
51
+ impl.deinitInternal()
52
+ }
53
+
48
54
  @MainActor
49
55
  var initialProps: RNInitialProps? {
50
56
  didSet {
@@ -0,0 +1,27 @@
1
+ import CoreLocation
2
+
3
+ extension CLLocation {
4
+ func toRnLocation() -> RNLocation {
5
+ return RNLocation(
6
+ center: RNLatLng(
7
+ latitude: coordinate.latitude,
8
+ longitude: coordinate.longitude
9
+ ),
10
+ altitude: altitude,
11
+ accuracy: horizontalAccuracy,
12
+ bearing: course,
13
+ speed: speed,
14
+ time: timestamp.timeIntervalSince1970 * 1000,
15
+ android: nil,
16
+ ios: RNLocationIOS(
17
+ horizontalAccuracy: horizontalAccuracy,
18
+ verticalAccuracy: verticalAccuracy,
19
+ speedAccuracy: speedAccuracy,
20
+ courseAccuracy: courseAccuracy,
21
+ floor: floor.map { Double($0.level)},
22
+ isFromMockProvider: false,
23
+ timestamp: timestamp.timeIntervalSince1970 * 1000
24
+ )
25
+ )
26
+ }
27
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ import { getHostComponent, NitroModules } from 'react-native-nitro-modules';
4
+ import ViewConfig from '../nitrogen/generated/shared/json/RNGoogleMapsPlusViewConfig.json' with { type: 'json' };
5
+ export const GoogleMapsView = getHostComponent('RNGoogleMapsPlusView', () => ViewConfig);
6
+ export const GoogleMapsModule = NitroModules.createHybridObject('RNGoogleMapsPlusModule');
7
+ //# sourceMappingURL=GoogleMapsPlus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getHostComponent","NitroModules","ViewConfig","type","GoogleMapsView","GoogleMapsModule","createHybridObject"],"sourceRoot":"../../src","sources":["GoogleMapsPlus.tsx"],"mappings":";;AAAA,SAASA,gBAAgB,EAAEC,YAAY,QAAQ,4BAA4B;AAE3E,OAAOC,UAAU,MAAM,mEAAmE,QAAQC,IAAI,EAAE,MAAM;AAS9G,OAAO,MAAMC,cAAc,GAAGJ,gBAAgB,CAG5C,sBAAsB,EAAE,MAAME,UAAU,CAAC;AAE3C,OAAO,MAAMG,gBAAgB,GAC3BJ,YAAY,CAACK,kBAAkB,CAC7B,wBACF,CAAC","ignoreList":[]}
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import { getHostComponent, NitroModules } from 'react-native-nitro-modules';
4
- import ViewConfig from '../nitrogen/generated/shared/json/RNGoogleMapsPlusViewConfig.json';
5
- export * from "./types.js";
6
- export const GoogleMapsView = getHostComponent('RNGoogleMapsPlusView', () => ViewConfig);
7
- export const GoogleMapsModule = NitroModules.createHybridObject('RNGoogleMapsPlusModule');
3
+ import { GoogleMapsView, GoogleMapsModule } from './GoogleMapsPlus';
4
+ export * from './types';
5
+ export { GoogleMapsView, GoogleMapsModule };
8
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getHostComponent","NitroModules","ViewConfig","GoogleMapsView","GoogleMapsModule","createHybridObject"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,gBAAgB,EAAEC,YAAY,QAAQ,4BAA4B;AAE3E,OAAOC,UAAU,MAAM,mEAAmE;AAS1F,cAAc,YAAS;AAIvB,OAAO,MAAMC,cAAc,GAAGH,gBAAgB,CAG5C,sBAAsB,EAAE,MAAME,UAAU,CAAC;AAE3C,OAAO,MAAME,gBAAgB,GAC3BH,YAAY,CAACI,kBAAkB,CAC7B,wBACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["GoogleMapsView","GoogleMapsModule"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,cAAc,EAAEC,gBAAgB,QAAQ,kBAAkB;AAOnE,cAAc,SAAS;AAQvB,SAASD,cAAc,EAAEC,gBAAgB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["RNAndroidLocationPriority","RNIOSLocationAccuracy","RNAndroidLocationPermissionResult","RNIOSPermissionResult","RNLocationErrorCode","RNMapErrorCode"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":";;AAgEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;;AA4JA,WAAYA,yBAAyB,0BAAzBA,yBAAyB;EAAzBA,yBAAyB,CAAzBA,yBAAyB;EAAzBA,yBAAyB,CAAzBA,yBAAyB;EAAzBA,yBAAyB,CAAzBA,yBAAyB;EAAzBA,yBAAyB,CAAzBA,yBAAyB;EAAA,OAAzBA,yBAAyB;AAAA;AAYrC,WAAYC,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAYjC,WAAYC,iCAAiC,0BAAjCA,iCAAiC;EAAjCA,iCAAiC,CAAjCA,iCAAiC;EAAjCA,iCAAiC,CAAjCA,iCAAiC;EAAjCA,iCAAiC,CAAjCA,iCAAiC;EAAA,OAAjCA,iCAAiC;AAAA;AAM7C,WAAYC,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAUjC,WAAYC,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA;AAS/B,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["RNAndroidLocationPriority","RNIOSLocationAccuracy","RNAndroidLocationPermissionResult","RNIOSPermissionResult","RNLocationErrorCode","RNMapErrorCode"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":";;AAgEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;;AA6JA,WAAYA,yBAAyB,0BAAzBA,yBAAyB;EAAzBA,yBAAyB,CAAzBA,yBAAyB;EAAzBA,yBAAyB,CAAzBA,yBAAyB;EAAzBA,yBAAyB,CAAzBA,yBAAyB;EAAzBA,yBAAyB,CAAzBA,yBAAyB;EAAA,OAAzBA,yBAAyB;AAAA;AAYrC,WAAYC,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAYjC,WAAYC,iCAAiC,0BAAjCA,iCAAiC;EAAjCA,iCAAiC,CAAjCA,iCAAiC;EAAjCA,iCAAiC,CAAjCA,iCAAiC;EAAjCA,iCAAiC,CAAjCA,iCAAiC;EAAA,OAAjCA,iCAAiC;AAAA;AAM7C,WAAYC,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAoCjC,WAAYC,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA;AAS/B,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA","ignoreList":[]}
@@ -0,0 +1,44 @@
1
+ {
2
+ "uiViewClassName": "RNGoogleMapsPlusView",
3
+ "supportsRawText": false,
4
+ "bubblingEventTypes": {},
5
+ "directEventTypes": {},
6
+ "validAttributes": {
7
+ "initialProps": true,
8
+ "uiSettings": true,
9
+ "myLocationEnabled": true,
10
+ "buildingEnabled": true,
11
+ "trafficEnabled": true,
12
+ "indoorEnabled": true,
13
+ "customMapStyle": true,
14
+ "userInterfaceStyle": true,
15
+ "mapZoomConfig": true,
16
+ "mapPadding": true,
17
+ "mapType": true,
18
+ "markers": true,
19
+ "polygons": true,
20
+ "polylines": true,
21
+ "circles": true,
22
+ "heatmaps": true,
23
+ "kmlLayers": true,
24
+ "locationConfig": true,
25
+ "onMapError": true,
26
+ "onMapReady": true,
27
+ "onLocationUpdate": true,
28
+ "onLocationError": true,
29
+ "onMapPress": true,
30
+ "onMarkerPress": true,
31
+ "onPolylinePress": true,
32
+ "onPolygonPress": true,
33
+ "onCirclePress": true,
34
+ "onMarkerDragStart": true,
35
+ "onMarkerDrag": true,
36
+ "onMarkerDragEnd": true,
37
+ "onIndoorBuildingFocused": true,
38
+ "onIndoorLevelActivated": true,
39
+ "onCameraChangeStart": true,
40
+ "onCameraChange": true,
41
+ "onCameraChangeComplete": true,
42
+ "hybridRef": true
43
+ }
44
+ }
@@ -0,0 +1,5 @@
1
+ import type { RNGoogleMapsPlusViewMethods, RNGoogleMapsPlusViewProps } from './RNGoogleMapsPlusView.nitro.js';
2
+ import type { RNGoogleMapsPlusModule } from './RNGoogleMapsPlusModule.nitro.js';
3
+ export declare const GoogleMapsView: import("react-native-nitro-modules").ReactNativeView<RNGoogleMapsPlusViewProps, RNGoogleMapsPlusViewMethods>;
4
+ export declare const GoogleMapsModule: RNGoogleMapsPlusModule;
5
+ //# sourceMappingURL=GoogleMapsPlus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GoogleMapsPlus.d.ts","sourceRoot":"","sources":["../../../src/GoogleMapsPlus.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEhF,eAAO,MAAM,cAAc,8GAGgB,CAAC;AAE5C,eAAO,MAAM,gBAAgB,wBAG1B,CAAC"}
@@ -1,7 +1,7 @@
1
+ import { GoogleMapsView, GoogleMapsModule } from './GoogleMapsPlus';
1
2
  import type { RNGoogleMapsPlusViewMethods, RNGoogleMapsPlusViewProps } from './RNGoogleMapsPlusView.nitro';
2
3
  import type { RNGoogleMapsPlusModule } from './RNGoogleMapsPlusModule.nitro';
3
4
  export * from './types';
4
- export type { RNGoogleMapsPlusViewMethods, RNGoogleMapsPlusViewProps };
5
- export declare const GoogleMapsView: import("react-native-nitro-modules").ReactNativeView<RNGoogleMapsPlusViewProps, RNGoogleMapsPlusViewMethods>;
6
- export declare const GoogleMapsModule: RNGoogleMapsPlusModule;
5
+ export type { RNGoogleMapsPlusViewMethods, RNGoogleMapsPlusViewProps, RNGoogleMapsPlusModule, };
6
+ export { GoogleMapsView, GoogleMapsModule };
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAE7E,cAAc,SAAS,CAAC;AAExB,YAAY,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,CAAC;AAEvE,eAAO,MAAM,cAAc,8GAGgB,CAAC;AAE5C,eAAO,MAAM,gBAAgB,wBAG1B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,KAAK,EACV,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAE7E,cAAc,SAAS,CAAC;AAExB,YAAY,EACV,2BAA2B,EAC3B,yBAAyB,EACzB,sBAAsB,GACvB,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,CAAC"}