You've already forked KernelSU-Next
mirror of
https://github.com/KernelSU-Next/KernelSU-Next.git
synced 2025-08-27 23:46:34 +00:00
manager: remember sus_su toggle state
This commit is contained in:
@@ -46,6 +46,7 @@ import com.rifsxd.ksunext.ui.theme.KernelSUTheme
|
||||
import com.rifsxd.ksunext.ui.util.LocalSnackbarHost
|
||||
import com.rifsxd.ksunext.ui.util.rootAvailable
|
||||
import com.rifsxd.ksunext.ui.util.install
|
||||
import com.rifsxd.ksunext.ui.util.*
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
|
||||
@@ -62,6 +63,17 @@ class MainActivity : ComponentActivity() {
|
||||
val isManager = Natives.becomeManager(ksuApp.packageName)
|
||||
if (isManager) install()
|
||||
|
||||
val prefs = getSharedPreferences("settings", MODE_PRIVATE)
|
||||
|
||||
val suSFSVar = getSuSFSVariant()
|
||||
if (suSFSVar != "NON-GKI") {
|
||||
if (prefs.getBoolean("enable_susfs", false)) {
|
||||
if (susfsSUSSU_Mode() != "2") {
|
||||
susfsSUSSU_1()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setContent {
|
||||
KernelSUTheme {
|
||||
val navController = rememberNavController()
|
||||
|
||||
@@ -186,11 +186,11 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
||||
prefs.edit().putBoolean("enable_web_debugging", it).apply()
|
||||
enableWebDebugging = it
|
||||
}
|
||||
|
||||
|
||||
val suSFSVar = getSuSFSVariant()
|
||||
if (suSFSVar != "NON-GKI") {
|
||||
var isEnabled by rememberSaveable {
|
||||
mutableStateOf(susfsSUSSU_Mode() == "2")
|
||||
mutableStateOf(prefs.getBoolean("enable_susfs", susfsSUSSU_Mode() == "2"))
|
||||
}
|
||||
SwitchItem(
|
||||
icon = Icons.Filled.VisibilityOff,
|
||||
@@ -203,6 +203,7 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
||||
} else {
|
||||
susfsSUSSU_0()
|
||||
}
|
||||
prefs.edit().putBoolean("enable_susfs", it).apply()
|
||||
isEnabled = it
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user