Fix issue in e2e rooms.
This commit is contained in:
parent
b7c0951cbe
commit
47f7c91a3b
|
@ -37,6 +37,9 @@ class TimelineItemFactory @Inject constructor(private val messageItemFactory: Me
|
||||||
private val callItemFactory: CallItemFactory,
|
private val callItemFactory: CallItemFactory,
|
||||||
private val userPreferencesProvider: UserPreferencesProvider) {
|
private val userPreferencesProvider: UserPreferencesProvider) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reminder: nextEvent is older and prevEvent is newer.
|
||||||
|
*/
|
||||||
fun create(event: TimelineEvent,
|
fun create(event: TimelineEvent,
|
||||||
prevEvent: TimelineEvent?,
|
prevEvent: TimelineEvent?,
|
||||||
nextEvent: TimelineEvent?,
|
nextEvent: TimelineEvent?,
|
||||||
|
|
|
@ -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.extensions.orFalse
|
||||||
import org.matrix.android.sdk.api.session.Session
|
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.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.events.model.toModel
|
||||||
import org.matrix.android.sdk.api.session.room.model.ReferencesAggregatedContent
|
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.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.send.SendState
|
||||||
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
|
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
|
||||||
import org.matrix.android.sdk.api.session.room.timeline.getLastMessageContent
|
import org.matrix.android.sdk.api.session.room.timeline.getLastMessageContent
|
||||||
|
@ -79,18 +75,11 @@ class MessageInformationDataFactory @Inject constructor(private val session: Ses
|
||||||
// SendState Decoration
|
// SendState Decoration
|
||||||
val isSentByMe = event.root.senderId == session.myUserId
|
val isSentByMe = event.root.senderId == session.myUserId
|
||||||
val sendStateDecoration = if (isSentByMe) {
|
val sendStateDecoration = if (isSentByMe) {
|
||||||
val isMedia = when (event.root.content?.toModel<MessageContent>()) {
|
|
||||||
is MessageImageContent,
|
|
||||||
is MessageVideoContent,
|
|
||||||
is MessageAudioContent,
|
|
||||||
is MessageFileContent -> true
|
|
||||||
else -> false
|
|
||||||
}
|
|
||||||
getSendStateDecoration(
|
getSendStateDecoration(
|
||||||
eventSendState = event.root.sendState,
|
eventSendState = event.root.sendState,
|
||||||
prevEventSendState = prevEvent?.root?.sendState,
|
prevEventSendState = prevEvent?.root?.sendState,
|
||||||
anyReadReceipts = event.readReceipts.any { it.user.userId != session.myUserId },
|
anyReadReceipts = event.readReceipts.any { it.user.userId != session.myUserId },
|
||||||
isMedia = isMedia
|
isMedia = event.root.isAttachmentMessage()
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
SendStateDecoration.NONE
|
SendStateDecoration.NONE
|
||||||
|
|
Loading…
Reference in New Issue