Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import androidx.compose.material.icons.rounded.RemoveModerator
import androidx.compose.material.icons.rounded.RestartAlt
import androidx.compose.material.icons.rounded.Update
import androidx.compose.material.icons.rounded.UploadFile
import androidx.compose.material.icons.rounded.ViewInAr
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
Expand All @@ -53,6 +54,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.core.content.edit
import com.topjohnwu.superuser.io.SuFile
import dev.chrisbanes.haze.HazeState
import dev.chrisbanes.haze.HazeStyle
import dev.chrisbanes.haze.HazeTint
Expand Down Expand Up @@ -512,6 +514,34 @@ fun SettingPager(
}
)

val enableScriptDebug by produceState(initialValue = false) {
value = SuFile("/data/adb/ksu/.enable_script_debug").exists()
}
var isScriptDebuggingEnabled by rememberSaveable(enableScriptDebug) {
mutableStateOf(enableScriptDebug)
}
SuperSwitch(
title = stringResource(id = R.string.enable_script_debugging),
summary = stringResource(id = R.string.enable_script_debugging_summary),
startAction = {
Icon(
Icons.Rounded.ViewInAr,
modifier = Modifier.padding(end = 16.dp),
contentDescription = stringResource(id = R.string.enable_script_debugging),
tint = colorScheme.onBackground
)
},
checked = isScriptDebuggingEnabled,
onCheckedChange = {
if (isScriptDebuggingEnabled) {
SuFile("/data/adb/ksu/.enable_script_debug").delete()
} else {
SuFile("/data/adb/ksu/.enable_script_debug").createNewFile()
}
isScriptDebuggingEnabled = !isScriptDebuggingEnabled
}
)

var enableWebDebugging by rememberSaveable {
mutableStateOf(prefs.getBoolean("enable_web_debugging", false))
}
Expand Down
2 changes: 2 additions & 0 deletions manager/app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@
<string name="open">打开</string>
<string name="enable_web_debugging">WebView 调试</string>
<string name="enable_web_debugging_summary">可用于调试 WebUI,请仅在需要时启用。</string>
<string name="enable_script_debugging">模块脚本调试</string>
<string name="enable_script_debugging_summary">可用于调试模块脚本,请仅在需要时启用。</string>
<string name="direct_install">直接安装(推荐)</string>
<string name="select_file">选择一个文件</string>
<string name="install_inactive_slot">安装到未使用的槽位(OTA 后)</string>
Expand Down
2 changes: 2 additions & 0 deletions manager/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@
<string name="open">Open</string>
<string name="enable_web_debugging">WebView debugging</string>
<string name="enable_web_debugging_summary">Can be used to debug WebUI. Please enable only when needed.</string>
<string name="enable_script_debugging">Module Script debugging</string>
<string name="enable_script_debugging_summary">Can be used to debug Module Scripts. Please enable only when needed.</string>
<string name="direct_install">Direct install (Recommended)</string>
<string name="select_file">Select a file</string>
<string name="install_inactive_slot">Install to inactive slot (After OTA)</string>
Expand Down