feat: 修改代码冲突
This commit is contained in:
@@ -133,11 +133,21 @@ class KRHomeController extends GetxController with WidgetsBindingObserver {
|
||||
if (value != null) {
|
||||
isQuickConnectEnabled.value = value;
|
||||
// 保存闪连状态到本地存储
|
||||
await _storage.kr_saveBool(key: _quickConnectKey, value: value);
|
||||
await _saveQuickConnectStatus(value);
|
||||
KRLogUtil.kr_i('闪连状态已更新: $value', tag: 'QuickConnect');
|
||||
}
|
||||
}
|
||||
|
||||
// 保存闪连状态到本地存储
|
||||
Future<void> _saveQuickConnectStatus(bool enabled) async {
|
||||
try {
|
||||
await _storage.kr_saveBool(key: _quickConnectKey, value: enabled);
|
||||
KRLogUtil.kr_i('闪连状态已保存到本地存储: $enabled', tag: 'QuickConnect');
|
||||
} catch (e) {
|
||||
KRLogUtil.kr_e('保存闪连状态失败: $e', tag: 'QuickConnect');
|
||||
}
|
||||
}
|
||||
|
||||
// 从本地存储加载闪连状态
|
||||
Future<void> _loadQuickConnectStatus() async {
|
||||
try {
|
||||
@@ -1889,7 +1899,7 @@ class KRHomeController extends GetxController with WidgetsBindingObserver {
|
||||
}
|
||||
|
||||
// 准备节点地址列表
|
||||
final nodeAddresses = <MapEntry<String, SocketAddress>>[];
|
||||
final nodeAddresses = []; // <MapEntry<String, SocketAddress>>[];
|
||||
|
||||
for (final node in testableNodes) {
|
||||
// 从节点配置中提取服务器地址和端口
|
||||
@@ -1897,7 +1907,7 @@ class KRHomeController extends GetxController with WidgetsBindingObserver {
|
||||
String host = node.serverAddr;
|
||||
int port = 0;
|
||||
|
||||
// 尝试从config中获取端口
|
||||
/*// 尝试从config中获取端口
|
||||
if (node.config.containsKey('server_port')) {
|
||||
port = node.config['server_port'] as int;
|
||||
} else if (node.config.containsKey('port')) {
|
||||
@@ -1914,7 +1924,7 @@ class KRHomeController extends GetxController with WidgetsBindingObserver {
|
||||
KRLogUtil.kr_w('⚠️ 节点 ${node.tag} 缺少地址或端口信息', tag: 'HomeController');
|
||||
// 设置为失败
|
||||
node.urlTestDelay.value = 65535;
|
||||
}
|
||||
}*/
|
||||
} catch (e) {
|
||||
KRLogUtil.kr_e('❌ 解析节点 ${node.tag} 配置失败: $e', tag: 'HomeController');
|
||||
node.urlTestDelay.value = 65535;
|
||||
@@ -1932,7 +1942,7 @@ class KRHomeController extends GetxController with WidgetsBindingObserver {
|
||||
final results = await KRLatencyTester.testMultipleNodes(
|
||||
nodes: nodeAddresses,
|
||||
concurrency: 10, // 每批10个并发
|
||||
timeout: 5000, // 超时时间5秒(毫秒)
|
||||
timeout: const Duration(seconds: 5),
|
||||
);
|
||||
|
||||
// 更新节点延迟
|
||||
|
||||
@@ -285,7 +285,7 @@ class KRSplashController extends GetxController {
|
||||
KRLogUtil.kr_e('⏱️ 初始化超时: $e', tag: 'SplashController');
|
||||
print('⏱️ 初始化超时,直接跳转到主页');
|
||||
// 超时后直接跳转到主页,让用户可以手动重试
|
||||
// Get.offAllNamed(Routes.KR_MAIN);
|
||||
// Get.offAllNamed(Routes.KR_HOME);
|
||||
HIDialog.show(
|
||||
message: '初始化超时,请检查网络或重试',
|
||||
confirmText: '重试',
|
||||
@@ -484,7 +484,7 @@ class KRSplashController extends GetxController {
|
||||
_initLog.logWarning('网络权限检查失败或超时,执行降级初始化', tag: 'Init');
|
||||
KRLogUtil.kr_w('⚠️ 网络权限检查失败或超时,执行降级初始化', tag: 'SplashController');
|
||||
await _executeMinimalInitialization();
|
||||
Get.offAllNamed(Routes.KR_MAIN);
|
||||
Get.offAllNamed(Routes.KR_HOME);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -493,7 +493,7 @@ class KRSplashController extends GetxController {
|
||||
_initLog.logError('网络权限检查异常,执行降级初始化', tag: 'Init', error: e);
|
||||
KRLogUtil.kr_w('⚠️ 网络权限检查异常: $e,执行降级初始化', tag: 'SplashController');
|
||||
await _executeMinimalInitialization();
|
||||
Get.offAllNamed(Routes.KR_MAIN);
|
||||
Get.offAllNamed(Routes.KR_HOME);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -582,7 +582,7 @@ class KRSplashController extends GetxController {
|
||||
_initLog.logError('启动页初始化异常,执行降级策略', tag: 'Continue', error: e);
|
||||
KRLogUtil.kr_w('⚠️ 启动页初始化异常,执行降级策略: $e', tag: 'SplashController');
|
||||
await _executeMinimalInitialization();
|
||||
Get.offAllNamed(Routes.KR_MAIN);
|
||||
Get.offAllNamed(Routes.KR_HOME);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -726,7 +726,7 @@ class KRSplashController extends GetxController {
|
||||
kr_isLoading.value = false;
|
||||
|
||||
// 直接跳转到主页
|
||||
Get.offAllNamed(Routes.KR_MAIN);
|
||||
Get.offAllNamed(Routes.KR_HOME);
|
||||
}
|
||||
|
||||
/// 🔧 修复1.1:清理旧的本地存储数据(DEBUG模式专用)
|
||||
|
||||
Reference in New Issue
Block a user