Commit c5e5b70e authored by Viktor De Pasquale's avatar Viktor De Pasquale

Added safe mode notice to modules

parent 327b1862
......@@ -81,12 +81,14 @@ class ModuleViewModel(
it.add(itemNoneUpdatable)
}
private val itemsCoreOnly = ObservableArrayList<SafeModeNotice>()
private val itemsInstalled = diffListOf<ModuleItem>()
private val itemsUpdatable = diffListOf<RepoItem.Update>()
private val itemsRemote = diffListOf<RepoItem.Remote>()
val adapter = adapterOf<ComparableRvItem<*>>()
val items = MergeObservableList<ComparableRvItem<*>>()
.insertList(itemsCoreOnly)
.insertItem(sectionActive)
.insertList(itemsInstalledHelpers)
.insertList(itemsInstalled)
......@@ -159,6 +161,7 @@ class ModuleViewModel(
// ---
override fun refresh(): Disposable {
updateCoreOnlyWarning()
if (itemsRemote.isEmpty())
loadRemote()
return loadInstalled().subscribeK()
......@@ -268,6 +271,15 @@ class ModuleViewModel(
.subscribeK { it.progress.value = progress }
.add()
private fun updateCoreOnlyWarning() {
if (Config.coreOnly) {
if (itemsCoreOnly.isNotEmpty()) return
itemsCoreOnly.add(SafeModeNotice)
} else {
itemsCoreOnly.clear()
}
}
// ---
@WorkerThread
......
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