diff --git a/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Module.kt b/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Module.kt index f5a02013..36ec9bab 100644 --- a/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Module.kt +++ b/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Module.kt @@ -623,23 +623,22 @@ fun ModuleItem( val interactionSource = remember { MutableInteractionSource() } val indication = LocalIndication.current val viewModel = viewModel() + + val context = LocalContext.current + val prefs = context.getSharedPreferences("settings", Context.MODE_PRIVATE) + + var developerOptionsEnabled by rememberSaveable { + mutableStateOf( + prefs.getBoolean("enable_developer_options", false) + ) + } + + LaunchedEffect(Unit) { + developerOptionsEnabled = prefs.getBoolean("enable_developer_options", false) + } Column( modifier = Modifier - .run { - if (module.hasWebUi) { - toggleable( - value = module.enabled, - enabled = !module.remove && module.enabled, - interactionSource = interactionSource, - role = Role.Button, - indication = indication, - onValueChange = { onClick(module) } - ) - } else { - this - } - } .padding(22.dp, 18.dp, 22.dp, 12.dp) ) { Row( @@ -648,6 +647,10 @@ fun ModuleItem( ) { val moduleVersion = stringResource(id = R.string.module_version) val moduleAuthor = stringResource(id = R.string.module_author) + val moduleId = stringResource(id = R.string.module_id) + val moduleVersionCode = stringResource(id = R.string.module_version_code) + val moduleUpdateJson = stringResource(id = R.string.module_update_json) + val moduleUpdateJsonEmpty = stringResource(id = R.string.module_update_json_empty) Column( modifier = Modifier.fillMaxWidth(0.8f) @@ -676,6 +679,33 @@ fun ModuleItem( fontFamily = MaterialTheme.typography.bodySmall.fontFamily, textDecoration = textDecoration ) + + if (developerOptionsEnabled) { + + Text( + text = "$moduleId: ${module.id}", + fontSize = MaterialTheme.typography.bodySmall.fontSize, + lineHeight = MaterialTheme.typography.bodySmall.lineHeight, + fontFamily = MaterialTheme.typography.bodySmall.fontFamily, + textDecoration = textDecoration + ) + + Text( + text = "$moduleVersionCode: ${module.versionCode}", + fontSize = MaterialTheme.typography.bodySmall.fontSize, + lineHeight = MaterialTheme.typography.bodySmall.lineHeight, + fontFamily = MaterialTheme.typography.bodySmall.fontFamily, + textDecoration = textDecoration + ) + + Text( + text = if (module.updateJson.isNotEmpty()) "$moduleUpdateJson: ${module.updateJson}" else "$moduleUpdateJson: $moduleUpdateJsonEmpty", + fontSize = MaterialTheme.typography.bodySmall.fontSize, + lineHeight = MaterialTheme.typography.bodySmall.lineHeight, + fontFamily = MaterialTheme.typography.bodySmall.fontFamily, + textDecoration = textDecoration + ) + } } Spacer(modifier = Modifier.weight(1f)) diff --git a/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Settings.kt b/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Settings.kt index d1c90c75..808f0ef4 100644 --- a/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Settings.kt +++ b/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Settings.kt @@ -155,7 +155,7 @@ fun SettingScreen(navigator: DestinationsNavigator) { } var umountChecked by rememberSaveable { - mutableStateOf(Natives.isDefaultUmountModules()) + mutableStateOf(false) } if (ksuVersion != null) { SwitchItem( @@ -300,7 +300,7 @@ fun SettingScreen(navigator: DestinationsNavigator) { ) } SwitchItem( - icon = Icons.Filled.DeveloperMode, + icon = Icons.Filled.Web, title = stringResource(id = R.string.enable_web_debugging), summary = stringResource(id = R.string.enable_web_debugging_summary), checked = enableWebDebugging @@ -309,6 +309,23 @@ fun SettingScreen(navigator: DestinationsNavigator) { enableWebDebugging = it } + var developerOptionsEnabled by rememberSaveable { + mutableStateOf( + prefs.getBoolean("enable_developer_options", false) + ) + } + if (ksuVersion != null) { + SwitchItem( + icon = Icons.Filled.DeveloperMode, + title = stringResource(id = R.string.enable_developer_options), + summary = stringResource(id = R.string.enable_developer_options_summary), + checked = developerOptionsEnabled + ) { + prefs.edit().putBoolean("enable_developer_options", it).apply() + developerOptionsEnabled = it + } + } + var showBottomsheet by remember { mutableStateOf(false) } ListItem( diff --git a/manager/app/src/main/res/values/strings.xml b/manager/app/src/main/res/values/strings.xml index c19d8565..38d5dd51 100644 --- a/manager/app/src/main/res/values/strings.xml +++ b/manager/app/src/main/res/values/strings.xml @@ -57,6 +57,12 @@ Failed to restore: %s Version Author + ID + Code + UpdateJson + Empty + Enable developer options + Show hidden settings and debug info relevant only for developers. Modules are unavailable as OverlayFS is disabled by the kernel. Refresh Show system apps @@ -107,7 +113,7 @@ Umount modules Failed to update App Profile for %s The current KernelSU Next version %1$d is too low for the manager to work properly. Please upgrade to version %2$d or higher! - Umount modules by default + Umount modules The global default value for \"Umount modules\" in App Profile. If enabled, it will remove all module modifications to the system for apps that don\'t have a profile set. Hide kprobe hooks This option disables the kprobe hooks created by ksu and, instead, activates the embedded non-kprobe hooks, implementing the same functionality that would be applied to a non-GKI kernel, which doesn\'t support kprobe.