From b7c0951cbe495022343d3bc24fb0e6cc39c2710e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 9 Mar 2021 17:19:27 +0100 Subject: [PATCH] Speed up sent state display for local echo --- .../helper/MessageInformationDataFactory.kt | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) 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 360702e928..a6bafd6bbd 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,7 +31,6 @@ 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.LocalEcho 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 @@ -91,8 +90,7 @@ class MessageInformationDataFactory @Inject constructor(private val session: Ses eventSendState = event.root.sendState, prevEventSendState = prevEvent?.root?.sendState, anyReadReceipts = event.readReceipts.any { it.user.userId != session.myUserId }, - isMedia = isMedia, - isLocalEcho = LocalEcho.isLocalEchoId(event.eventId) + isMedia = isMedia ) } else { SendStateDecoration.NONE @@ -144,14 +142,11 @@ class MessageInformationDataFactory @Inject constructor(private val session: Ses ) } - private fun getSendStateDecoration( - eventSendState: SendState, - prevEventSendState: SendState?, - anyReadReceipts: Boolean, - isMedia: Boolean, - isLocalEcho: Boolean - ): SendStateDecoration { - return if (eventSendState.isSending() || (eventSendState.isSent() && isLocalEcho)) { + private fun getSendStateDecoration(eventSendState: SendState, + prevEventSendState: SendState?, + anyReadReceipts: Boolean, + isMedia: Boolean): SendStateDecoration { + return if (eventSendState.isSending()) { if (isMedia) SendStateDecoration.SENDING_MEDIA else SendStateDecoration.SENDING_NON_MEDIA } else if (eventSendState.hasFailed()) { SendStateDecoration.FAILED