diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailPendingAction.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailPendingAction.kt index b42f551ba0..79328b6272 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailPendingAction.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailPendingAction.kt @@ -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() diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt index 972b5ea898..e86a7fe227 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt @@ -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 -> diff --git a/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileFragment.kt b/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileFragment.kt index 88a27f246c..d050b0d561 100644 --- a/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileFragment.kt +++ b/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileFragment.kt @@ -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() diff --git a/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileViewEvents.kt b/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileViewEvents.kt index 46983b52a4..d04de8b936 100644 --- a/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileViewEvents.kt +++ b/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileViewEvents.kt @@ -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() } diff --git a/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileViewModel.kt b/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileViewModel.kt index bf79021fa6..2c30555696 100644 --- a/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileViewModel.kt @@ -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) } } }