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