新增日志全局开关便于调试,优化部分机型可能出现的界面错乱或不显示等问题

(cherry picked from commit 5853ba7fe4e0cbe4f04b20c86e9fd84c5557139f)
This commit is contained in:
2025-11-02 00:31:31 -07:00
committed by speakeloudest
parent cf297caf09
commit 17b3f6b92d
9 changed files with 139 additions and 34 deletions
@@ -517,10 +517,12 @@ class KRSplashController extends GetxController {
_initLog.log('Token存在: $hasToken', tag: 'Splash');
_initLog.logSuccess('正常初始化流程完成', tag: 'Splash');
// 完成日志收集
await _initLog.finalize();
// 🔧 关键修复:不要在这里关闭日志文件!
// 日志文件需要保持打开状态,让 HomeController 也能写入日志
// 日志文件将在 HomeController 初始化完成后关闭
// await _initLog.finalize(); // ❌ 注释掉
if (kDebugMode && _initLog.getLogFilePath() != null) {
print('📁 初始化日志文件: ${_initLog.getLogFilePath()}');
print('📁 初始化日志文件(保持打开): ${_initLog.getLogFilePath()}');
}
// 直接导航到主页(无论是否登录,主页会根据登录状态显示不同内容)
@@ -549,8 +551,8 @@ class KRSplashController extends GetxController {
kr_hasError.value = true;
kr_errorMessage.value = '${AppTranslations.kr_splash.kr_initializationFailed}$e';
// 完成日志收集
await _initLog.finalize();
// 🔧 错误情况下也不关闭日志,让后续的错误处理也能写入
// await _initLog.finalize(); // ❌ 注释掉
}
}