Leaving a room creates a stuck "leaving room" loading screen. (#1041)

This commit is contained in:
Benoit Marty 2020-02-20 19:31:33 +01:00
parent 198e23c204
commit 3f9a5a4e54
4 changed files with 7 additions and 0 deletions

View File

@ -16,6 +16,7 @@ Bugfix 🐛:
- Fix crash in the room directory, when public room has no name (#1023)
- Fix restoring keys backup with passphrase (#526)
- Fix joining rooms from directory via federation isn't working. (#808)
- Leaving a room creates a stuck "leaving room" loading screen. (#1041)
Translations 🗣:
-

View File

@ -105,6 +105,7 @@ class RoomListFragment @Inject constructor(
is RoomListViewEvents.Loading -> showLoading(it.message)
is RoomListViewEvents.Failure -> showFailure(it.throwable)
is RoomListViewEvents.SelectRoom -> handleSelectRoom(it)
is RoomListViewEvents.Done -> Unit
}.exhaustive
}

View File

@ -28,4 +28,5 @@ sealed class RoomListViewEvents : VectorViewEvents {
data class Failure(val throwable: Throwable) : RoomListViewEvents()
data class SelectRoom(val roomSummary: RoomSummary) : RoomListViewEvents()
object Done : RoomListViewEvents()
}

View File

@ -197,6 +197,10 @@ class RoomListViewModel @Inject constructor(initialState: RoomListViewState,
private fun handleLeaveRoom(action: RoomListAction.LeaveRoom) {
_viewEvents.post(RoomListViewEvents.Loading(null))
session.getRoom(action.roomId)?.leave(null, object : MatrixCallback<Unit> {
override fun onSuccess(data: Unit) {
_viewEvents.post(RoomListViewEvents.Done)
}
override fun onFailure(failure: Throwable) {
_viewEvents.post(RoomListViewEvents.Failure(failure))
}