Skip to content

Commit 6248547

Browse files
sbergmairJulianBissekkouJeanTappedQLF3985
authored
Fix Nullpointer getMap() (#109)
* catch exceptions while parsing and fix poliline on mobile * add missing return * initial draft on iOS * add symbol methods to controller * parse symbol * implement useCourseSymbolOnMovement * implement new type of location display data source * implement feature * implement feature * add example on button click * add support for local asset android * add support for local asset android * fix logic * implement iOS * reformat * review * update README.md and add button for example only on mobile * finish iOS location indicator impl * export * implement android * merge indicator * fix android * try to fix wrong initial scale * implement licenseKey and make apiKey optional * print statement * try to fix zoom * fix zoom gets not initialized correctly * remove print * fix android error parsing symbol and iOS zoom * fix bug for manual location source on android * revert changes * typo * fix NaN android getMapScale * fix * correct round * remove web sdk * format * fix merge * fix ios build * remove duplicate declaration * remove newline * Add isAttributionTextVisible to hide map attribution * Add isAttributionTextVisible for iOS * Add dependency_overrides * implement changing attribution text * implement image-export * add layer status observation * remove map status observeration * implement image export on android * update readme * update docs * fix duplicate code * specify android namespace * cleanup * override setMethodCallHandler * fix map status callback * reformat code * update ArcGis ios sdk * Revert "update ArcGis ios sdk" This reverts commit 1e07877. * fix nullpointer * revert tollnow specific stuff --------- Co-authored-by: Julian Bissekkou <julian.bissekkou@tapped.dev> Co-authored-by: Jean <jean.devezi@tapped.dev> Co-authored-by: QLF3985 <stefan.bergmair@external.t-systems.com>
1 parent b9ec0a1 commit 6248547

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

  • arcgis_map_sdk_android/android/src/main/kotlin/dev/fluttercommunity/arcgis_map_sdk_android

arcgis_map_sdk_android/android/src/main/kotlin/dev/fluttercommunity/arcgis_map_sdk_android/ArcgisMapView.kt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ internal class ArcgisMapView(
7272
private val graphicsParser = GraphicsParser(binding)
7373

7474
private val initialZoom: Int
75+
private var isDisposed = false
7576

7677
private lateinit var zoomStreamHandler: ZoomStreamHandler
7778
private lateinit var centerPositionStreamHandler: CenterPositionStreamHandler
@@ -155,6 +156,8 @@ internal class ArcgisMapView(
155156
}
156157

157158
override fun dispose() {
159+
isDisposed = true
160+
methodChannel.setMethodCallHandler(null)
158161
coroutineScope.cancel()
159162

160163
lifecycle.removeObserver(mapView)
@@ -165,6 +168,10 @@ internal class ArcgisMapView(
165168

166169
private fun setupMethodChannel() {
167170
methodChannel.setMethodCallHandler { call, result ->
171+
if (isDisposed) {
172+
result.error("disposed", "ArcgisMapView has been disposed", null)
173+
return@setMethodCallHandler
174+
}
168175
when (call.method) {
169176
"zoom_in" -> onZoomIn(call = call, result = result)
170177
"zoom_out" -> onZoomOut(call = call, result = result)
@@ -651,9 +658,13 @@ internal class ArcgisMapView(
651658

652659
private fun onRetryLoad(result: MethodChannel.Result) {
653660
coroutineScope.launch {
654-
mapView.map?.retryLoad()?.onSuccess {
655-
result.success(true)
656-
}?.onFailure { e ->
661+
try {
662+
map.retryLoad().onSuccess {
663+
result.success(true)
664+
}.onFailure { e ->
665+
result.finishWithError(e)
666+
}
667+
} catch (e: Throwable) {
657668
result.finishWithError(e)
658669
}
659670
}

0 commit comments

Comments
 (0)