From 47f7c91a3bd65d1e2994289e4d05acd9ff4e55b3 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 9 Mar 2021 18:23:25 +0100 Subject: [PATCH] Fix issue in e2e rooms. --- .../timeline/factory/TimelineItemFactory.kt | 3 +++ .../helper/MessageInformationDataFactory.kt | 15 ++------------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/TimelineItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/TimelineItemFactory.kt index f1df2ae802..ccc8289e08 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/TimelineItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/TimelineItemFactory.kt @@ -37,6 +37,9 @@ class TimelineItemFactory @Inject constructor(private val messageItemFactory: Me private val callItemFactory: CallItemFactory, private val userPreferencesProvider: UserPreferencesProvider) { + /** + * Reminder: nextEvent is older and prevEvent is newer. + */ fun create(event: TimelineEvent, prevEvent: TimelineEvent?, nextEvent: TimelineEvent?, diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MessageInformationDataFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MessageInformationDataFactory.kt index a6bafd6bbd..09f173de14 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MessageInformationDataFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MessageInformationDataFactory.kt @@ -31,14 +31,10 @@ import org.matrix.android.sdk.api.crypto.VerificationState import org.matrix.android.sdk.api.extensions.orFalse import org.matrix.android.sdk.api.session.Session import org.matrix.android.sdk.api.session.events.model.EventType +import org.matrix.android.sdk.api.session.events.model.isAttachmentMessage import org.matrix.android.sdk.api.session.events.model.toModel import org.matrix.android.sdk.api.session.room.model.ReferencesAggregatedContent -import org.matrix.android.sdk.api.session.room.model.message.MessageAudioContent -import org.matrix.android.sdk.api.session.room.model.message.MessageContent -import org.matrix.android.sdk.api.session.room.model.message.MessageFileContent -import org.matrix.android.sdk.api.session.room.model.message.MessageImageContent import org.matrix.android.sdk.api.session.room.model.message.MessageVerificationRequestContent -import org.matrix.android.sdk.api.session.room.model.message.MessageVideoContent import org.matrix.android.sdk.api.session.room.send.SendState import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent import org.matrix.android.sdk.api.session.room.timeline.getLastMessageContent @@ -79,18 +75,11 @@ class MessageInformationDataFactory @Inject constructor(private val session: Ses // SendState Decoration val isSentByMe = event.root.senderId == session.myUserId val sendStateDecoration = if (isSentByMe) { - val isMedia = when (event.root.content?.toModel()) { - is MessageImageContent, - is MessageVideoContent, - is MessageAudioContent, - is MessageFileContent -> true - else -> false - } getSendStateDecoration( eventSendState = event.root.sendState, prevEventSendState = prevEvent?.root?.sendState, anyReadReceipts = event.readReceipts.any { it.user.userId != session.myUserId }, - isMedia = isMedia + isMedia = event.root.isAttachmentMessage() ) } else { SendStateDecoration.NONE