diff --git a/manager/app/src/main/java/com/sukisu/ultra/ui/screen/Flash.kt b/manager/app/src/main/java/com/sukisu/ultra/ui/screen/Flash.kt index 95589a31..7f76e79e 100644 --- a/manager/app/src/main/java/com/sukisu/ultra/ui/screen/Flash.kt +++ b/manager/app/src/main/java/com/sukisu/ultra/ui/screen/Flash.kt @@ -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) diff --git a/manager/app/src/main/java/com/sukisu/ultra/ui/util/SuSFSModuleScripts.kt b/manager/app/src/main/java/com/sukisu/ultra/ui/util/SuSFSModuleScripts.kt index c75c0f00..6f979f0f 100644 --- a/manager/app/src/main/java/com/sukisu/ultra/ui/util/SuSFSModuleScripts.kt +++ b/manager/app/src/main/java/com/sukisu/ultra/ui/util/SuSFSModuleScripts.kt @@ -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()