manager: added developer options toggle

manager: removed module card onClick open webui
manager: diabled umount modules by default
This commit is contained in:
rifsxd
2025-02-13 23:17:48 +06:00
parent b6fcea9277
commit 00cab2209e
3 changed files with 70 additions and 17 deletions
@@ -623,23 +623,22 @@ fun ModuleItem(
val interactionSource = remember { MutableInteractionSource() }
val indication = LocalIndication.current
val viewModel = viewModel<ModuleViewModel>()
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))
@@ -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(