Commit 89779eef authored by Geoffrey Métais's avatar Geoffrey Métais

Clear network datasat on connection lost

parent 1f6ffd8f
Pipeline #17233 passed with stage
in 3 minutes and 50 seconds
......@@ -34,7 +34,10 @@ import org.videolan.tools.NetworkMonitor
class NetworkModel(context: Context, url: String? = null, showHiddenFiles: Boolean, coroutineContextProvider: CoroutineContextProvider = CoroutineContextProvider()) : BrowserModel(context, url, TYPE_NETWORK, showHiddenFiles, true, coroutineContextProvider) {
init {
NetworkMonitor.getInstance(context).connectionFlow.onEach { if (it.connected) refresh() }.launchIn(viewModelScope)
NetworkMonitor.getInstance(context).connectionFlow.onEach {
if (it.connected) refresh()
else dataset.clear()
}.launchIn(viewModelScope)
}
class Factory(val context: Context, val url: String?, private val showHiddenFiles: Boolean): ViewModelProvider.NewInstanceFactory() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment