1. 删除了 _kr_handleSelectorProxy 中会导致死循环的重选逻辑
Some checks failed
Build Android APK / 编译 libcore.aar (push) Has been cancelled
Build Android APK / 编译 Android APK (release) (push) Has been cancelled
Build Android APK / 创建 GitHub Release (push) Has been cancelled
Build Multi-Platform / 编译 libcore (iOS/tvOS) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Android) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Windows) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (macOS) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Linux) (push) Has been cancelled
Build Multi-Platform / 构建 Android APK (push) Has been cancelled
Build Multi-Platform / 构建 Windows (push) Has been cancelled
Build Multi-Platform / 构建 macOS (push) Has been cancelled
Build Multi-Platform / 构建 Linux (push) Has been cancelled
Build Multi-Platform / 构建 iOS (push) Has been cancelled
Build Multi-Platform / 创建 Release (push) Has been cancelled
Build Windows / 编译 libcore (Windows) (push) Has been cancelled
Build Windows / build (push) Has been cancelled
Some checks failed
Build Android APK / 编译 libcore.aar (push) Has been cancelled
Build Android APK / 编译 Android APK (release) (push) Has been cancelled
Build Android APK / 创建 GitHub Release (push) Has been cancelled
Build Multi-Platform / 编译 libcore (iOS/tvOS) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Android) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Windows) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (macOS) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Linux) (push) Has been cancelled
Build Multi-Platform / 构建 Android APK (push) Has been cancelled
Build Multi-Platform / 构建 Windows (push) Has been cancelled
Build Multi-Platform / 构建 macOS (push) Has been cancelled
Build Multi-Platform / 构建 Linux (push) Has been cancelled
Build Multi-Platform / 构建 iOS (push) Has been cancelled
Build Multi-Platform / 创建 Release (push) Has been cancelled
Build Windows / 编译 libcore (Windows) (push) Has been cancelled
Build Windows / build (push) Has been cancelled
2. 简化了 _kr_handleManualMode,只更新 UI 不触发重选
This commit is contained in:
parent
c7b77c1ad8
commit
1a9f0d79ac
@ -29,14 +29,15 @@ class HINodeListView extends GetView<HINodeListController> {
|
||||
|
||||
/// 获取用于显示的延迟值
|
||||
int _getDisplayDelay(HINodeListController controller, KROutboundItem item) {
|
||||
if (controller.homeController.kr_isConnected.value) {
|
||||
return item.urlTestDelay.value;
|
||||
}
|
||||
if (!_fakeDelays.containsKey(item.tag)) {
|
||||
final random = Random();
|
||||
_fakeDelays[item.tag] = 30 + random.nextInt(71); // 30-100ms
|
||||
}
|
||||
return _fakeDelays[item.tag] ?? 0;
|
||||
// if (controller.homeController.kr_isConnected.value) {
|
||||
//
|
||||
// }
|
||||
// if (!_fakeDelays.containsKey(item.tag)) {
|
||||
// final random = Random();
|
||||
// _fakeDelays[item.tag] = 30 + random.nextInt(71); // 30-100ms
|
||||
// }
|
||||
// return _fakeDelays[item.tag] ?? 0;
|
||||
}
|
||||
|
||||
/// 获取分组内最快节点的延迟值(单位:ms)
|
||||
|
||||
@ -762,24 +762,11 @@ class KRHomeController extends GetxController with WidgetsBindingObserver {
|
||||
.value}',
|
||||
tag: 'HomeController');
|
||||
|
||||
// 如果用户选择了auto但实际select类型不是auto
|
||||
if (kr_cutTag.value == "auto" && element.selected != "auto") {
|
||||
KRLogUtil.kr_d(
|
||||
'用户选择了auto但实际不是auto,重新选择auto', tag: 'HomeController');
|
||||
KRSingBoxImp.instance.kr_selectOutbound("auto");
|
||||
_kr_handleAutoMode(element, allGroups);
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果用户选择了具体节点但实际select类型不是该节点
|
||||
if (kr_cutTag.value != "auto" && element.selected != kr_cutTag.value) {
|
||||
KRLogUtil.kr_d(
|
||||
'用户选择了${kr_cutTag.value}但实际是${element.selected},更新选择',
|
||||
tag: 'HomeController');
|
||||
|
||||
kr_selectNode(kr_cutTag.value);
|
||||
|
||||
return;
|
||||
// 🔧 关键修复:仅更新 UI 状态,不要触发重新选择,避免死循环
|
||||
// 更新 kr_cutSeletedTag 以反映实际选中的节点
|
||||
if (element.selected.isNotEmpty) {
|
||||
kr_cutSeletedTag.value = element.selected;
|
||||
}
|
||||
|
||||
// 如果用户手动选择了节点(不是auto)
|
||||
@ -801,25 +788,13 @@ class KRHomeController extends GetxController with WidgetsBindingObserver {
|
||||
KRLogUtil.kr_d(
|
||||
'处理手动模式 - 选择: ${element.selected}', tag: 'HomeController');
|
||||
|
||||
// 如果当前选择与用户选择不同,更新选择
|
||||
if (kr_cutTag.value != element.selected) {
|
||||
// 检查选择的节点是否有效
|
||||
if (_kr_isValidLatency(kr_cutTag.value)) {
|
||||
kr_selectNode(kr_cutTag.value);
|
||||
// 更新延迟值
|
||||
_kr_updateNodeLatency(element);
|
||||
} else {
|
||||
// 如果选择的节点无效,尝试选择延迟最小的节点
|
||||
_kr_selectBestLatencyNode(element.items);
|
||||
}
|
||||
} else {
|
||||
// 🔧 关键修复:仅更新 UI 状态,不要重新选择节点,避免死循环
|
||||
kr_cutSeletedTag.value = element.selected;
|
||||
// 更新延迟值
|
||||
_kr_updateNodeLatency(element);
|
||||
kr_currentNodeName.value =
|
||||
kr_truncateText(element.selected, maxLength: 25);
|
||||
// kr_moveToSelectedNode();
|
||||
}
|
||||
} catch (e) {
|
||||
KRLogUtil.kr_e('处理手动模式出错: $e', tag: 'HomeController');
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user