Skip to content
Snippets Groups Projects
Commit e8c67dc9 authored by Adrien Béraud's avatar Adrien Béraud Committed by Adrien Béraud
Browse files

conversation: optimize computing last displayed

GitLab: #1643
Change-Id: Ia6fcd85a2c648bb05a19cc3c55cf22fb3f1dcdcd
parent fb90a69b
No related branches found
No related tags found
No related merge requests found
......@@ -352,13 +352,12 @@ class ConversationAdapter(
// Remove user from statusMap.
val modifiedStatusMap = interaction.statusMap
.filter { conversation.findContact(net.jami.model.Uri.fromId(it.key))?.isUser != true }
val isDisplayed = modifiedStatusMap.any { it.value == Interaction.MessageStates.DISPLAYED }
val isReceived = modifiedStatusMap.any { it.value == Interaction.MessageStates.SUCCESS }
val lastDisplayedIdx = conversation.lastDisplayedMessages
.mapValues { mInteractions.indexOf(conversation.getMessage(it.value)) }
val currentIdx = mInteractions.indexOf(interaction)
val contacts = lastDisplayedIdx.filter { it.value == currentIdx }.map { it.key }
val contacts = conversation.lastDisplayedMessages
.filter { it.value == interaction.messageId }
.map { it.key }
// Case 1: Message is sending
if(!isDisplayed && !isReceived){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment