diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleViewModel.kt index 7c9528c10..97c04cf19 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleViewModel.kt @@ -81,12 +81,14 @@ class ModuleViewModel( it.add(itemNoneUpdatable) } + private val itemsCoreOnly = ObservableArrayList() private val itemsInstalled = diffListOf() private val itemsUpdatable = diffListOf() private val itemsRemote = diffListOf() val adapter = adapterOf>() val items = MergeObservableList>() + .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