RoomList: try syncing when network is back and inError state

This commit is contained in:
ganfra
2023-06-23 17:07:27 +02:00
parent 1185dbd276
commit bb4f61fe12
6 changed files with 45 additions and 17 deletions

View File

@@ -37,6 +37,7 @@ import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.callbackFlow
import kotlinx.coroutines.flow.debounce
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.stateIn
import timber.log.Timber
import javax.inject.Inject
@@ -81,6 +82,7 @@ class NetworkMonitorImpl @Inject constructor(
connectivityManager.unregisterNetworkCallback(callback)
}
}
.distinctUntilChanged()
.debounce(300)
.stateIn(appCoroutineScope, SharingStarted.WhileSubscribed(), connectivityManager.activeNetworkStatus())