Fix view event replay

This commit is contained in:
Benoit Marty 2023-01-10 10:39:49 +01:00 committed by Benoit Marty
parent cceb1cd66c
commit 02c61d3fb5

View File

@ -19,6 +19,7 @@ package im.vector.app.core.utils
import im.vector.app.core.platform.VectorViewEvents
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.transform
import java.util.concurrent.CopyOnWriteArraySet
@ -34,7 +35,12 @@ class EventQueue<T : VectorViewEvents>(capacity: Int) : SharedEvents<T> {
innerQueue.tryEmit(OneTimeEvent(event))
}
override fun stream(consumerId: String): Flow<T> = innerQueue.filterNotHandledBy(consumerId)
override fun stream(consumerId: String): Flow<T> = innerQueue
.onEach {
// Ensure that buffered Events will not be sent again to new subscribers.
innerQueue.resetReplayCache()
}
.filterNotHandledBy(consumerId)
}
/**