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