Fix: Only Ask for root permission when selected

This commit is contained in:
LooKeR 2021-11-12 19:34:24 +05:30
parent 6239c9c5f7
commit ba6e5a92ea

View File

@ -188,12 +188,9 @@ class SettingsFragment : ScreenFragment() {
preferences[Preferences.Key.ProxyHost]?.setEnabled(enabled) preferences[Preferences.Key.ProxyHost]?.setEnabled(enabled)
preferences[Preferences.Key.ProxyPort]?.setEnabled(enabled) preferences[Preferences.Key.ProxyPort]?.setEnabled(enabled)
} }
if (key != null && !(Shell.getCachedShell()?.isRoot ?: Shell.getShell().isRoot) if (key == Preferences.Key.RootPermission) {
) { preferences[Preferences.Key.RootPermission]?.setEnabled(Shell.getCachedShell()?.isRoot
Preferences[Preferences.Key.RootPermission] = false ?: Shell.getShell().isRoot)
preferences[Preferences.Key.RootPermission]?.setEnabled(false)
} else if (Shell.getCachedShell()?.isRoot ?: Shell.getShell().isRoot) {
preferences[Preferences.Key.RootPermission]?.setEnabled(true)
} }
if (key == Preferences.Key.Theme) { if (key == Preferences.Key.Theme) {
requireActivity().recreate() requireActivity().recreate()