From 7952e205b9abcb49358425e00e0f3aac9e564975 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 5 Oct 2020 18:42:34 +0200 Subject: [PATCH 1/4] Implement "Jump to read receipt" and "Mention" actions on the room member profile screen --- CHANGES.md | 1 + .../sdk/api/session/room/read/ReadService.kt | 8 ++++++ .../session/room/read/DefaultReadService.kt | 10 ++++++++ .../im/vector/app/core/di/VectorComponent.kt | 3 +++ .../vector/app/core/utils/TemporaryStore.kt | 17 +++++++------ .../home/room/detail/RoomDetailAction.kt | 2 ++ .../home/room/detail/RoomDetailFragment.kt | 14 ++++++++++- .../room/detail/RoomDetailPendingAction.kt | 22 ++++++++++++++++ .../detail/RoomDetailPendingActionStore.kt | 25 +++++++++++++++++++ .../home/room/detail/RoomDetailViewModel.kt | 6 +++++ .../RoomMemberProfileFragment.kt | 11 +++++--- .../members/RoomMemberListFragment.kt | 11 +++++++- 12 files changed, 118 insertions(+), 12 deletions(-) create mode 100644 vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailPendingAction.kt create mode 100644 vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailPendingActionStore.kt diff --git a/CHANGES.md b/CHANGES.md index ec853d96ef..05d189ed12 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -15,6 +15,7 @@ Improvements 🙌: - Add a menu item in the timeline as a shortcut to invite user (#2171) - Drawer: move settings access and add sign out action (#2171) - Filter room member (and banned users) by name (#2184) + - Implement "Jump to read receipt" and "Mention" actions on the room member profile screen Bugfix 🐛: - Improve support for image/audio/video/file selection with intent changes (#1376) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/read/ReadService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/read/ReadService.kt index 3aa9d60e6a..8f76295fe7 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/read/ReadService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/read/ReadService.kt @@ -63,6 +63,14 @@ interface ReadService { */ fun getMyReadReceiptLive(): LiveData> + /** + * Get the eventId where the read receipt for the provided user is + * @param otherUserId the userId param to look for + * + * @return the eventId where the read receipt for the provided user is attached, or null if not found + */ + fun getUserReadReceipt(otherUserId: String): String? + /** * Returns a live list of read receipts for a given event * @param eventId: the event diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/read/DefaultReadService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/read/DefaultReadService.kt index a5520972b0..162ad7d895 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/read/DefaultReadService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/read/DefaultReadService.kt @@ -107,6 +107,16 @@ internal class DefaultReadService @AssistedInject constructor( } } + override fun getUserReadReceipt(otherUserId: String): String? { + var eventId: String? = null + monarchy.doWithRealm { + eventId = ReadReceiptEntity.where(it, roomId = roomId, userId = otherUserId) + .findFirst() + ?.eventId + } + return eventId + } + override fun getEventReadReceiptsLive(eventId: String): LiveData> { val liveRealmData = monarchy.findAllMappedWithChanges( { ReadReceiptsSummaryEntity.where(it, eventId) }, diff --git a/vector/src/main/java/im/vector/app/core/di/VectorComponent.kt b/vector/src/main/java/im/vector/app/core/di/VectorComponent.kt index 4ba3d6ba13..28f3a52efa 100644 --- a/vector/src/main/java/im/vector/app/core/di/VectorComponent.kt +++ b/vector/src/main/java/im/vector/app/core/di/VectorComponent.kt @@ -36,6 +36,7 @@ import im.vector.app.features.crypto.verification.IncomingVerificationRequestHan import im.vector.app.features.grouplist.SelectedGroupDataSource import im.vector.app.features.home.AvatarRenderer import im.vector.app.features.home.HomeRoomListDataSource +import im.vector.app.features.home.room.detail.RoomDetailPendingActionStore import im.vector.app.features.home.room.detail.timeline.helper.MatrixItemColorProvider import im.vector.app.features.html.EventHtmlRenderer import im.vector.app.features.html.VectorHtmlCompressor @@ -114,6 +115,8 @@ interface VectorComponent { fun selectedGroupStore(): SelectedGroupDataSource + fun roomDetailPendingActionStore(): RoomDetailPendingActionStore + fun activeSessionObservableStore(): ActiveSessionDataSource fun incomingVerificationRequestHandler(): IncomingVerificationRequestHandler diff --git a/vector/src/main/java/im/vector/app/core/utils/TemporaryStore.kt b/vector/src/main/java/im/vector/app/core/utils/TemporaryStore.kt index 32b995c004..63f80341eb 100644 --- a/vector/src/main/java/im/vector/app/core/utils/TemporaryStore.kt +++ b/vector/src/main/java/im/vector/app/core/utils/TemporaryStore.kt @@ -23,6 +23,7 @@ const val THREE_MINUTES = 3 * 60_000L /** * Store an object T for a specific period of time + * @param delay delay to keep the data, in millis */ open class TemporaryStore(private val delay: Long = THREE_MINUTES) { @@ -30,14 +31,16 @@ open class TemporaryStore(private val delay: Long = THREE_MINUTES) { var data: T? = null set(value) { - field = value timer?.cancel() - timer = Timer().also { - it.schedule(object : TimerTask() { - override fun run() { - field = null - } - }, delay) + field = value + if (value != null) { + timer = Timer().also { + it.schedule(object : TimerTask() { + override fun run() { + field = null + } + }, delay) + } } } } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailAction.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailAction.kt index 5f851b8da7..03809d3c75 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailAction.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailAction.kt @@ -88,4 +88,6 @@ sealed class RoomDetailAction : VectorViewModelAction { data class EnsureNativeWidgetAllowed(val widget: Widget, val userJustAccepted: Boolean, val grantedEvents: RoomDetailViewEvents) : RoomDetailAction() + + data class JumpToReadReceipt(val userId: String) : RoomDetailAction() } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt index 66e49cf060..eadea299e6 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt @@ -216,7 +216,8 @@ class RoomDetailFragment @Inject constructor( private val notificationUtils: NotificationUtils, private val webRtcPeerConnectionManager: WebRtcPeerConnectionManager, private val matrixItemColorProvider: MatrixItemColorProvider, - private val imageContentRenderer: ImageContentRenderer + private val imageContentRenderer: ImageContentRenderer, + private val roomDetailPendingActionStore: RoomDetailPendingActionStore ) : VectorBaseFragment(), TimelineEventController.Callback, @@ -878,6 +879,17 @@ class RoomDetailFragment @Inject constructor( override fun onResume() { super.onResume() notificationDrawerManager.setCurrentRoom(roomDetailArgs.roomId) + roomDetailPendingActionStore.data?.let { handlePendingAction(it) } + roomDetailPendingActionStore.data = null + } + + private fun handlePendingAction(roomDetailPendingAction: RoomDetailPendingAction) { + when (roomDetailPendingAction) { + is RoomDetailPendingAction.JumpToReadReceipt -> + roomDetailViewModel.handle(RoomDetailAction.JumpToReadReceipt(roomDetailPendingAction.userId)) + is RoomDetailPendingAction.MentionUser -> + insertUserDisplayNameInTextEditor(roomDetailPendingAction.userId) + }.exhaustive } override fun onPause() { 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 new file mode 100644 index 0000000000..394d46ef8d --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailPendingAction.kt @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2020 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.app.features.home.room.detail + +sealed class RoomDetailPendingAction { + data class JumpToReadReceipt(val userId: String) : RoomDetailPendingAction() + data class MentionUser(val userId: String) : RoomDetailPendingAction() +} diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailPendingActionStore.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailPendingActionStore.kt new file mode 100644 index 0000000000..9ffbb83a47 --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailPendingActionStore.kt @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2020 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.app.features.home.room.detail + +import im.vector.app.core.utils.TemporaryStore +import javax.inject.Inject +import javax.inject.Singleton + +// Store to keep a pending action from sub screen of a room detail +@Singleton +class RoomDetailPendingActionStore @Inject constructor() : TemporaryStore(10_000) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt index ebc265d935..009f8ec802 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt @@ -274,9 +274,15 @@ class RoomDetailViewModel @AssistedInject constructor( is RoomDetailAction.RemoveWidget -> handleDeleteWidget(action.widgetId) is RoomDetailAction.EnsureNativeWidgetAllowed -> handleCheckWidgetAllowed(action) is RoomDetailAction.CancelSend -> handleCancel(action) + is RoomDetailAction.JumpToReadReceipt -> handleJumpToReadReceipt(action) }.exhaustive } + private fun handleJumpToReadReceipt(action: RoomDetailAction.JumpToReadReceipt) { + room.getUserReadReceipt(action.userId) + ?.let { handleNavigateToEvent(RoomDetailAction.NavigateToEvent(it, true)) } + } + private fun handleSendSticker(action: RoomDetailAction.SendSticker) { room.sendEvent(EventType.STICKER, action.stickerContent.toContent()) } 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 169cba09eb..2f5b2d5387 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 @@ -43,6 +43,8 @@ import im.vector.app.core.platform.VectorBaseFragment import im.vector.app.core.utils.startSharePlainTextIntent import im.vector.app.features.crypto.verification.VerificationBottomSheet import im.vector.app.features.home.AvatarRenderer +import im.vector.app.features.home.room.detail.RoomDetailPendingAction +import im.vector.app.features.home.room.detail.RoomDetailPendingActionStore import im.vector.app.features.roommemberprofile.devices.DeviceListBottomSheet import im.vector.app.features.roommemberprofile.powerlevel.EditPowerLevelDialogs import kotlinx.android.parcel.Parcelize @@ -61,7 +63,8 @@ data class RoomMemberProfileArgs( class RoomMemberProfileFragment @Inject constructor( val viewModelFactory: RoomMemberProfileViewModel.Factory, private val roomMemberProfileController: RoomMemberProfileController, - private val avatarRenderer: AvatarRenderer + private val avatarRenderer: AvatarRenderer, + private val roomDetailPendingActionStore: RoomDetailPendingActionStore ) : VectorBaseFragment(), RoomMemberProfileController.Callback { private val fragmentArgs: RoomMemberProfileArgs by args() @@ -276,11 +279,13 @@ class RoomMemberProfileFragment @Inject constructor( } override fun onJumpToReadReceiptClicked() { - vectorBaseActivity.notImplemented("Jump to read receipts") + roomDetailPendingActionStore.data = RoomDetailPendingAction.JumpToReadReceipt(fragmentArgs.userId) + vectorBaseActivity.finish() } override fun onMentionClicked() { - vectorBaseActivity.notImplemented("Mention") + roomDetailPendingActionStore.data = RoomDetailPendingAction.MentionUser(fragmentArgs.userId) + vectorBaseActivity.finish() } private fun handleShareRoomMemberProfile(permalink: String) { diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListFragment.kt b/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListFragment.kt index 67577e866e..d6d56b8cb9 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListFragment.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListFragment.kt @@ -36,6 +36,7 @@ import im.vector.app.core.extensions.cleanup import im.vector.app.core.extensions.configureWith import im.vector.app.core.platform.VectorBaseFragment import im.vector.app.features.home.AvatarRenderer +import im.vector.app.features.home.room.detail.RoomDetailPendingActionStore import im.vector.app.features.roomprofile.RoomProfileArgs import kotlinx.android.synthetic.main.fragment_room_setting_generic.* import javax.inject.Inject @@ -43,7 +44,8 @@ import javax.inject.Inject class RoomMemberListFragment @Inject constructor( val viewModelFactory: RoomMemberListViewModel.Factory, private val roomMemberListController: RoomMemberListController, - private val avatarRenderer: AvatarRenderer + private val avatarRenderer: AvatarRenderer, + private val roomDetailPendingActionStore: RoomDetailPendingActionStore ) : VectorBaseFragment(), RoomMemberListController.Callback { private val viewModel: RoomMemberListViewModel by fragmentViewModel() @@ -96,6 +98,13 @@ class RoomMemberListFragment @Inject constructor( }) } + override fun onResume() { + super.onResume() + if (roomDetailPendingActionStore.data != null) { + vectorBaseActivity.finish() + } + } + override fun onDestroyView() { recyclerView.cleanup() super.onDestroyView() From 6325ee9310915e54df71ae6b2b9893319294b235 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 5 Oct 2020 18:53:32 +0200 Subject: [PATCH 2/4] "Jump to read receipt" available only for joined members --- .../RoomMemberProfileController.kt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileController.kt b/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileController.kt index ca9ecb62ef..776138a686 100644 --- a/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileController.kt +++ b/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileController.kt @@ -172,13 +172,16 @@ class RoomMemberProfileController @Inject constructor( val membership = state.asyncMembership() ?: return buildProfileSection(stringProvider.getString(R.string.room_profile_section_more)) - buildProfileAction( - id = "read_receipt", - editable = false, - title = stringProvider.getString(R.string.room_member_jump_to_read_receipt), - dividerColor = dividerColor, - action = { callback?.onJumpToReadReceiptClicked() } - ) + + if (membership == Membership.JOIN) { + buildProfileAction( + id = "read_receipt", + editable = false, + title = stringProvider.getString(R.string.room_member_jump_to_read_receipt), + dividerColor = dividerColor, + action = { callback?.onJumpToReadReceiptClicked() } + ) + } val ignoreActionTitle = state.buildIgnoreActionTitle() From e33bc7146bd4568329eb4552f83ffef6f0cdb42f Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 6 Oct 2020 10:05:20 +0200 Subject: [PATCH 3/4] Correction: "Jump to read receipt" available only for members with read receipt info (invited member can have read receipt info from a previous membership) Not live for the moment, I think it is acceptable. Also the Activity will finish itself instead of the Fragment --- .../roommemberprofile/RoomMemberProfileController.kt | 2 +- .../roommemberprofile/RoomMemberProfileViewModel.kt | 3 ++- .../roommemberprofile/RoomMemberProfileViewState.kt | 1 + .../app/features/roomprofile/RoomProfileActivity.kt | 11 +++++++++++ .../roomprofile/members/RoomMemberListFragment.kt | 11 +---------- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileController.kt b/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileController.kt index 776138a686..a3ffd80ade 100644 --- a/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileController.kt +++ b/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileController.kt @@ -173,7 +173,7 @@ class RoomMemberProfileController @Inject constructor( buildProfileSection(stringProvider.getString(R.string.room_profile_section_more)) - if (membership == Membership.JOIN) { + if (state.hasReadReceipt) { buildProfileAction( id = "read_receipt", editable = false, 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 f2c85c96c7..78562ea351 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 @@ -85,7 +85,8 @@ class RoomMemberProfileViewModel @AssistedInject constructor(@Assisted private v setState { copy( isMine = session.myUserId == this.userId, - userMatrixItem = room?.getRoomMember(initialState.userId)?.toMatrixItem()?.let { Success(it) } ?: Uninitialized + userMatrixItem = room?.getRoomMember(initialState.userId)?.toMatrixItem()?.let { Success(it) } ?: Uninitialized, + hasReadReceipt = room?.getUserReadReceipt(initialState.userId) != null ) } observeIgnoredState() diff --git a/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileViewState.kt b/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileViewState.kt index dec003b37d..f943a5cf08 100644 --- a/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileViewState.kt +++ b/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileViewState.kt @@ -39,6 +39,7 @@ data class RoomMemberProfileViewState( val allDevicesAreTrusted: Boolean = false, val allDevicesAreCrossSignedTrusted: Boolean = false, val asyncMembership: Async = Uninitialized, + val hasReadReceipt: Boolean = false, val actionPermissions: ActionPermissions = ActionPermissions() ) : MvRxState { diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileActivity.kt b/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileActivity.kt index 6bcb9f9c7f..734620e378 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileActivity.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileActivity.kt @@ -29,6 +29,7 @@ import im.vector.app.core.extensions.addFragment import im.vector.app.core.extensions.addFragmentToBackstack import im.vector.app.core.platform.ToolbarConfigurable import im.vector.app.core.platform.VectorBaseActivity +import im.vector.app.features.home.room.detail.RoomDetailPendingActionStore import im.vector.app.features.room.RequireActiveMembershipViewEvents import im.vector.app.features.room.RequireActiveMembershipViewModel import im.vector.app.features.room.RequireActiveMembershipViewState @@ -61,6 +62,9 @@ class RoomProfileActivity : @Inject lateinit var requireActiveMembershipViewModelFactory: RequireActiveMembershipViewModel.Factory + @Inject + lateinit var roomDetailPendingActionStore: RoomDetailPendingActionStore + override fun create(initialState: RequireActiveMembershipViewState): RequireActiveMembershipViewModel { return requireActiveMembershipViewModelFactory.create(initialState) } @@ -97,6 +101,13 @@ class RoomProfileActivity : } } + override fun onResume() { + super.onResume() + if (roomDetailPendingActionStore.data != null) { + finish() + } + } + private fun handleRoomLeft(roomLeft: RequireActiveMembershipViewEvents.RoomLeft) { if (roomLeft.leftMessage != null) { Toast.makeText(this, roomLeft.leftMessage, Toast.LENGTH_LONG).show() diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListFragment.kt b/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListFragment.kt index d6d56b8cb9..67577e866e 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListFragment.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListFragment.kt @@ -36,7 +36,6 @@ import im.vector.app.core.extensions.cleanup import im.vector.app.core.extensions.configureWith import im.vector.app.core.platform.VectorBaseFragment import im.vector.app.features.home.AvatarRenderer -import im.vector.app.features.home.room.detail.RoomDetailPendingActionStore import im.vector.app.features.roomprofile.RoomProfileArgs import kotlinx.android.synthetic.main.fragment_room_setting_generic.* import javax.inject.Inject @@ -44,8 +43,7 @@ import javax.inject.Inject class RoomMemberListFragment @Inject constructor( val viewModelFactory: RoomMemberListViewModel.Factory, private val roomMemberListController: RoomMemberListController, - private val avatarRenderer: AvatarRenderer, - private val roomDetailPendingActionStore: RoomDetailPendingActionStore + private val avatarRenderer: AvatarRenderer ) : VectorBaseFragment(), RoomMemberListController.Callback { private val viewModel: RoomMemberListViewModel by fragmentViewModel() @@ -98,13 +96,6 @@ class RoomMemberListFragment @Inject constructor( }) } - override fun onResume() { - super.onResume() - if (roomDetailPendingActionStore.data != null) { - vectorBaseActivity.finish() - } - } - override fun onDestroyView() { recyclerView.cleanup() super.onDestroyView() From 1dfc739f1970dded244786b116c97f6e3598d86f Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 8 Oct 2020 14:19:56 +0200 Subject: [PATCH 4/4] Onuray's review --- .../matrix/android/sdk/api/session/room/read/ReadService.kt | 4 ++-- .../sdk/internal/session/room/read/DefaultReadService.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/read/ReadService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/read/ReadService.kt index 8f76295fe7..4fc13e9228 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/read/ReadService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/read/ReadService.kt @@ -65,11 +65,11 @@ interface ReadService { /** * Get the eventId where the read receipt for the provided user is - * @param otherUserId the userId param to look for + * @param userId the id of the user to look for * * @return the eventId where the read receipt for the provided user is attached, or null if not found */ - fun getUserReadReceipt(otherUserId: String): String? + fun getUserReadReceipt(userId: String): String? /** * Returns a live list of read receipts for a given event diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/read/DefaultReadService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/read/DefaultReadService.kt index 162ad7d895..bea3d6624d 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/read/DefaultReadService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/read/DefaultReadService.kt @@ -107,10 +107,10 @@ internal class DefaultReadService @AssistedInject constructor( } } - override fun getUserReadReceipt(otherUserId: String): String? { + override fun getUserReadReceipt(userId: String): String? { var eventId: String? = null monarchy.doWithRealm { - eventId = ReadReceiptEntity.where(it, roomId = roomId, userId = otherUserId) + eventId = ReadReceiptEntity.where(it, roomId = roomId, userId = userId) .findFirst() ?.eventId }