mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-18 04:08:44 +03:00
Convert to ViewEvents -> RoomDetailViewModel part 1
This commit is contained in:
parent
0dd3894a49
commit
0338535efa
3 changed files with 3 additions and 8 deletions
|
@ -255,10 +255,6 @@ class RoomDetailFragment @Inject constructor(
|
|||
roomDetailViewModel.subscribe { renderState(it) }
|
||||
roomDetailViewModel.sendMessageResultLiveData.observeEvent(viewLifecycleOwner) { renderSendMessageResult(it) }
|
||||
|
||||
roomDetailViewModel.nonBlockingPopAlert.observeEvent(this) { pair ->
|
||||
val message = getString(pair.first, *pair.second.toTypedArray())
|
||||
showSnackWithMessage(message, Snackbar.LENGTH_LONG)
|
||||
}
|
||||
sharedActionViewModel
|
||||
.observe()
|
||||
.subscribe {
|
||||
|
@ -313,6 +309,7 @@ class RoomDetailFragment @Inject constructor(
|
|||
is RoomDetailViewEvents.OnNewTimelineEvents -> scrollOnNewMessageCallback.addNewTimelineEventIds(it.eventIds)
|
||||
is RoomDetailViewEvents.ActionSuccess -> displayRoomDetailActionSuccess(it)
|
||||
is RoomDetailViewEvents.ActionFailure -> displayRoomDetailActionFailure(it)
|
||||
is RoomDetailViewEvents.ShowMessage -> showSnackWithMessage(it.message, Snackbar.LENGTH_LONG)
|
||||
}.exhaustive
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,4 +27,6 @@ sealed class RoomDetailViewEvents : VectorViewEvents {
|
|||
|
||||
data class ActionSuccess(val action: RoomDetailAction) : RoomDetailViewEvents()
|
||||
data class ActionFailure(val action: RoomDetailAction, val throwable: Throwable) : RoomDetailViewEvents()
|
||||
|
||||
data class ShowMessage(val message: String) : RoomDetailViewEvents()
|
||||
}
|
||||
|
|
|
@ -314,10 +314,6 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro
|
|||
}
|
||||
|
||||
// TODO Cleanup this and use ViewEvents
|
||||
private val _nonBlockingPopAlert = MutableLiveData<LiveEvent<Pair<Int, List<Any>>>>()
|
||||
val nonBlockingPopAlert: LiveData<LiveEvent<Pair<Int, List<Any>>>>
|
||||
get() = _nonBlockingPopAlert
|
||||
|
||||
private val _sendMessageResultLiveData = MutableLiveData<LiveEvent<SendMessageResult>>()
|
||||
val sendMessageResultLiveData: LiveData<LiveEvent<SendMessageResult>>
|
||||
get() = _sendMessageResultLiveData
|
||||
|
|
Loading…
Add table
Reference in a new issue