Remove handling of direct message from timeline fragment
This commit is contained in:
parent
46854b4b84
commit
96f041a773
|
@ -92,7 +92,6 @@ sealed class RoomDetailAction : VectorViewModelAction {
|
|||
|
||||
data class UpdateJoinJitsiCallStatus(val conferenceEvent: ConferenceEvent) : RoomDetailAction()
|
||||
|
||||
data class OpenOrCreateDm(val userId: String) : RoomDetailAction()
|
||||
data class JumpToReadReceipt(val userId: String) : RoomDetailAction()
|
||||
object QuickActionInvitePeople : RoomDetailAction()
|
||||
object QuickActionSetAvatar : RoomDetailAction()
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package im.vector.app.features.home.room.detail
|
||||
|
||||
sealed class RoomDetailPendingAction {
|
||||
data class OpenOrCreateDm(val userId: String) : RoomDetailPendingAction()
|
||||
data class JumpToReadReceipt(val userId: String) : RoomDetailPendingAction()
|
||||
data class MentionUser(val userId: String) : RoomDetailPendingAction()
|
||||
data class OpenRoom(val roomId: String, val closeCurrentRoom: Boolean = false) : RoomDetailPendingAction()
|
||||
|
|
|
@ -1234,7 +1234,6 @@ class TimelineFragment @Inject constructor(
|
|||
override fun onResume() {
|
||||
super.onResume()
|
||||
notificationDrawerManager.setCurrentRoom(timelineArgs.roomId)
|
||||
// TODO should we handle it in HomeActivity as well? => see how we open dm from create Message button
|
||||
roomDetailPendingActionStore.data?.let { handlePendingAction(it) }
|
||||
roomDetailPendingActionStore.data = null
|
||||
|
||||
|
@ -1248,8 +1247,6 @@ class TimelineFragment @Inject constructor(
|
|||
timelineViewModel.handle(RoomDetailAction.JumpToReadReceipt(roomDetailPendingAction.userId))
|
||||
is RoomDetailPendingAction.MentionUser ->
|
||||
insertUserDisplayNameInTextEditor(roomDetailPendingAction.userId)
|
||||
is RoomDetailPendingAction.OpenOrCreateDm ->
|
||||
timelineViewModel.handle(RoomDetailAction.OpenOrCreateDm(roomDetailPendingAction.userId))
|
||||
is RoomDetailPendingAction.OpenRoom ->
|
||||
handleOpenRoom(RoomDetailViewEvents.OpenRoom(roomDetailPendingAction.roomId, roomDetailPendingAction.closeCurrentRoom))
|
||||
}.exhaustive
|
||||
|
|
|
@ -417,7 +417,6 @@ class TimelineViewModel @AssistedInject constructor(
|
|||
is RoomDetailAction.RemoveWidget -> handleDeleteWidget(action.widgetId)
|
||||
is RoomDetailAction.EnsureNativeWidgetAllowed -> handleCheckWidgetAllowed(action)
|
||||
is RoomDetailAction.CancelSend -> handleCancel(action)
|
||||
is RoomDetailAction.OpenOrCreateDm -> handleOpenOrCreateDm(action)
|
||||
is RoomDetailAction.JumpToReadReceipt -> handleJumpToReadReceipt(action)
|
||||
RoomDetailAction.QuickActionInvitePeople -> handleInvitePeople()
|
||||
RoomDetailAction.QuickActionSetAvatar -> handleQuickSetAvatar()
|
||||
|
@ -497,20 +496,6 @@ class TimelineViewModel @AssistedInject constructor(
|
|||
_viewEvents.post(RoomDetailViewEvents.OpenSetRoomAvatarDialog)
|
||||
}
|
||||
|
||||
private fun handleOpenOrCreateDm(action: RoomDetailAction.OpenOrCreateDm) {
|
||||
viewModelScope.launch {
|
||||
val roomId = try {
|
||||
directRoomHelper.ensureDMExists(action.userId)
|
||||
} catch (failure: Throwable) {
|
||||
_viewEvents.post(RoomDetailViewEvents.ActionFailure(action, failure))
|
||||
return@launch
|
||||
}
|
||||
if (roomId != initialState.roomId) {
|
||||
_viewEvents.post(RoomDetailViewEvents.OpenRoom(roomId = roomId))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleJumpToReadReceipt(action: RoomDetailAction.JumpToReadReceipt) {
|
||||
room.getUserReadReceipt(action.userId)
|
||||
?.let { handleNavigateToEvent(RoomDetailAction.NavigateToEvent(it, true)) }
|
||||
|
|
Loading…
Reference in New Issue