Skip to content

Commit 20abef2

Browse files
author
Florian Renaud
committed
Filter duplicated events in live voice broadcasts
1 parent 7ba1052 commit 20abef2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

vector/src/main/java/im/vector/app/features/voicebroadcast/listening/usecase/GetLiveVoiceBroadcastChunksUseCase.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import kotlinx.coroutines.flow.Flow
2929
import kotlinx.coroutines.flow.callbackFlow
3030
import kotlinx.coroutines.flow.emptyFlow
3131
import kotlinx.coroutines.flow.flowOf
32+
import kotlinx.coroutines.flow.map
3233
import kotlinx.coroutines.flow.runningReduce
3334
import org.matrix.android.sdk.api.session.events.model.RelationType
3435
import org.matrix.android.sdk.api.session.room.model.message.MessageAudioEvent
@@ -106,6 +107,7 @@ class GetLiveVoiceBroadcastChunksUseCase @Inject constructor(
106107
}
107108
}
108109
.runningReduce { accumulator: List<MessageAudioEvent>, value: List<MessageAudioEvent> -> accumulator.plus(value) }
110+
.map { events -> events.distinctBy { it.sequence } }
109111
}
110112
}
111113

0 commit comments

Comments
 (0)