code review

This commit is contained in:
Valere 2020-11-25 18:02:01 +01:00
parent 8e6e6736a3
commit 4f5632b916
2 changed files with 23 additions and 24 deletions

View File

@ -166,19 +166,18 @@ class MatrixToBottomSheetViewModel @AssistedInject constructor(
enableEncryptionIfInvitedUsersSupportIt = adminE2EByDefault enableEncryptionIfInvitedUsersSupportIt = adminE2EByDefault
} }
val roomId = val roomId = try {
try { awaitCallback<String> { session.createRoom(roomParams, it) }
awaitCallback<String> { session.createRoom(roomParams, it) }.also {
setState {
copy(startChattingState = Success(Unit))
}
}
} catch (failure: Throwable) { } catch (failure: Throwable) {
setState { setState {
copy(startChattingState = Fail(Exception(stringProvider.getString(R.string.invite_users_to_room_failure)))) copy(startChattingState = Fail(Exception(stringProvider.getString(R.string.invite_users_to_room_failure))))
} }
return@launch return@launch
} }
setState {
// we can hide this button has we will navigate out
copy(startChattingState = Uninitialized)
}
_viewEvents.post(MatrixToViewEvents.NavigateToRoom(roomId)) _viewEvents.post(MatrixToViewEvents.NavigateToRoom(roomId))
} }
} }