Check command result

This commit is contained in:
vvb2060 2020-09-24 04:50:10 +08:00 committed by John Wu
parent a6950b8aca
commit fa3865e962

View File

@ -226,10 +226,10 @@ object MagiskHide : BaseSettingsItem.Toggle() {
override val description = R.string.settings_magiskhide_summary.asTransitive() override val description = R.string.settings_magiskhide_summary.asTransitive()
override var value = Config.magiskHide override var value = Config.magiskHide
set(value) = setV(value, field, { field = it }) { set(value) = setV(value, field, { field = it }) {
Config.magiskHide = it val cmd = if (it) "enable" else "disable"
when { Shell.su("magiskhide --$cmd").submit { cb ->
it -> Shell.su("magiskhide --enable").submit() if (cb.isSuccess) Config.magiskHide = it
else -> Shell.su("magiskhide --disable").submit() else field = !it
} }
} }
} }