Forward error to UI in map screen

This commit is contained in:
Maxime NATUREL 2022-06-15 14:45:32 +02:00
parent 31bb9eaac8
commit fc98057042
4 changed files with 15 additions and 3 deletions

View File

@ -1294,7 +1294,7 @@ class TimelineViewModel @AssistedInject constructor(
}
override fun onLocationServiceError(error: Throwable) {
_viewEvents.post(RoomDetailViewEvents.Failure(error))
_viewEvents.post(RoomDetailViewEvents.Failure(throwable = error, showInDialog = true))
}
override fun onCleared() {

View File

@ -18,4 +18,6 @@ package im.vector.app.features.location.live.map
import im.vector.app.core.platform.VectorViewEvents
sealed interface LocationLiveMapViewEvents : VectorViewEvents
sealed interface LocationLiveMapViewEvents : VectorViewEvents {
data class Error(val error: Throwable) : LocationLiveMapViewEvents
}

View File

@ -76,6 +76,8 @@ class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment<Fra
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
observeViewEvents()
views.liveLocationBottomSheetRecyclerView.configureWith(bottomSheetController, hasFixedSize = false, disableItemAnimation = true)
bottomSheetController.callback = object : LiveLocationBottomSheetController.Callback {
@ -89,6 +91,14 @@ class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment<Fra
}
}
private fun observeViewEvents() {
viewModel.observeViewEvents { viewEvent ->
when(viewEvent) {
is LocationLiveMapViewEvents.Error -> displayErrorDialog(viewEvent.error)
}
}
}
override fun onResume() {
super.onResume()
setupMap()

View File

@ -82,6 +82,6 @@ class LocationLiveMapViewModel @AssistedInject constructor(
}
override fun onLocationServiceError(error: Throwable) {
// TODO
_viewEvents.post(LocationLiveMapViewEvents.Error(error))
}
}