react-native-google-maps-plus 1.11.0-dev.1 → 1.11.1-dev.1
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.
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/rngooglemapsplus/GoogleMapsViewImpl.kt +1 -0
- package/android/src/main/java/com/rngooglemapsplus/MapLifecycleEventObserver.kt +16 -4
- package/android/src/main/java/com/rngooglemapsplus/MapMarkerBuilder.kt +3 -1
- package/android/src/main/java/com/rngooglemapsplus/RNGoogleMapsPlusView.kt +16 -8
- package/android/src/main/java/com/rngooglemapsplus/extensions/IntExtension.kt +14 -7
- package/android/src/main/java/com/rngooglemapsplus/extensions/LocationExtension.kt +30 -10
- package/android/src/main/java/com/rngooglemapsplus/extensions/StringExtension.kt +17 -5
- package/android/src/main/java/com/rngooglemapsplus/extensions/ThrowableExtension.kt +11 -5
- package/package.json +1 -1
|
@@ -6,4 +6,4 @@ RNGoogleMapsPlus_ndkVersion=27.1.12297006
|
|
|
6
6
|
RNGoogleMapsPlus_googlePlayServicesBaseVersion=18.10.0
|
|
7
7
|
RNGoogleMapsPlus_googlePlayServicesMapsVersion=20.0.0
|
|
8
8
|
RNGoogleMapsPlus_googlePlayServicesLocationVersion=21.3.0
|
|
9
|
-
RNGoogleMapsPlus_mapsUtilsVersion=
|
|
9
|
+
RNGoogleMapsPlus_mapsUtilsVersion=4.0.0
|
|
@@ -58,8 +58,14 @@ class MapLifecycleEventObserver(
|
|
|
58
58
|
|
|
59
59
|
private fun invokeEvent(event: Lifecycle.Event) {
|
|
60
60
|
when (event) {
|
|
61
|
-
Lifecycle.Event.ON_CREATE ->
|
|
62
|
-
|
|
61
|
+
Lifecycle.Event.ON_CREATE -> {
|
|
62
|
+
mapView?.onCreate(Bundle())
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
Lifecycle.Event.ON_START -> {
|
|
66
|
+
mapView?.onStart()
|
|
67
|
+
}
|
|
68
|
+
|
|
63
69
|
Lifecycle.Event.ON_RESUME -> {
|
|
64
70
|
locationHandler.start()
|
|
65
71
|
mapView?.onResume()
|
|
@@ -70,8 +76,14 @@ class MapLifecycleEventObserver(
|
|
|
70
76
|
locationHandler.stop()
|
|
71
77
|
}
|
|
72
78
|
|
|
73
|
-
Lifecycle.Event.ON_STOP ->
|
|
74
|
-
|
|
79
|
+
Lifecycle.Event.ON_STOP -> {
|
|
80
|
+
mapView?.onStop()
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
Lifecycle.Event.ON_DESTROY -> {
|
|
84
|
+
mapView?.onDestroy()
|
|
85
|
+
}
|
|
86
|
+
|
|
75
87
|
Lifecycle.Event.ON_ANY -> {}
|
|
76
88
|
}
|
|
77
89
|
currentState = event.targetState
|
|
@@ -150,7 +150,7 @@ class RNGoogleMapsPlusView(
|
|
|
150
150
|
nextById.forEach { (id, next) ->
|
|
151
151
|
val prev = prevById[id]
|
|
152
152
|
when {
|
|
153
|
-
prev == null ->
|
|
153
|
+
prev == null -> {
|
|
154
154
|
markerBuilder.buildIconAsync(next) { icon ->
|
|
155
155
|
view.addMarker(
|
|
156
156
|
id,
|
|
@@ -161,11 +161,13 @@ class RNGoogleMapsPlusView(
|
|
|
161
161
|
),
|
|
162
162
|
)
|
|
163
163
|
}
|
|
164
|
+
}
|
|
164
165
|
|
|
165
|
-
!prev.markerEquals(next) ->
|
|
166
|
+
!prev.markerEquals(next) -> {
|
|
166
167
|
view.updateMarker(id) { marker ->
|
|
167
168
|
markerBuilder.update(prev, next, marker)
|
|
168
169
|
}
|
|
170
|
+
}
|
|
169
171
|
}
|
|
170
172
|
}
|
|
171
173
|
}
|
|
@@ -183,13 +185,15 @@ class RNGoogleMapsPlusView(
|
|
|
183
185
|
nextById.forEach { (id, next) ->
|
|
184
186
|
val prev = prevById[id]
|
|
185
187
|
when {
|
|
186
|
-
prev == null ->
|
|
188
|
+
prev == null -> {
|
|
187
189
|
view.addPolyline(id, polylineBuilder.build(next))
|
|
190
|
+
}
|
|
188
191
|
|
|
189
|
-
!prev.polylineEquals(next) ->
|
|
192
|
+
!prev.polylineEquals(next) -> {
|
|
190
193
|
view.updatePolyline(id) { polyline ->
|
|
191
194
|
polylineBuilder.update(prev, next, polyline)
|
|
192
195
|
}
|
|
196
|
+
}
|
|
193
197
|
}
|
|
194
198
|
}
|
|
195
199
|
}
|
|
@@ -208,13 +212,15 @@ class RNGoogleMapsPlusView(
|
|
|
208
212
|
nextById.forEach { (id, next) ->
|
|
209
213
|
val prev = prevById[id]
|
|
210
214
|
when {
|
|
211
|
-
prev == null ->
|
|
215
|
+
prev == null -> {
|
|
212
216
|
view.addPolygon(id, polygonBuilder.build(next))
|
|
217
|
+
}
|
|
213
218
|
|
|
214
|
-
!prev.polygonEquals(next) ->
|
|
219
|
+
!prev.polygonEquals(next) -> {
|
|
215
220
|
view.updatePolygon(id) { polygon ->
|
|
216
221
|
polygonBuilder.update(prev, next, polygon)
|
|
217
222
|
}
|
|
223
|
+
}
|
|
218
224
|
}
|
|
219
225
|
}
|
|
220
226
|
}
|
|
@@ -233,13 +239,15 @@ class RNGoogleMapsPlusView(
|
|
|
233
239
|
nextById.forEach { (id, next) ->
|
|
234
240
|
val prev = prevById[id]
|
|
235
241
|
when {
|
|
236
|
-
prev == null ->
|
|
242
|
+
prev == null -> {
|
|
237
243
|
view.addCircle(id, circleBuilder.build(next))
|
|
244
|
+
}
|
|
238
245
|
|
|
239
|
-
!prev.circleEquals(next) ->
|
|
246
|
+
!prev.circleEquals(next) -> {
|
|
240
247
|
view.updateCircle(id) { circle ->
|
|
241
248
|
circleBuilder.update(prev, next, circle)
|
|
242
249
|
}
|
|
250
|
+
}
|
|
243
251
|
}
|
|
244
252
|
}
|
|
245
253
|
}
|
|
@@ -5,24 +5,31 @@ import com.rngooglemapsplus.RNMapErrorCode
|
|
|
5
5
|
|
|
6
6
|
fun Int.toRNMapErrorCodeOrNull(): RNMapErrorCode? =
|
|
7
7
|
when (this) {
|
|
8
|
-
ConnectionResult.SERVICE_MISSING ->
|
|
8
|
+
ConnectionResult.SERVICE_MISSING -> {
|
|
9
9
|
RNMapErrorCode.PLAY_SERVICES_MISSING
|
|
10
|
+
}
|
|
10
11
|
|
|
11
|
-
ConnectionResult.SERVICE_INVALID ->
|
|
12
|
+
ConnectionResult.SERVICE_INVALID -> {
|
|
12
13
|
RNMapErrorCode.PLAY_SERVICES_INVALID
|
|
14
|
+
}
|
|
13
15
|
|
|
14
|
-
ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED ->
|
|
16
|
+
ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED -> {
|
|
15
17
|
RNMapErrorCode.PLAY_SERVICES_OUTDATED
|
|
18
|
+
}
|
|
16
19
|
|
|
17
|
-
ConnectionResult.SERVICE_UPDATING ->
|
|
20
|
+
ConnectionResult.SERVICE_UPDATING -> {
|
|
18
21
|
RNMapErrorCode.PLAY_SERVICE_UPDATING
|
|
22
|
+
}
|
|
19
23
|
|
|
20
|
-
ConnectionResult.SERVICE_DISABLED ->
|
|
24
|
+
ConnectionResult.SERVICE_DISABLED -> {
|
|
21
25
|
RNMapErrorCode.PLAY_SERVICES_DISABLED
|
|
26
|
+
}
|
|
22
27
|
|
|
23
|
-
ConnectionResult.SUCCESS ->
|
|
28
|
+
ConnectionResult.SUCCESS -> {
|
|
24
29
|
null
|
|
30
|
+
}
|
|
25
31
|
|
|
26
|
-
else ->
|
|
32
|
+
else -> {
|
|
27
33
|
RNMapErrorCode.UNKNOWN
|
|
34
|
+
}
|
|
28
35
|
}
|
|
@@ -20,53 +20,73 @@ fun Location.toRnLocation(): RNLocation =
|
|
|
20
20
|
elapsedRealtimeNanos = elapsedRealtimeNanos.toDouble(),
|
|
21
21
|
bearingAccuracyDegrees =
|
|
22
22
|
when {
|
|
23
|
-
Build.VERSION.SDK_INT < Build.VERSION_CODES.O ->
|
|
24
|
-
|
|
23
|
+
Build.VERSION.SDK_INT < Build.VERSION_CODES.O -> {
|
|
24
|
+
null
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
else -> {
|
|
25
28
|
try {
|
|
26
29
|
if (hasBearingAccuracy()) bearingAccuracyDegrees.toDouble() else null
|
|
27
30
|
} catch (_: IllegalStateException) {
|
|
28
31
|
null
|
|
29
32
|
}
|
|
33
|
+
}
|
|
30
34
|
},
|
|
31
35
|
speedAccuracyMetersPerSecond =
|
|
32
36
|
when {
|
|
33
|
-
Build.VERSION.SDK_INT < Build.VERSION_CODES.O ->
|
|
34
|
-
|
|
37
|
+
Build.VERSION.SDK_INT < Build.VERSION_CODES.O -> {
|
|
38
|
+
null
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
else -> {
|
|
35
42
|
try {
|
|
36
43
|
if (hasSpeedAccuracy()) speedAccuracyMetersPerSecond.toDouble() else null
|
|
37
44
|
} catch (_: IllegalStateException) {
|
|
38
45
|
null
|
|
39
46
|
}
|
|
47
|
+
}
|
|
40
48
|
},
|
|
41
49
|
verticalAccuracyMeters =
|
|
42
50
|
when {
|
|
43
|
-
Build.VERSION.SDK_INT < Build.VERSION_CODES.O ->
|
|
44
|
-
|
|
51
|
+
Build.VERSION.SDK_INT < Build.VERSION_CODES.O -> {
|
|
52
|
+
null
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
else -> {
|
|
45
56
|
try {
|
|
46
57
|
if (hasVerticalAccuracy()) verticalAccuracyMeters.toDouble() else null
|
|
47
58
|
} catch (_: IllegalStateException) {
|
|
48
59
|
null
|
|
49
60
|
}
|
|
61
|
+
}
|
|
50
62
|
},
|
|
51
63
|
mslAltitudeMeters =
|
|
52
64
|
when {
|
|
53
|
-
Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE ->
|
|
54
|
-
|
|
65
|
+
Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE -> {
|
|
66
|
+
null
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
else -> {
|
|
55
70
|
try {
|
|
56
71
|
if (hasMslAltitude()) mslAltitudeMeters else null
|
|
57
72
|
} catch (_: IllegalStateException) {
|
|
58
73
|
null
|
|
59
74
|
}
|
|
75
|
+
}
|
|
60
76
|
},
|
|
61
77
|
mslAltitudeAccuracyMeters =
|
|
62
78
|
when {
|
|
63
|
-
Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE ->
|
|
64
|
-
|
|
79
|
+
Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE -> {
|
|
80
|
+
null
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
else -> {
|
|
65
84
|
try {
|
|
66
85
|
if (hasMslAltitude()) mslAltitudeAccuracyMeters.toDouble() else null
|
|
67
86
|
} catch (_: IllegalStateException) {
|
|
68
87
|
null
|
|
69
88
|
}
|
|
89
|
+
}
|
|
70
90
|
},
|
|
71
91
|
isMock =
|
|
72
92
|
when {
|
|
@@ -23,16 +23,28 @@ private fun parseCssColor(input: String): Int {
|
|
|
23
23
|
private fun normalizeHexColor(hex: String): String {
|
|
24
24
|
val h = hex.removePrefix("#")
|
|
25
25
|
return when (h.length) {
|
|
26
|
-
3 ->
|
|
26
|
+
3 -> {
|
|
27
27
|
"#FF" +
|
|
28
28
|
h
|
|
29
29
|
.map { "$it$it" }
|
|
30
30
|
.joinToString("")
|
|
31
|
+
}
|
|
31
32
|
|
|
32
|
-
4 ->
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
4 -> {
|
|
34
|
+
"#" + h[0] + h[0] + h[1] + h[1] + h[2] + h[2] + h[3] + h[3]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
6 -> {
|
|
38
|
+
"#FF$h"
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
8 -> {
|
|
42
|
+
"#$h"
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
else -> {
|
|
46
|
+
"#$h"
|
|
47
|
+
}
|
|
36
48
|
}
|
|
37
49
|
}
|
|
38
50
|
|
|
@@ -10,21 +10,27 @@ import com.rngooglemapsplus.RNLocationErrorCode
|
|
|
10
10
|
|
|
11
11
|
fun Throwable.toLocationErrorCode(context: Context): RNLocationErrorCode {
|
|
12
12
|
return when (this) {
|
|
13
|
-
is SecurityException ->
|
|
13
|
+
is SecurityException -> {
|
|
14
|
+
RNLocationErrorCode.PERMISSION_DENIED
|
|
15
|
+
}
|
|
14
16
|
|
|
15
|
-
is ApiException ->
|
|
17
|
+
is ApiException -> {
|
|
16
18
|
when (statusCode) {
|
|
17
|
-
CommonStatusCodes.NETWORK_ERROR ->
|
|
19
|
+
CommonStatusCodes.NETWORK_ERROR -> {
|
|
18
20
|
RNLocationErrorCode.POSITION_UNAVAILABLE
|
|
21
|
+
}
|
|
19
22
|
|
|
20
23
|
LocationSettingsStatusCodes.RESOLUTION_REQUIRED,
|
|
21
24
|
LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE,
|
|
22
|
-
->
|
|
25
|
+
-> {
|
|
23
26
|
RNLocationErrorCode.SETTINGS_NOT_SATISFIED
|
|
27
|
+
}
|
|
24
28
|
|
|
25
|
-
else ->
|
|
29
|
+
else -> {
|
|
26
30
|
RNLocationErrorCode.INTERNAL_ERROR
|
|
31
|
+
}
|
|
27
32
|
}
|
|
33
|
+
}
|
|
28
34
|
|
|
29
35
|
else -> {
|
|
30
36
|
if (message?.contains("GoogleApi", ignoreCase = true) == true) {
|
package/package.json
CHANGED