Do not decorate local echos as sent.
This commit is contained in:
parent
f5f16fd330
commit
ab304b0b9f
|
@ -31,6 +31,7 @@ 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
|
||||
|
@ -76,7 +77,9 @@ class MessageInformationDataFactory @Inject constructor(private val session: Ses
|
|||
val time = dateFormatter.format(event.root.originServerTs, DateFormatKind.MESSAGE_SIMPLE)
|
||||
val e2eDecoration = getE2EDecoration(event)
|
||||
|
||||
// SendState Decoration
|
||||
val isSentByMe = event.root.senderId == session.myUserId
|
||||
val isLocalEcho = LocalEcho.isLocalEchoId(event.eventId)
|
||||
val sendStateDecoration = if (isSentByMe) {
|
||||
val isMedia = when (event.root.content?.toModel<MessageContent>()) {
|
||||
is MessageImageContent,
|
||||
|
@ -85,7 +88,12 @@ class MessageInformationDataFactory @Inject constructor(private val session: Ses
|
|||
is MessageFileContent -> true
|
||||
else -> false
|
||||
}
|
||||
getSendStateDecoration(event.root.sendState, prevEvent?.root?.sendState, event.readReceipts.any { it.user.userId != session.myUserId }, isMedia)
|
||||
getSendStateDecoration(
|
||||
eventSendState = event.root.sendState,
|
||||
prevEventSendState = prevEvent?.root?.sendState,
|
||||
anyReadReceipts = event.readReceipts.any { it.user.userId != session.myUserId },
|
||||
isMedia = isMedia,
|
||||
isLocalEcho = isLocalEcho)
|
||||
} else {
|
||||
SendStateDecoration.NONE
|
||||
}
|
||||
|
@ -136,8 +144,14 @@ class MessageInformationDataFactory @Inject constructor(private val session: Ses
|
|||
)
|
||||
}
|
||||
|
||||
private fun getSendStateDecoration(eventSendState: SendState, prevEventSendState: SendState?, anyReadReceipts: Boolean, isMedia: Boolean): SendStateDecoration {
|
||||
return if (eventSendState.isSending()) {
|
||||
private fun getSendStateDecoration(
|
||||
eventSendState: SendState,
|
||||
prevEventSendState: SendState?,
|
||||
anyReadReceipts: Boolean,
|
||||
isMedia: Boolean,
|
||||
isLocalEcho: Boolean
|
||||
): SendStateDecoration {
|
||||
return if (eventSendState.isSending() || (eventSendState.isSent() && isLocalEcho)) {
|
||||
if (isMedia) SendStateDecoration.SENDING_MEDIA else SendStateDecoration.SENDING_NON_MEDIA
|
||||
} else if (eventSendState.hasFailed()) {
|
||||
SendStateDecoration.FAILED
|
||||
|
|
Loading…
Reference in New Issue