Just go back to the timeline if the user is already viewing the DM with the other user.

Fix #6514
This commit is contained in:
Benoit Marty 2022-07-13 22:19:34 +02:00
parent 4c496bb148
commit 2c10678263
5 changed files with 12 additions and 0 deletions

View file

@ -17,6 +17,7 @@
package im.vector.app.features.home.room.detail
sealed class RoomDetailPendingAction {
object DoNothing : 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()

View file

@ -1323,6 +1323,7 @@ class TimelineFragment @Inject constructor(
private fun handlePendingAction(roomDetailPendingAction: RoomDetailPendingAction) {
when (roomDetailPendingAction) {
RoomDetailPendingAction.DoNothing -> Unit
is RoomDetailPendingAction.JumpToReadReceipt ->
timelineViewModel.handle(RoomDetailAction.JumpToReadReceipt(roomDetailPendingAction.userId))
is RoomDetailPendingAction.MentionUser ->

View file

@ -136,6 +136,7 @@ class RoomMemberProfileFragment @Inject constructor(
is RoomMemberProfileViewEvents.OnBanActionSuccess -> Unit
is RoomMemberProfileViewEvents.OnIgnoreActionSuccess -> Unit
is RoomMemberProfileViewEvents.OnInviteActionSuccess -> Unit
RoomMemberProfileViewEvents.GoBack -> handleGoBack()
}
}
setupLongClicks()
@ -309,6 +310,11 @@ class RoomMemberProfileFragment @Inject constructor(
viewModel.handle(RoomMemberProfileAction.OpenOrCreateDm(fragmentArgs.userId))
}
private fun handleGoBack() {
roomDetailPendingActionStore.data = RoomDetailPendingAction.DoNothing
vectorBaseActivity.finish()
}
override fun onJumpToReadReceiptClicked() {
roomDetailPendingActionStore.data = RoomDetailPendingAction.JumpToReadReceipt(fragmentArgs.userId)
vectorBaseActivity.finish()

View file

@ -40,4 +40,5 @@ sealed class RoomMemberProfileViewEvents : VectorViewEvents {
data class ShareRoomMemberProfile(val permalink: String) : RoomMemberProfileViewEvents()
data class OpenRoom(val roomId: String) : RoomMemberProfileViewEvents()
object GoBack : RoomMemberProfileViewEvents()
}

View file

@ -183,6 +183,9 @@ class RoomMemberProfileViewModel @AssistedInject constructor(
}
if (roomId != initialState.roomId) {
_viewEvents.post(RoomMemberProfileViewEvents.OpenRoom(roomId = roomId))
} else {
// Just go back to the previous screen (timeline)
_viewEvents.post(RoomMemberProfileViewEvents.GoBack)
}
}
}