Skip to content

Commit da96162

Browse files
authored
Fix crash when receiving annotation interactions (#989) (#990)
1 parent 80cfd12 commit da96162

File tree

5 files changed

+228
-83
lines changed

5 files changed

+228
-83
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
### 2.10.0-rc.1
22

33
* Use Maps SDK Android dependency with NDK 27 support and [support for 16 KB page sizes](https://developer.android.com/guide/practices/page-sizes).
4+
* Fix crash when receiving annotation interactions.
45

56
### 2.10.0-beta.1
67

android/src/main/kotlin/com/mapbox/maps/mapbox_maps/pigeons/GestureListeners.kt

Lines changed: 81 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -217,70 +217,100 @@ private open class GestureListenersPigeonCodec : StandardMessageCodec() {
217217
return when (type) {
218218
129.toByte() -> {
219219
return (readValue(buffer) as Long?)?.let {
220-
GestureState.ofRaw(it.toInt())
220+
IconAnchor.ofRaw(it.toInt())
221221
}
222222
}
223223
130.toByte() -> {
224+
return (readValue(buffer) as Long?)?.let {
225+
IconTextFit.ofRaw(it.toInt())
226+
}
227+
}
228+
131.toByte() -> {
229+
return (readValue(buffer) as Long?)?.let {
230+
TextAnchor.ofRaw(it.toInt())
231+
}
232+
}
233+
132.toByte() -> {
234+
return (readValue(buffer) as Long?)?.let {
235+
TextJustify.ofRaw(it.toInt())
236+
}
237+
}
238+
133.toByte() -> {
239+
return (readValue(buffer) as Long?)?.let {
240+
TextTransform.ofRaw(it.toInt())
241+
}
242+
}
243+
134.toByte() -> {
244+
return (readValue(buffer) as Long?)?.let {
245+
LineJoin.ofRaw(it.toInt())
246+
}
247+
}
248+
135.toByte() -> {
249+
return (readValue(buffer) as Long?)?.let {
250+
GestureState.ofRaw(it.toInt())
251+
}
252+
}
253+
136.toByte() -> {
224254
return (readValue(buffer) as? List<Any?>)?.let {
225255
PointDecoder.fromList(it)
226256
}
227257
}
228-
131.toByte() -> {
258+
137.toByte() -> {
229259
return (readValue(buffer) as? List<Any?>)?.let {
230260
PolygonDecoder.fromList(it)
231261
}
232262
}
233-
132.toByte() -> {
263+
138.toByte() -> {
234264
return (readValue(buffer) as? List<Any?>)?.let {
235265
LineStringDecoder.fromList(it)
236266
}
237267
}
238-
133.toByte() -> {
268+
139.toByte() -> {
239269
return (readValue(buffer) as? List<Any?>)?.let {
240270
ScreenCoordinate.fromList(it)
241271
}
242272
}
243-
134.toByte() -> {
273+
140.toByte() -> {
244274
return (readValue(buffer) as? List<Any?>)?.let {
245275
MapContentGestureContext.fromList(it)
246276
}
247277
}
248-
135.toByte() -> {
278+
141.toByte() -> {
249279
return (readValue(buffer) as? List<Any?>)?.let {
250280
PointAnnotation.fromList(it)
251281
}
252282
}
253-
136.toByte() -> {
283+
142.toByte() -> {
254284
return (readValue(buffer) as? List<Any?>)?.let {
255285
CircleAnnotation.fromList(it)
256286
}
257287
}
258-
137.toByte() -> {
288+
143.toByte() -> {
259289
return (readValue(buffer) as? List<Any?>)?.let {
260290
PolygonAnnotation.fromList(it)
261291
}
262292
}
263-
138.toByte() -> {
293+
144.toByte() -> {
264294
return (readValue(buffer) as? List<Any?>)?.let {
265295
PolylineAnnotation.fromList(it)
266296
}
267297
}
268-
139.toByte() -> {
298+
145.toByte() -> {
269299
return (readValue(buffer) as? List<Any?>)?.let {
270300
PointAnnotationInteractionContext.fromList(it)
271301
}
272302
}
273-
140.toByte() -> {
303+
146.toByte() -> {
274304
return (readValue(buffer) as? List<Any?>)?.let {
275305
CircleAnnotationInteractionContext.fromList(it)
276306
}
277307
}
278-
141.toByte() -> {
308+
147.toByte() -> {
279309
return (readValue(buffer) as? List<Any?>)?.let {
280310
PolygonAnnotationInteractionContext.fromList(it)
281311
}
282312
}
283-
142.toByte() -> {
313+
148.toByte() -> {
284314
return (readValue(buffer) as? List<Any?>)?.let {
285315
PolylineAnnotationInteractionContext.fromList(it)
286316
}
@@ -290,60 +320,84 @@ private open class GestureListenersPigeonCodec : StandardMessageCodec() {
290320
}
291321
override fun writeValue(stream: ByteArrayOutputStream, value: Any?) {
292322
when (value) {
293-
is GestureState -> {
323+
is IconAnchor -> {
294324
stream.write(129)
295325
writeValue(stream, value.raw)
296326
}
297-
is Point -> {
327+
is IconTextFit -> {
298328
stream.write(130)
329+
writeValue(stream, value.raw)
330+
}
331+
is TextAnchor -> {
332+
stream.write(131)
333+
writeValue(stream, value.raw)
334+
}
335+
is TextJustify -> {
336+
stream.write(132)
337+
writeValue(stream, value.raw)
338+
}
339+
is TextTransform -> {
340+
stream.write(133)
341+
writeValue(stream, value.raw)
342+
}
343+
is LineJoin -> {
344+
stream.write(134)
345+
writeValue(stream, value.raw)
346+
}
347+
is GestureState -> {
348+
stream.write(135)
349+
writeValue(stream, value.raw)
350+
}
351+
is Point -> {
352+
stream.write(136)
299353
writeValue(stream, value.toList())
300354
}
301355
is Polygon -> {
302-
stream.write(131)
356+
stream.write(137)
303357
writeValue(stream, value.toList())
304358
}
305359
is LineString -> {
306-
stream.write(132)
360+
stream.write(138)
307361
writeValue(stream, value.toList())
308362
}
309363
is ScreenCoordinate -> {
310-
stream.write(133)
364+
stream.write(139)
311365
writeValue(stream, value.toList())
312366
}
313367
is MapContentGestureContext -> {
314-
stream.write(134)
368+
stream.write(140)
315369
writeValue(stream, value.toList())
316370
}
317371
is PointAnnotation -> {
318-
stream.write(135)
372+
stream.write(141)
319373
writeValue(stream, value.toList())
320374
}
321375
is CircleAnnotation -> {
322-
stream.write(136)
376+
stream.write(142)
323377
writeValue(stream, value.toList())
324378
}
325379
is PolygonAnnotation -> {
326-
stream.write(137)
380+
stream.write(143)
327381
writeValue(stream, value.toList())
328382
}
329383
is PolylineAnnotation -> {
330-
stream.write(138)
384+
stream.write(144)
331385
writeValue(stream, value.toList())
332386
}
333387
is PointAnnotationInteractionContext -> {
334-
stream.write(139)
388+
stream.write(145)
335389
writeValue(stream, value.toList())
336390
}
337391
is CircleAnnotationInteractionContext -> {
338-
stream.write(140)
392+
stream.write(146)
339393
writeValue(stream, value.toList())
340394
}
341395
is PolygonAnnotationInteractionContext -> {
342-
stream.write(141)
396+
stream.write(147)
343397
writeValue(stream, value.toList())
344398
}
345399
is PolylineAnnotationInteractionContext -> {
346-
stream.write(142)
400+
stream.write(148)
347401
writeValue(stream, value.toList())
348402
}
349403
else -> super.writeValue(stream, value)

android/src/main/kotlin/com/mapbox/maps/mapbox_maps/pigeons/PointAnnotationMessenger.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ data class PointAnnotation(
517517
*/
518518
val iconHaloWidth: Double? = null,
519519
/**
520-
* Controls the transition progress between the image variants of icon-image. Zero means the first variant is used, one is the second, and in between they are blended together. Both images should be the same size and have the same type (either raster or vector).
520+
* Controls the transition progress between the image variants of icon-image. Zero means the first variant is used, one is the second, and in between they are blended together. . Both images should be the same size and have the same type (either raster or vector).
521521
* Default value: 0. Value range: [0, 1]
522522
* Deprecated: Use `PointAnnotationManager.iconImageCrossFade` instead.
523523
*/
@@ -838,7 +838,7 @@ data class PointAnnotationOptions(
838838
*/
839839
val iconHaloWidth: Double? = null,
840840
/**
841-
* Controls the transition progress between the image variants of icon-image. Zero means the first variant is used, one is the second, and in between they are blended together. Both images should be the same size and have the same type (either raster or vector).
841+
* Controls the transition progress between the image variants of icon-image. Zero means the first variant is used, one is the second, and in between they are blended together. . Both images should be the same size and have the same type (either raster or vector).
842842
* Default value: 0. Value range: [0, 1]
843843
* Deprecated: Use `PointAnnotationManager.iconImageCrossFade` instead.
844844
*/

0 commit comments

Comments
 (0)