Merge pull request #7502 from vector-im/bugfix/fre/voice_broadcast_duplicated_chunks

Voice Broadcast - Fix duplicated chunks in the internal playlist during live broadcasts
This commit is contained in:
Florian Renaud 2022-11-02 10:53:09 +01:00 committed by GitHub
commit dac89add67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

1
changelog.d/7502.bugfix Normal file
View File

@ -0,0 +1 @@
Voice Broadcast - Fix duplicated voice messages in the internal playlist

View File

@ -29,6 +29,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.callbackFlow
import kotlinx.coroutines.flow.emptyFlow
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.runningReduce
import org.matrix.android.sdk.api.session.events.model.RelationType
import org.matrix.android.sdk.api.session.room.model.message.MessageAudioEvent
@ -106,6 +107,7 @@ class GetLiveVoiceBroadcastChunksUseCase @Inject constructor(
}
}
.runningReduce { accumulator: List<MessageAudioEvent>, value: List<MessageAudioEvent> -> accumulator.plus(value) }
.map { events -> events.distinctBy { it.sequence } }
}
}