manager: output full logs of actions and flash modules when developer option is enabled

This commit is contained in:
rifsxd
2025-06-01 04:05:35 +06:00
parent 609926bff1
commit cb146200aa
2 changed files with 16 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
package com.rifsxd.ksunext.ui.screen package com.rifsxd.ksunext.ui.screen
import android.content.Context
import android.os.Environment import android.os.Environment
import androidx.activity.compose.BackHandler import androidx.activity.compose.BackHandler
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
@@ -35,6 +36,7 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.input.key.Key import androidx.compose.ui.input.key.Key
import androidx.compose.ui.input.key.key import androidx.compose.ui.input.key.key
import androidx.compose.ui.platform.LocalView import androidx.compose.ui.platform.LocalView
@@ -69,6 +71,11 @@ fun ExecuteModuleActionScreen(navigator: DestinationsNavigator, moduleId: String
var actionResult: Boolean var actionResult: Boolean
var isActionRunning by rememberSaveable { mutableStateOf(true) } var isActionRunning by rememberSaveable { mutableStateOf(true) }
val context = LocalContext.current
// Read developer options from SharedPreferences
val prefs = context.getSharedPreferences("settings", Context.MODE_PRIVATE)
val developerOptionsEnabled = prefs.getBoolean("enable_developer_options", false)
val view = LocalView.current val view = LocalView.current
DisposableEffect(isActionRunning) { DisposableEffect(isActionRunning) {
view.keepScreenOn = isActionRunning view.keepScreenOn = isActionRunning
@@ -158,7 +165,7 @@ fun ExecuteModuleActionScreen(navigator: DestinationsNavigator, moduleId: String
} }
Text( Text(
modifier = Modifier.padding(8.dp), modifier = Modifier.padding(8.dp),
text = text, text = if (developerOptionsEnabled) logContent.toString() else text,
fontSize = MaterialTheme.typography.bodySmall.fontSize, fontSize = MaterialTheme.typography.bodySmall.fontSize,
fontFamily = FontFamily.Monospace, fontFamily = FontFamily.Monospace,
lineHeight = MaterialTheme.typography.bodySmall.lineHeight, lineHeight = MaterialTheme.typography.bodySmall.lineHeight,

View File

@@ -1,5 +1,6 @@
package com.rifsxd.ksunext.ui.screen package com.rifsxd.ksunext.ui.screen
import android.content.Context
import android.net.Uri import android.net.Uri
import android.os.Environment import android.os.Environment
import android.os.Parcelable import android.os.Parcelable
@@ -45,6 +46,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.input.key.Key import androidx.compose.ui.input.key.Key
import androidx.compose.ui.input.key.key import androidx.compose.ui.input.key.key
import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalView import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontFamily
@@ -119,6 +121,11 @@ fun FlashScreen(navigator: DestinationsNavigator, flashIt: FlashIt) {
mutableStateOf(FlashingStatus.FLASHING) mutableStateOf(FlashingStatus.FLASHING)
} }
val context = LocalContext.current
val prefs = context.getSharedPreferences("settings", Context.MODE_PRIVATE)
val developerOptionsEnabled = prefs.getBoolean("enable_developer_options", false)
val view = LocalView.current val view = LocalView.current
DisposableEffect(flashing) { DisposableEffect(flashing) {
view.keepScreenOn = flashing == FlashingStatus.FLASHING view.keepScreenOn = flashing == FlashingStatus.FLASHING
@@ -237,7 +244,7 @@ fun FlashScreen(navigator: DestinationsNavigator, flashIt: FlashIt) {
} }
Text( Text(
modifier = Modifier.padding(8.dp), modifier = Modifier.padding(8.dp),
text = text, text = if (developerOptionsEnabled) logContent.toString() else text,
fontSize = MaterialTheme.typography.bodySmall.fontSize, fontSize = MaterialTheme.typography.bodySmall.fontSize,
fontFamily = FontFamily.Monospace, fontFamily = FontFamily.Monospace,
lineHeight = MaterialTheme.typography.bodySmall.lineHeight, lineHeight = MaterialTheme.typography.bodySmall.lineHeight,