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: added warning dialog
This commit is contained in:
@@ -163,6 +163,8 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
|||||||
|
|
||||||
val prefs = context.getSharedPreferences("settings", Context.MODE_PRIVATE)
|
val prefs = context.getSharedPreferences("settings", Context.MODE_PRIVATE)
|
||||||
|
|
||||||
|
val hasShownWarning = rememberSaveable { mutableStateOf(prefs.getBoolean("has_shown_warning", false)) }
|
||||||
|
|
||||||
var useOverlayFs by rememberSaveable {
|
var useOverlayFs by rememberSaveable {
|
||||||
mutableStateOf(
|
mutableStateOf(
|
||||||
prefs.getBoolean("use_overlay_fs", false)
|
prefs.getBoolean("use_overlay_fs", false)
|
||||||
@@ -173,16 +175,41 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
|||||||
|
|
||||||
var showRebootDialog by remember { mutableStateOf(false) }
|
var showRebootDialog by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
var showWarningDialog by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
SwitchItem(
|
SwitchItem(
|
||||||
icon = Icons.Filled.Build,
|
icon = Icons.Filled.Build,
|
||||||
title = stringResource(id = R.string.use_overlay_fs),
|
title = stringResource(id = R.string.use_overlay_fs),
|
||||||
summary = stringResource(id = R.string.use_overlay_fs_summary),
|
summary = stringResource(id = R.string.use_overlay_fs_summary),
|
||||||
checked = useOverlayFs
|
checked = useOverlayFs
|
||||||
) {
|
) {
|
||||||
prefs.edit().putBoolean("use_overlay_fs", it).apply()
|
if (!hasShownWarning.value) {
|
||||||
useOverlayFs = it
|
showWarningDialog = true
|
||||||
if (isManager) install()
|
}
|
||||||
showRebootDialog = true
|
}
|
||||||
|
|
||||||
|
if (showWarningDialog) {
|
||||||
|
AlertDialog(
|
||||||
|
onDismissRequest = { showWarningDialog = false },
|
||||||
|
title = { Text(stringResource(R.string.warning)) },
|
||||||
|
text = { Text(stringResource(R.string.warning_message)) },
|
||||||
|
confirmButton = {
|
||||||
|
TextButton(onClick = {
|
||||||
|
showWarningDialog = false
|
||||||
|
prefs.edit().putBoolean("use_overlay_fs", !useOverlayFs).apply()
|
||||||
|
useOverlayFs = !useOverlayFs
|
||||||
|
if (isManager) install()
|
||||||
|
showRebootDialog = true
|
||||||
|
}) {
|
||||||
|
Text(stringResource(R.string.proceed))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dismissButton = {
|
||||||
|
TextButton(onClick = { showWarningDialog = false }) {
|
||||||
|
Text(stringResource(R.string.cancel))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showRebootDialog) {
|
if (showRebootDialog) {
|
||||||
@@ -206,6 +233,7 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var checkUpdate by rememberSaveable {
|
var checkUpdate by rememberSaveable {
|
||||||
mutableStateOf(
|
mutableStateOf(
|
||||||
prefs.getBoolean("check_update", true)
|
prefs.getBoolean("check_update", true)
|
||||||
|
|||||||
@@ -69,6 +69,10 @@
|
|||||||
<string name="use_overlay_fs_summary">Toggle between using OverlayFS over Magic Mount for KernelSU Next\'s mount system.</string>
|
<string name="use_overlay_fs_summary">Toggle between using OverlayFS over Magic Mount for KernelSU Next\'s mount system.</string>
|
||||||
<string name="reboot_required">Reboot Required</string>
|
<string name="reboot_required">Reboot Required</string>
|
||||||
<string name="reboot_message">Changes will take effect after rebooting the system. Would you like to reboot now?</string>
|
<string name="reboot_message">Changes will take effect after rebooting the system. Would you like to reboot now?</string>
|
||||||
|
<string name="warning">Warning</string>
|
||||||
|
<string name="warning_message">This feature is still in beta and under development. Please ensure you backup your modules before proceeding. Use this feature only if you understand the potential risks. Proceed with caution.</string>
|
||||||
|
<string name="proceed">Proceed</string>
|
||||||
|
<string name="cancel">Cancel</string>
|
||||||
<string name="later">Later</string>
|
<string name="later">Later</string>
|
||||||
<string name="home_next_kernelsu">🔥 Next build</string>
|
<string name="home_next_kernelsu">🔥 Next build</string>
|
||||||
<string name="home_next_kernelsu_repo">https://github.com/rifsxd/KernelSU-Next</string>
|
<string name="home_next_kernelsu_repo">https://github.com/rifsxd/KernelSU-Next</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user