Added safe mode notice to modules
This commit is contained in:
parent
327b186240
commit
c5e5b70e08
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user