Current Sync State
Functions
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
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.
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.