[Android] Clear network datasat on connection lost
Geoffrey Métais
git at videolan.org
Wed May 13 06:56:10 CEST 2020
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue May 12 09:23:00 2020 +0200| [d4f0aa7d41054e5737bf856fe6314abab62a9912] | committer: Nicolas Pomepuy
Clear network datasat on connection lost
> https://code.videolan.org/videolan/vlc-android/commit/d4f0aa7d41054e5737bf856fe6314abab62a9912
---
.../src/org/videolan/vlc/viewmodels/browser/NetworkModel.kt | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/viewmodels/browser/NetworkModel.kt b/application/vlc-android/src/org/videolan/vlc/viewmodels/browser/NetworkModel.kt
index 36d691801..6c7f431ff 100644
--- a/application/vlc-android/src/org/videolan/vlc/viewmodels/browser/NetworkModel.kt
+++ b/application/vlc-android/src/org/videolan/vlc/viewmodels/browser/NetworkModel.kt
@@ -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() {
More information about the Android
mailing list