Create room screen - Navigate to freshly created room

This commit is contained in:
Benoit Marty 2019-06-10 08:23:19 +02:00
parent aa95ce3d02
commit 77fc793e89
2 changed files with 8 additions and 2 deletions

View file

@ -33,6 +33,7 @@ class RoomDirectoryActivity : VectorBaseActivity() {
sealed class Navigation {
object Back : Navigation()
object CreateRoom : Navigation()
object Close : Navigation()
}
@ -49,6 +50,7 @@ class RoomDirectoryActivity : VectorBaseActivity() {
when (liveEvent.getContentIfNotHandled() ?: return@Observer) {
is Navigation.Back -> onBackPressed()
is Navigation.CreateRoom -> gotoCreateRoom()
is Navigation.Close -> finish()
}
})
}

View file

@ -95,8 +95,12 @@ class CreateRoomFragment : VectorBaseFragment(), CreateRoomController.Listener {
}
override fun invalidate() = withState(viewModel) { state ->
if (state.asyncCreateRoomRequest is Success) {
vectorBaseActivity.notImplemented("navigate to freshly created room")
val async = state.asyncCreateRoomRequest
if (async is Success) {
// Navigate to freshly created room
navigator.openRoom(async())
navigationViewModel.goTo(RoomDirectoryActivity.Navigation.Close)
} else {
// Populate list with Epoxy
createRoomController.setData(state)