RoomList: update LoadingState and fix a crash

This commit is contained in:
ganfra 2023-06-26 22:30:12 +02:00
parent 8c66924be9
commit 19e2c104af
5 changed files with 45 additions and 20 deletions

View file

@ -20,14 +20,12 @@ import kotlinx.coroutines.flow.StateFlow
interface RoomSummaryDataSource {
enum class LoadingState {
NotLoaded,
PreLoaded,
PartiallyLoaded,
FullyLoaded,
sealed class LoadingState {
object NotLoaded : LoadingState()
data class Loaded(val numberOfRooms: Int): LoadingState()
}
fun loadingState(): StateFlow<LoadingState>
fun allRoomsLoadingState(): StateFlow<LoadingState>
fun allRooms(): StateFlow<List<RoomSummary>>
fun inviteRooms(): StateFlow<List<RoomSummary>>
fun updateRoomListVisibleRange(range: IntRange)

View file

@ -22,12 +22,12 @@ interface SyncService {
/**
* Tries to start the sync. If already syncing it has no effect.
*/
fun startSync()
fun startSync(): Result<Unit>
/**
* Tries to stop the sync. If service is not syncing it has no effect.
*/
fun stopSync()
fun stopSync(): Result<Unit>
/**
* Flow of [SyncState]. Will be updated as soon as the current [SyncState] changes.