Commit d4f0aa7d authored by Geoffrey Métais's avatar Geoffrey Métais Committed by Nicolas Pomepuy

Clear network datasat on connection lost

parent 68ef2085
Pipeline #17299 passed with stage
in 4 minutes and 54 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