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 7846fa19b4
commit f3e072bdb0
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())