mirror of
https://github.com/element-hq/element-android
synced 2024-11-23 09:55:40 +03:00
Fix view event replay
This commit is contained in:
parent
cceb1cd66c
commit
02c61d3fb5
1 changed files with 7 additions and 1 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue