Skip to main content

Waypoints management

Every time UX Framework sets and updates current route waypoints an event is produced and dispatched. To observe any waypoints changes along the route, you can collect the Dash.controller.observeRouteWaypoints flow. The flow provides the list of route waypoints.

class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED) {
Dash.controller.observeRoutes()
.collect { waypoints ->
waypoints.forEach {
if (it.categories?.contains("coffee")) {
// Do something with the current route waypoints, i.e. check the category
}
}
}
}
}
}
}
Was this page helpful?