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