mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 01:19:33 +00:00
Enable Offline mode of the SyncService, so that the sync starts automatically when the network is back.
Also rely on the sync state to render the "Offline" banner.
This commit is contained in:
+7
-1
@@ -13,8 +13,10 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
class FakeSyncService(
|
||||
syncStateFlow: MutableStateFlow<SyncState> = MutableStateFlow(SyncState.Idle)
|
||||
initialSyncState: SyncState = SyncState.Idle,
|
||||
) : SyncService {
|
||||
private val syncStateFlow: MutableStateFlow<SyncState> = MutableStateFlow(initialSyncState)
|
||||
|
||||
var startSyncLambda: () -> Result<Unit> = { Result.success(Unit) }
|
||||
override suspend fun startSync(): Result<Unit> {
|
||||
return startSyncLambda()
|
||||
@@ -26,4 +28,8 @@ class FakeSyncService(
|
||||
}
|
||||
|
||||
override val syncState: StateFlow<SyncState> = syncStateFlow
|
||||
|
||||
suspend fun emitSyncState(syncState: SyncState) {
|
||||
syncStateFlow.emit(syncState)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user