From 2adafbeb034c4611d31b47efeabe9ddf4eacf3d3 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 20 May 2020 12:19:30 +0200 Subject: [PATCH] Uploads: use SenderInfo in TimelineEvent --- .../SenderInfo.kt} | 20 +++++++++-------- .../session/room/timeline/TimelineEvent.kt | 13 ++--------- .../api/session/room/uploads/UploadEvent.kt | 3 ++- .../matrix/android/api/util/MatrixItem.kt | 3 +++ .../database/mapper/TimelineEventMapper.kt | 11 ++++++---- .../room/send/LocalEchoEventFactory.kt | 2 +- .../session/room/uploads/GetUploadsTask.kt | 14 ++++++------ .../home/room/detail/RoomDetailFragment.kt | 8 ++----- .../factory/MergedHeaderItemFactory.kt | 12 ++++------ .../format/DisplayableEventFormatter.kt | 2 +- .../timeline/format/NoticeEventFormatter.kt | 22 +++++++++---------- .../helper/MessageInformationDataFactory.kt | 10 ++++----- .../reactions/ViewReactionsViewModel.kt | 2 +- .../notifications/NotifiableEventResolver.kt | 6 ++--- .../uploads/files/UploadsFileController.kt | 2 +- 15 files changed, 60 insertions(+), 70 deletions(-) rename matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/{uploads/UploadSenderInfo.kt => sender/SenderInfo.kt} (63%) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/uploads/UploadSenderInfo.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/sender/SenderInfo.kt similarity index 63% rename from matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/uploads/UploadSenderInfo.kt rename to matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/sender/SenderInfo.kt index 0fa4b2cb68..c3f0df8312 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/uploads/UploadSenderInfo.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/sender/SenderInfo.kt @@ -14,20 +14,22 @@ * limitations under the License. */ -package im.vector.matrix.android.api.session.room.uploads +package im.vector.matrix.android.api.session.room.sender -// TODO Maybe use this model for TimelineEvent as well -data class UploadSenderInfo( - val senderId: String, - val senderName: String?, +data class SenderInfo( + val userId: String, + /** + * Consider using [getDisambiguatedDisplayName] + */ + val displayName: String?, val isUniqueDisplayName: Boolean, - val senderAvatar: String? + val avatarUrl: String? ) { fun getDisambiguatedDisplayName(): String { return when { - senderName.isNullOrBlank() -> senderId - isUniqueDisplayName -> senderName - else -> "$senderName (${senderId})" + displayName.isNullOrBlank() -> userId + isUniqueDisplayName -> displayName + else -> "$displayName (${userId})" } } } diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/timeline/TimelineEvent.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/timeline/TimelineEvent.kt index 7adc438e20..273ea2366a 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/timeline/TimelineEvent.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/timeline/TimelineEvent.kt @@ -26,6 +26,7 @@ import im.vector.matrix.android.api.session.room.model.ReadReceipt import im.vector.matrix.android.api.session.room.model.message.MessageContent import im.vector.matrix.android.api.session.room.model.message.MessageStickerContent import im.vector.matrix.android.api.session.room.model.message.isReply +import im.vector.matrix.android.api.session.room.sender.SenderInfo import im.vector.matrix.android.api.util.ContentUtils.extractUsefulTextFromReply import im.vector.matrix.android.internal.crypto.model.event.EncryptedEventContent @@ -39,9 +40,7 @@ data class TimelineEvent( val localId: Long, val eventId: String, val displayIndex: Int, - val senderName: String?, - val isUniqueDisplayName: Boolean, - val senderAvatar: String?, + val senderInfo: SenderInfo, val annotations: EventAnnotationsSummary? = null, val readReceipts: List = emptyList() ) { @@ -69,14 +68,6 @@ data class TimelineEvent( } } - fun getDisambiguatedDisplayName(): String { - return when { - senderName.isNullOrBlank() -> root.senderId ?: "" - isUniqueDisplayName -> senderName - else -> "$senderName (${root.senderId})" - } - } - /** * Get the metadata associated with a key. * @param key the key to get the metadata diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/uploads/UploadEvent.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/uploads/UploadEvent.kt index 93ce59a233..5df2b9c9e0 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/uploads/UploadEvent.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/uploads/UploadEvent.kt @@ -18,6 +18,7 @@ package im.vector.matrix.android.api.session.room.uploads import im.vector.matrix.android.api.session.events.model.Event import im.vector.matrix.android.api.session.room.model.message.MessageWithAttachmentContent +import im.vector.matrix.android.api.session.room.sender.SenderInfo /** * Wrapper around on Event. @@ -27,5 +28,5 @@ data class UploadEvent( val root: Event, val eventId: String, val contentWithAttachmentContent: MessageWithAttachmentContent, - val uploadSenderInfo: UploadSenderInfo + val senderInfo: SenderInfo ) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/util/MatrixItem.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/util/MatrixItem.kt index d5aa897c7d..95c0435f1b 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/util/MatrixItem.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/util/MatrixItem.kt @@ -21,6 +21,7 @@ import im.vector.matrix.android.api.session.group.model.GroupSummary import im.vector.matrix.android.api.session.room.model.RoomMemberSummary import im.vector.matrix.android.api.session.room.model.RoomSummary import im.vector.matrix.android.api.session.room.model.roomdirectory.PublicRoom +import im.vector.matrix.android.api.session.room.sender.SenderInfo import im.vector.matrix.android.api.session.user.model.User import java.util.Locale @@ -154,3 +155,5 @@ fun RoomSummary.toRoomAliasMatrixItem() = MatrixItem.RoomAliasItem(canonicalAlia fun PublicRoom.toMatrixItem() = MatrixItem.RoomItem(roomId, name ?: getPrimaryAlias() ?: "", avatarUrl) fun RoomMemberSummary.toMatrixItem() = MatrixItem.UserItem(userId, displayName, avatarUrl) + +fun SenderInfo.toMatrixItem() = MatrixItem.UserItem(userId, getDisambiguatedDisplayName(), avatarUrl) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/database/mapper/TimelineEventMapper.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/database/mapper/TimelineEventMapper.kt index 4bd9b9855b..6653c1a448 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/database/mapper/TimelineEventMapper.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/database/mapper/TimelineEventMapper.kt @@ -18,7 +18,7 @@ package im.vector.matrix.android.internal.database.mapper import im.vector.matrix.android.api.session.events.model.Event import im.vector.matrix.android.api.session.room.model.ReadReceipt - +import im.vector.matrix.android.api.session.room.sender.SenderInfo import im.vector.matrix.android.api.session.room.timeline.TimelineEvent import im.vector.matrix.android.internal.database.model.TimelineEventEntity import javax.inject.Inject @@ -41,9 +41,12 @@ internal class TimelineEventMapper @Inject constructor(private val readReceiptsS annotations = timelineEventEntity.annotations?.asDomain(), localId = timelineEventEntity.localId, displayIndex = timelineEventEntity.displayIndex, - senderName = timelineEventEntity.senderName, - isUniqueDisplayName = timelineEventEntity.isUniqueDisplayName, - senderAvatar = timelineEventEntity.senderAvatar, + senderInfo = SenderInfo( + userId = timelineEventEntity.root?.sender ?: "", + displayName = timelineEventEntity.senderName, + isUniqueDisplayName = timelineEventEntity.isUniqueDisplayName, + avatarUrl = timelineEventEntity.senderAvatar + ), readReceipts = readReceipts ?.distinctBy { it.user diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/send/LocalEchoEventFactory.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/send/LocalEchoEventFactory.kt index 2a24094b5d..2d1e2775c0 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/send/LocalEchoEventFactory.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/send/LocalEchoEventFactory.kt @@ -202,7 +202,7 @@ internal class LocalEchoEventFactory @Inject constructor( permalink, stringProvider.getString(R.string.message_reply_to_prefix), userLink, - originalEvent.getDisambiguatedDisplayName(), + originalEvent.senderInfo.getDisambiguatedDisplayName(), body.takeFormatted(), createTextContent(newBodyText, newBodyAutoMarkdown).takeFormatted() ) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/uploads/GetUploadsTask.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/uploads/GetUploadsTask.kt index f6fd2a442b..cc78a02c88 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/uploads/GetUploadsTask.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/uploads/GetUploadsTask.kt @@ -20,9 +20,9 @@ import com.zhuinden.monarchy.Monarchy import im.vector.matrix.android.api.session.events.model.toModel import im.vector.matrix.android.api.session.room.model.message.MessageContent import im.vector.matrix.android.api.session.room.model.message.MessageWithAttachmentContent +import im.vector.matrix.android.api.session.room.sender.SenderInfo import im.vector.matrix.android.api.session.room.uploads.GetUploadsResult import im.vector.matrix.android.api.session.room.uploads.UploadEvent -import im.vector.matrix.android.api.session.room.uploads.UploadSenderInfo import im.vector.matrix.android.internal.network.executeRequest import im.vector.matrix.android.internal.session.filter.FilterFactory import im.vector.matrix.android.internal.session.room.RoomAPI @@ -60,7 +60,7 @@ internal class DefaultGetUploadsTask @Inject constructor( var uploadEvents = listOf() - val cacheOfSenderInfos = mutableMapOf() + val cacheOfSenderInfos = mutableMapOf() // Get a snapshot of all room members monarchy.doWithRealm { realm -> @@ -74,11 +74,11 @@ internal class DefaultGetUploadsTask @Inject constructor( val senderInfo = cacheOfSenderInfos.getOrPut(senderId) { val roomMemberSummaryEntity = roomMemberHelper.getLastRoomMember(senderId) - UploadSenderInfo( - senderId = senderId, - senderName = roomMemberSummaryEntity?.displayName, + SenderInfo( + userId = senderId, + displayName = roomMemberSummaryEntity?.displayName, isUniqueDisplayName = roomMemberHelper.isUniqueDisplayName(roomMemberSummaryEntity?.displayName), - senderAvatar = roomMemberSummaryEntity?.avatarUrl + avatarUrl = roomMemberSummaryEntity?.avatarUrl ) } @@ -86,7 +86,7 @@ internal class DefaultGetUploadsTask @Inject constructor( root = event, eventId = eventId, contentWithAttachmentContent = messageWithAttachmentContent, - uploadSenderInfo = senderInfo + senderInfo = senderInfo ) } } diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt index bd9a4c9d7e..9dcf0d42ea 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt @@ -458,7 +458,7 @@ class RoomDetailFragment @Inject constructor( autoCompleter.enterSpecialMode() // switch to expanded bar composerLayout.composerRelatedMessageTitle.apply { - text = event.getDisambiguatedDisplayName() + text = event.senderInfo.getDisambiguatedDisplayName() setTextColor(ContextCompat.getColor(requireContext(), getColorFromUserId(event.root.senderId))) } @@ -477,11 +477,7 @@ class RoomDetailFragment @Inject constructor( composerLayout.composerRelatedMessageActionIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), iconRes)) composerLayout.sendButton.contentDescription = getString(descriptionRes) - avatarRenderer.render( - MatrixItem.UserItem(event.root.senderId - ?: "", event.getDisambiguatedDisplayName(), event.senderAvatar), - composerLayout.composerRelatedMessageAvatar - ) + avatarRenderer.render(event.senderInfo.toMatrixItem(), composerLayout.composerRelatedMessageAvatar) composerLayout.expand { if (isAdded) { diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MergedHeaderItemFactory.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MergedHeaderItemFactory.kt index 9529693e6b..70d70c2765 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MergedHeaderItemFactory.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MergedHeaderItemFactory.kt @@ -85,12 +85,10 @@ class MergedHeaderItemFactory @Inject constructor(private val avatarRenderer: Av if (!highlighted && mergedEvent.root.eventId == eventIdToHighlight) { highlighted = true } - val senderAvatar = mergedEvent.senderAvatar - val senderName = mergedEvent.getDisambiguatedDisplayName() val data = BasedMergedItem.Data( userId = mergedEvent.root.senderId ?: "", - avatarUrl = senderAvatar, - memberName = senderName, + avatarUrl = mergedEvent.senderInfo.avatarUrl, + memberName = mergedEvent.senderInfo.getDisambiguatedDisplayName(), localId = mergedEvent.localId, eventId = mergedEvent.root.eventId ?: "" ) @@ -158,12 +156,10 @@ class MergedHeaderItemFactory @Inject constructor(private val avatarRenderer: Av if (!highlighted && mergedEvent.root.eventId == eventIdToHighlight) { highlighted = true } - val senderAvatar = mergedEvent.senderAvatar - val senderName = mergedEvent.getDisambiguatedDisplayName() val data = BasedMergedItem.Data( userId = mergedEvent.root.senderId ?: "", - avatarUrl = senderAvatar, - memberName = senderName, + avatarUrl = mergedEvent.senderInfo.avatarUrl, + memberName = mergedEvent.senderInfo.getDisambiguatedDisplayName(), localId = mergedEvent.localId, eventId = mergedEvent.root.eventId ?: "" ) diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/format/DisplayableEventFormatter.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/format/DisplayableEventFormatter.kt index 2f7b52de62..ac587a8250 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/format/DisplayableEventFormatter.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/format/DisplayableEventFormatter.kt @@ -45,7 +45,7 @@ class DisplayableEventFormatter @Inject constructor( return stringProvider.getString(R.string.encrypted_message) } - val senderName = timelineEvent.getDisambiguatedDisplayName() + val senderName = timelineEvent.senderInfo.getDisambiguatedDisplayName() when (timelineEvent.root.getClearType()) { EventType.MESSAGE -> { diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/format/NoticeEventFormatter.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/format/NoticeEventFormatter.kt index f29bd72e0a..99fa25e76f 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/format/NoticeEventFormatter.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/format/NoticeEventFormatter.kt @@ -47,20 +47,20 @@ class NoticeEventFormatter @Inject constructor(private val sessionHolder: Active fun format(timelineEvent: TimelineEvent): CharSequence? { return when (val type = timelineEvent.root.getClearType()) { - EventType.STATE_ROOM_JOIN_RULES -> formatJoinRulesEvent(timelineEvent.root, timelineEvent.getDisambiguatedDisplayName()) + EventType.STATE_ROOM_JOIN_RULES -> formatJoinRulesEvent(timelineEvent.root, timelineEvent.senderInfo.getDisambiguatedDisplayName()) EventType.STATE_ROOM_CREATE -> formatRoomCreateEvent(timelineEvent.root) - EventType.STATE_ROOM_NAME -> formatRoomNameEvent(timelineEvent.root, timelineEvent.getDisambiguatedDisplayName()) - EventType.STATE_ROOM_TOPIC -> formatRoomTopicEvent(timelineEvent.root, timelineEvent.getDisambiguatedDisplayName()) - EventType.STATE_ROOM_MEMBER -> formatRoomMemberEvent(timelineEvent.root, timelineEvent.getDisambiguatedDisplayName()) - EventType.STATE_ROOM_ALIASES -> formatRoomAliasesEvent(timelineEvent.root, timelineEvent.getDisambiguatedDisplayName()) - EventType.STATE_ROOM_CANONICAL_ALIAS -> formatRoomCanonicalAliasEvent(timelineEvent.root, timelineEvent.getDisambiguatedDisplayName()) - EventType.STATE_ROOM_HISTORY_VISIBILITY -> formatRoomHistoryVisibilityEvent(timelineEvent.root, timelineEvent.getDisambiguatedDisplayName()) - EventType.STATE_ROOM_GUEST_ACCESS -> formatRoomGuestAccessEvent(timelineEvent.root, timelineEvent.getDisambiguatedDisplayName()) - EventType.STATE_ROOM_ENCRYPTION -> formatRoomEncryptionEvent(timelineEvent.root, timelineEvent.getDisambiguatedDisplayName()) - EventType.STATE_ROOM_TOMBSTONE -> formatRoomTombstoneEvent(timelineEvent.getDisambiguatedDisplayName()) + EventType.STATE_ROOM_NAME -> formatRoomNameEvent(timelineEvent.root, timelineEvent.senderInfo.getDisambiguatedDisplayName()) + EventType.STATE_ROOM_TOPIC -> formatRoomTopicEvent(timelineEvent.root, timelineEvent.senderInfo.getDisambiguatedDisplayName()) + EventType.STATE_ROOM_MEMBER -> formatRoomMemberEvent(timelineEvent.root, timelineEvent.senderInfo.getDisambiguatedDisplayName()) + EventType.STATE_ROOM_ALIASES -> formatRoomAliasesEvent(timelineEvent.root, timelineEvent.senderInfo.getDisambiguatedDisplayName()) + EventType.STATE_ROOM_CANONICAL_ALIAS -> formatRoomCanonicalAliasEvent(timelineEvent.root, timelineEvent.senderInfo.getDisambiguatedDisplayName()) + EventType.STATE_ROOM_HISTORY_VISIBILITY -> formatRoomHistoryVisibilityEvent(timelineEvent.root, timelineEvent.senderInfo.getDisambiguatedDisplayName()) + EventType.STATE_ROOM_GUEST_ACCESS -> formatRoomGuestAccessEvent(timelineEvent.root, timelineEvent.senderInfo.getDisambiguatedDisplayName()) + EventType.STATE_ROOM_ENCRYPTION -> formatRoomEncryptionEvent(timelineEvent.root, timelineEvent.senderInfo.getDisambiguatedDisplayName()) + EventType.STATE_ROOM_TOMBSTONE -> formatRoomTombstoneEvent(timelineEvent.senderInfo.getDisambiguatedDisplayName()) EventType.CALL_INVITE, EventType.CALL_HANGUP, - EventType.CALL_ANSWER -> formatCallEvent(timelineEvent.root, timelineEvent.getDisambiguatedDisplayName()) + EventType.CALL_ANSWER -> formatCallEvent(timelineEvent.root, timelineEvent.senderInfo.getDisambiguatedDisplayName()) EventType.MESSAGE, EventType.REACTION, EventType.KEY_VERIFICATION_START, diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/helper/MessageInformationDataFactory.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/helper/MessageInformationDataFactory.kt index 695da73f89..92374edea7 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/helper/MessageInformationDataFactory.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/helper/MessageInformationDataFactory.kt @@ -64,16 +64,14 @@ class MessageInformationDataFactory @Inject constructor(private val session: Ses val showInformation = addDaySeparator - || event.senderAvatar != nextEvent?.senderAvatar - || event.getDisambiguatedDisplayName() != nextEvent?.getDisambiguatedDisplayName() + || event.senderInfo.avatarUrl != nextEvent?.senderInfo?.avatarUrl + || event.senderInfo.getDisambiguatedDisplayName() != nextEvent?.senderInfo?.getDisambiguatedDisplayName() || (nextEvent.root.getClearType() != EventType.MESSAGE && nextEvent.root.getClearType() != EventType.ENCRYPTED) || isNextMessageReceivedMoreThanOneHourAgo || isTileTypeMessage(nextEvent) val time = dateFormatter.formatMessageHour(date) - val avatarUrl = event.senderAvatar - val memberName = event.getDisambiguatedDisplayName() - val formattedMemberName = span(memberName) { + val formattedMemberName = span(event.senderInfo.getDisambiguatedDisplayName()) { textColor = colorProvider.getColor(getColorFromUserId(event.root.senderId)) } @@ -85,7 +83,7 @@ class MessageInformationDataFactory @Inject constructor(private val session: Ses sendState = event.root.sendState, time = time, ageLocalTS = event.root.ageLocalTs, - avatarUrl = avatarUrl, + avatarUrl = event.senderInfo.avatarUrl, memberName = formattedMemberName, showInformation = showInformation, orderedReactionList = event.annotations?.reactionsSummary diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/reactions/ViewReactionsViewModel.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/reactions/ViewReactionsViewModel.kt index 05cdbc0fd8..25e407eeb1 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/reactions/ViewReactionsViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/reactions/ViewReactionsViewModel.kt @@ -111,7 +111,7 @@ class ViewReactionsViewModel @AssistedInject constructor(@Assisted event.root.eventId!!, summary.key, event.root.senderId ?: "", - event.getDisambiguatedDisplayName(), + event.senderInfo.getDisambiguatedDisplayName(), dateFormatter.formatRelativeDateTime(event.root.originServerTs) ) diff --git a/vector/src/main/java/im/vector/riotx/features/notifications/NotifiableEventResolver.kt b/vector/src/main/java/im/vector/riotx/features/notifications/NotifiableEventResolver.kt index 1f9f54127b..9401c69ad1 100644 --- a/vector/src/main/java/im/vector/riotx/features/notifications/NotifiableEventResolver.kt +++ b/vector/src/main/java/im/vector/riotx/features/notifications/NotifiableEventResolver.kt @@ -93,7 +93,7 @@ class NotifiableEventResolver @Inject constructor(private val stringProvider: St // Ok room is not known in store, but we can still display something val body = displayableEventFormatter.format(event, false) val roomName = stringProvider.getString(R.string.notification_unknown_room_name) - val senderDisplayName = event.getDisambiguatedDisplayName() + val senderDisplayName = event.senderInfo.getDisambiguatedDisplayName() val notifiableEvent = NotifiableMessageEvent( eventId = event.root.eventId!!, @@ -126,7 +126,7 @@ class NotifiableEventResolver @Inject constructor(private val stringProvider: St val body = displayableEventFormatter.format(event, false).toString() val roomName = room.roomSummary()?.displayName ?: "" - val senderDisplayName = event.getDisambiguatedDisplayName() + val senderDisplayName = event.senderInfo.getDisambiguatedDisplayName() val notifiableEvent = NotifiableMessageEvent( eventId = event.root.eventId!!, @@ -151,7 +151,7 @@ class NotifiableEventResolver @Inject constructor(private val stringProvider: St ContentUrlResolver.ThumbnailMethod.SCALE) notifiableEvent.senderAvatarPath = session.contentUrlResolver() - .resolveThumbnail(event.senderAvatar, + .resolveThumbnail(event.senderInfo.avatarUrl, 250, 250, ContentUrlResolver.ThumbnailMethod.SCALE) diff --git a/vector/src/main/java/im/vector/riotx/features/roomprofile/uploads/files/UploadsFileController.kt b/vector/src/main/java/im/vector/riotx/features/roomprofile/uploads/files/UploadsFileController.kt index 918fc433c9..8c4dd1f300 100644 --- a/vector/src/main/java/im/vector/riotx/features/roomprofile/uploads/files/UploadsFileController.kt +++ b/vector/src/main/java/im/vector/riotx/features/roomprofile/uploads/files/UploadsFileController.kt @@ -109,7 +109,7 @@ class UploadsFileController @Inject constructor( id(uploadEvent.eventId) title(uploadEvent.contentWithAttachmentContent.body) subtitle(stringProvider.getString(R.string.uploads_files_subtitle, - uploadEvent.uploadSenderInfo.getDisambiguatedDisplayName(), + uploadEvent.senderInfo.getDisambiguatedDisplayName(), dateFormatter.formatRelativeDateTime(uploadEvent.root.originServerTs))) listener(object : UploadsFileItem.Listener { override fun onItemClicked() {