Skip to content

Commit 4c7d24e

Browse files
aleksprogergithub-actions[bot]
authored andcommitted
Adopt signals in IndoorManager API (#7964)
- Use signals parameter instead of callback in IndoorManager, to allow emitting to multiple subscribers - Allow to use generateOnly with signals in bindgen - Make lifecycle between map and indoor_manager safer, instead of raw pointer indoor_manager stores map as std::weak_ptr - mbgl::map now stores indoor_manager_impl as std::weak to propagate events, implementation is shared while only strongly owned by it public peer cc @mapbox/gl-native cc @mapbox/core-sdk cc @mapbox/maps-android GitOrigin-RevId: 75dcce5d1da0f28eac1a38eb60bf5929f0a46602
1 parent 8013a94 commit 4c7d24e

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

app/src/main/java/com/mapbox/maps/testapp/examples/IndoorExampleActivity.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package com.mapbox.maps.testapp.examples
33
import android.os.Bundle
44
import androidx.appcompat.app.AppCompatActivity
55
import com.mapbox.geojson.Point
6+
import com.mapbox.maps.IndoorManager
7+
import com.mapbox.maps.IndoorState
68
import com.mapbox.maps.MapInitOptions
79
import com.mapbox.maps.MapView
810
import com.mapbox.maps.MapboxExperimental
@@ -41,11 +43,13 @@ class IndoorExampleActivity : AppCompatActivity() {
4143
mapboxMap.indoor.selectFloor(FLOOR_ID)
4244

4345
// Listen to indoor state updates
44-
mapboxMap.indoor.onIndoorUpdate { indoorState ->
45-
logD(TAG, "Indoor state updated: $indoorState")
46-
logD(TAG, "Available floors: ${indoorState.floors}")
47-
logD(TAG, "Selected floor: ${indoorState.selectedFloorId}")
48-
}
46+
mapboxMap.indoor.setOnIndoorUpdatedCallback(object : IndoorManager.OnIndoorUpdatedCallback {
47+
override fun onOnIndoorUpdated(onIndoorUpdated: IndoorState) {
48+
logD(TAG, "Indoor state updated: $onIndoorUpdated")
49+
logD(TAG, "Available floors: ${onIndoorUpdated.floors}")
50+
logD(TAG, "Selected floor: ${onIndoorUpdated.selectedFloorId}")
51+
}
52+
})
4953
}
5054
}
5155

0 commit comments

Comments
 (0)