manager: Fix app profile umount default

This commit is contained in:
weishu
2023-06-04 09:58:02 +08:00
parent e969563df0
commit 5d449988fb
2 changed files with 13 additions and 16 deletions

View File

@@ -40,7 +40,14 @@ fun AppProfileConfig(
Natives.isDefaultUmountModules()
},
enabled = enabled,
onCheckedChange = { onProfileChange(profile.copy(umountModules = it)) }
onCheckedChange = {
onProfileChange(
profile.copy(
umountModules = it,
nonRootUseDefault = false
)
)
}
)
}
}

View File

@@ -152,19 +152,7 @@ private fun AppProfileInner(
Mode.Custom
}
ProfileBox(mode, true) {
when (it) {
Mode.Default -> {
onProfileChange(profile.copy(rootUseDefault = true))
}
Mode.Template -> {
onProfileChange(profile.copy(rootUseDefault = false))
}
else -> {
onProfileChange(profile.copy(rootUseDefault = false))
}
}
onProfileChange(profile.copy(rootUseDefault = it == Mode.Default))
}
Crossfade(targetState = mode, label = "") { currentMode ->
if (currentMode == Mode.Template) {
@@ -198,8 +186,10 @@ private fun AppProfileInner(
}
}
} else {
var mode by rememberSaveable { mutableStateOf(Mode.Default) }
ProfileBox(mode, false) { mode = it }
val mode = if (profile.nonRootUseDefault) Mode.Default else Mode.Custom
ProfileBox(mode, false) {
onProfileChange(profile.copy(nonRootUseDefault = (it == Mode.Default)))
}
Crossfade(targetState = mode, label = "") { currentMode ->
val modifyEnabled = currentMode == Mode.Custom
AppProfileConfig(