mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-21 17:05:39 +03:00
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:
parent
4c496bb148
commit
2c10678263
5 changed files with 12 additions and 0 deletions
|
@ -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()
|
||||
|
|
|
@ -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 ->
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue