Make SyncState values match SyncServiceState values.
This commit is contained in:
@@ -164,7 +164,7 @@ class LoggedInFlowNode @AssistedInject constructor(
|
||||
syncService.syncState,
|
||||
networkMonitor.connectivity
|
||||
) { syncState, networkStatus ->
|
||||
syncState == SyncState.InError && networkStatus == NetworkStatus.Online
|
||||
syncState == SyncState.Error && networkStatus == NetworkStatus.Online
|
||||
}
|
||||
.distinctUntilChanged()
|
||||
.collect { restartSync ->
|
||||
|
||||
@@ -30,7 +30,7 @@ open class LoggedInStateProvider : PreviewParameterProvider<LoggedInState> {
|
||||
}
|
||||
|
||||
fun aLoggedInState(
|
||||
syncState: SyncState = SyncState.Syncing,
|
||||
syncState: SyncState = SyncState.Running,
|
||||
) = LoggedInState(
|
||||
syncState = syncState,
|
||||
permissionsState = createDummyPostNotificationPermissionsState(),
|
||||
|
||||
@@ -84,8 +84,8 @@ fun SyncStateView(
|
||||
|
||||
private fun SyncState.mustBeVisible() = when (this) {
|
||||
SyncState.Idle -> true
|
||||
SyncState.Syncing -> false
|
||||
SyncState.InError -> false /* In this case, the network error banner can be displayed */
|
||||
SyncState.Running -> false
|
||||
SyncState.Error -> false /* In this case, the network error banner can be displayed */
|
||||
SyncState.Terminated -> false
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package io.element.android.libraries.matrix.api.sync
|
||||
|
||||
enum class SyncState {
|
||||
Idle,
|
||||
Syncing,
|
||||
InError,
|
||||
Running,
|
||||
Error,
|
||||
Terminated,
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ class RustMatrixClient constructor(
|
||||
client.setDelegate(clientDelegate)
|
||||
rustSyncService.syncState
|
||||
.onEach { syncState ->
|
||||
if (syncState == SyncState.Syncing) {
|
||||
if (syncState == SyncState.Running) {
|
||||
onSlidingSyncUpdate()
|
||||
}
|
||||
}.launchIn(sessionCoroutineScope)
|
||||
|
||||
@@ -24,8 +24,8 @@ internal fun RoomListServiceState.toSyncState(): SyncState {
|
||||
return when (this) {
|
||||
RoomListServiceState.INIT,
|
||||
RoomListServiceState.SETTING_UP -> SyncState.Idle
|
||||
RoomListServiceState.RUNNING -> SyncState.Syncing
|
||||
RoomListServiceState.ERROR -> SyncState.InError
|
||||
RoomListServiceState.RUNNING -> SyncState.Running
|
||||
RoomListServiceState.ERROR -> SyncState.Error
|
||||
RoomListServiceState.TERMINATED -> SyncState.Terminated
|
||||
}
|
||||
}
|
||||
@@ -33,8 +33,8 @@ internal fun RoomListServiceState.toSyncState(): SyncState {
|
||||
internal fun SyncServiceState.toSyncState(): SyncState {
|
||||
return when (this) {
|
||||
SyncServiceState.IDLE -> SyncState.Idle
|
||||
SyncServiceState.RUNNING -> SyncState.Syncing
|
||||
SyncServiceState.RUNNING -> SyncState.Running
|
||||
SyncServiceState.TERMINATED -> SyncState.Terminated
|
||||
SyncServiceState.ERROR -> SyncState.InError
|
||||
SyncServiceState.ERROR -> SyncState.Error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ class FakeSyncService : SyncService {
|
||||
private val syncStateFlow = MutableStateFlow(SyncState.Idle)
|
||||
|
||||
fun simulateError() {
|
||||
syncStateFlow.value = SyncState.InError
|
||||
syncStateFlow.value = SyncState.Error
|
||||
}
|
||||
|
||||
override suspend fun startSync(): Result<Unit> {
|
||||
syncStateFlow.value = SyncState.Syncing
|
||||
syncStateFlow.value = SyncState.Running
|
||||
return Result.success(Unit)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user