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
}
val roomId =
try {
awaitCallback<String> { session.createRoom(roomParams, it) }.also {
setState {
copy(startChattingState = Success(Unit))
}
}
val roomId = try {
awaitCallback<String> { session.createRoom(roomParams, it) }
} catch (failure: Throwable) {
setState {
copy(startChattingState = Fail(Exception(stringProvider.getString(R.string.invite_users_to_room_failure))))
}
return@launch
}
setState {
// we can hide this button has we will navigate out
copy(startChattingState = Uninitialized)
}
_viewEvents.post(MatrixToViewEvents.NavigateToRoom(roomId))
}
}