CurrentSyncState

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

Constructors

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

Properties

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

Functions

Link copied to clipboard
open suspend override fun collect(collector: FlowCollector<SyncState>): Nothing
Link copied to clipboard
Link copied to clipboard
fun <K, V> Flow<Map<K, Flow<V?>>?>.flatten(filterNullValues: Boolean = true, throttle: Duration = 200.milliseconds): Flow<Map<K, V?>?>

A change of the outer flow results in new collect of the inner flows. Because this is an expensive operation, the outer flow is throttled by default.

fun StateFlow<Map<RoomId, StateFlow<Room?>>>.flatten(throttle: Duration = 200.milliseconds, filterUpgradedRooms: Boolean = true): 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 throttled by default.

Link copied to clipboard
suspend fun StateFlow<SyncState>.retryLoopWhenSyncIs(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 = "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.

@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.