CurrentSyncState

class CurrentSyncState(currentSyncState: StateFlow<SyncState>) : StateFlow<SyncState>

Constructors

Link copied to clipboard
fun CurrentSyncState(currentSyncState: StateFlow<SyncState>)

Functions

Link copied to clipboard
open suspend override fun collect(collector: FlowCollector<SyncState>): Nothing

Properties

Link copied to clipboard
open override val replayCache: List<SyncState>
Link copied to clipboard
open override val value: SyncState

Extensions

Link copied to clipboard
fun StateFlow<Map<RoomId, StateFlow<Room?>>>.flatten(debounceTimeout: Duration = 200.milliseconds): Flow<Set<Room>>

This collects all rooms, so when one room changes, a new room set gets emitted. A change of the outer flow results in new collect of the inner flows. Because this is an expensive operation, the outer flow is debounced by default.

Link copied to clipboard
suspend fun StateFlow<SyncState>.retryInfiniteWhenSyncIs(syncState: SyncState, vararg moreSyncStates: SyncState, scheduleBase: Duration = 100.milliseconds, scheduleFactor: Double = 2.0, scheduleLimit: Duration = 5.minutes, onError: suspend (error: Throwable) -> Unit = {}, onCancel: suspend () -> Unit = {}, block: suspend () -> Unit)
Link copied to clipboard
suspend fun <T> StateFlow<SyncState>.retryWhenSyncIs(syncState: SyncState, vararg moreSyncStates: SyncState, scheduleBase: Duration = 100.milliseconds, scheduleFactor: Double = 2.0, scheduleLimit: Duration = 5.minutes, onError: suspend (error: Throwable) -> Unit = {}, onCancel: suspend () -> Unit = {}, block: suspend () -> T): T
Link copied to clipboard
@JvmName(name = "toList")
fun Flow<Flow<TimelineEvent>>.toFlowList(maxSize: StateFlow<Int>, minSize: MutableStateFlow<Int> = MutableStateFlow(0)): Flow<List<Flow<TimelineEvent>>>

Converts a flow of timeline events into a flow of list of timeline events limited by maxSize.

@JvmName(name = "toListFromLatest")
fun Flow<Flow<Flow<TimelineEvent>>?>.toFlowList(maxSize: StateFlow<Int>, minSize: MutableStateFlow<Int> = MutableStateFlow(0)): Flow<List<Flow<TimelineEvent>>>

Converts a flow of flow of timeline events into a flow of list of timeline events limited by maxSize.