Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Geoffrey Métais
VLC-Android
Commits
d4f0aa7d
Commit
d4f0aa7d
authored
May 12, 2020
by
Geoffrey Métais
Committed by
Nicolas Pomepuy
May 13, 2020
Browse files
Clear network datasat on connection lost
parent
68ef2085
Pipeline
#17299
passed with stage
in 4 minutes and 54 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
application/vlc-android/src/org/videolan/vlc/viewmodels/browser/NetworkModel.kt
View file @
d4f0aa7d
...
...
@@ -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
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment