manager:Add flag bits to module installations to prevent repeated installations

- Modify the time and location of the susfs self-startup scripts
This commit is contained in:
ShirkNeko
2025-07-12 11:41:58 +08:00
parent bd6eb7fddd
commit 755d454960
2 changed files with 9 additions and 6 deletions

View File

@@ -112,6 +112,7 @@ fun FlashScreen(navigator: DestinationsNavigator, flashIt: FlashIt) {
var showFloatAction by rememberSaveable { mutableStateOf(false) }
// 添加状态跟踪是否已经完成刷写
var hasFlashCompleted by rememberSaveable { mutableStateOf(false) }
var hasExecuted by rememberSaveable { mutableStateOf(false) }
val snackBarHost = LocalSnackbarHost.current
val scope = rememberCoroutineScope()
@@ -135,18 +136,21 @@ fun FlashScreen(navigator: DestinationsNavigator, flashIt: FlashIt) {
currentModule = 1
)
hasFlashCompleted = false
hasExecuted = false
} else if (flashIt !is FlashIt.FlashModules) {
hasFlashCompleted = false
hasExecuted = false
}
}
// 只有在未完成刷写时才执行刷写操作
LaunchedEffect(flashIt, hasFlashCompleted) {
// 如果已经完成刷写或者已有文本内容,则不再执行
if (hasFlashCompleted || text.isNotEmpty()) {
LaunchedEffect(flashIt) {
if (hasExecuted || hasFlashCompleted || text.isNotEmpty()) {
return@LaunchedEffect
}
hasExecuted = true
withContext(Dispatchers.IO) {
setFlashingStatus(FlashingStatus.FLASHING)

View File

@@ -464,9 +464,6 @@ object ScriptGenerator {
if (config.susPaths.isNotEmpty()) {
generatePathSettingSection(config.androidDataPath, config.sdcardPath)
appendLine()
appendLine("until [ -d \"/sdcard/Android\" ]; do sleep 1; done")
appendLine("sleep 45")
appendLine()
generateSusPathsSection(config.susPaths)
}
}
@@ -480,6 +477,8 @@ object ScriptGenerator {
appendLine("# 路径配置")
appendLine("# 设置Android Data路径")
appendLine("until [ -d \"/sdcard/Android\" ]; do sleep 1; done")
appendLine("sleep 60")
appendLine()
appendLine("\"${'$'}SUSFS_BIN\" set_android_data_root_path '$androidDataPath'")
appendLine("echo \"$(get_current_time): Android Data路径设置为: $androidDataPath\" >> \"${'$'}LOG_FILE\"")
appendLine()