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

Fix auto-reselecting scanned folders in onboarding

parent 375604b3
......@@ -54,7 +54,6 @@ import org.videolan.vlc.gui.dialogs.showContext
import org.videolan.vlc.gui.helpers.MedialibraryUtils
import org.videolan.vlc.gui.helpers.ThreeStatesCheckbox
import org.videolan.vlc.gui.helpers.UiTools
import org.videolan.vlc.util.sanitizePath
import org.videolan.vlc.gui.onboarding.OnboardingActivity
import org.videolan.vlc.util.*
import org.videolan.vlc.viewmodels.browser.BrowserModel
......@@ -176,9 +175,13 @@ class StorageBrowserFragment : FileBrowserFragment(), EntryPointsEventsCb, Corou
val checked = tscb.state == ThreeStatesCheckbox.STATE_CHECKED
val activity = requireActivity()
if (activity is OnboardingActivity) {
if (checked) MediaParsingService.preselectedStorages.add(mrl.sanitizePath())
else MediaParsingService.preselectedStorages.remove(mrl.sanitizePath())
val path = mrl.sanitizePath()
if (checked) {
MediaParsingService.preselectedStorages.removeAll { it.startsWith(path) }
MediaParsingService.preselectedStorages.add(path)
} else {
MediaParsingService.preselectedStorages.removeAll { it.startsWith(path) }
}
} else {
if (checked) {
MedialibraryUtils.addDir(mrl, v.context.applicationContext)
......@@ -248,7 +251,7 @@ class StorageBrowserFragment : FileBrowserFragment(), EntryPointsEventsCb, Corou
return@OnClickListener
}
coroutineScope.launch(CoroutineExceptionHandler{ _, _ ->}) {
coroutineScope.launch(CoroutineExceptionHandler { _, _ -> }) {
viewModel.addCustomDirectory(f.canonicalPath).join()
viewModel.browserRoot()
}
......
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