feat: debug
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 Windows / 编译 libcore (Windows) (push) Has been cancelled
Build Windows / build (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 / 构建 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 Multi-Platform / 构建 Windows (push) Has been cancelled

This commit is contained in:
2025-11-01 23:14:39 -07:00
parent 1e7175edf5
commit 765b45c0fc
4 changed files with 185 additions and 282 deletions
@@ -42,19 +42,22 @@ class HINodeListView extends GetView<HINodeListController> {
/// 获取分组内最快节点的延迟值(单位:ms)
/// 如果列表为空,返回 0
int getFastestNodeDelay(
HINodeListController controller, List<KROutboundItem> outboundList) {
HINodeListController controller,
List<KROutboundItem> outboundList,
) {
if (outboundList.isEmpty) return 0;
int fastestDelay = _getDisplayDelay(controller, outboundList.first);
// 过滤掉不可用节点(延迟标记为 65535 或负数)
final validNodes = outboundList.where((node) {
final delay = node.urlTestDelay.value;
return delay > 0 && delay < 65535;
}).toList();
for (final item in outboundList.skip(1)) {
final delay = _getDisplayDelay(controller, item);
if (delay < fastestDelay) {
fastestDelay = delay;
}
}
if (validNodes.isEmpty) return 0;
return fastestDelay;
// 返回最小延迟值
validNodes.sort((a, b) => a.urlTestDelay.value.compareTo(b.urlTestDelay.value));
return validNodes.first.urlTestDelay.value;
}
/// 找出延迟最低(最快)的节点对象
@@ -109,11 +112,19 @@ class HINodeListView extends GetView<HINodeListController> {
_buildEmptyListPlaceholder(context, AppTranslations.kr_home.noRegions)
else ...[
InkWell(
onTap: () {
controller.homeController.kr_selectNode('auto');
controller.homeController.kr_currentListStatus.value =
KRHomeViewsListStatus.kr_none;
controller.homeController.kr_coutryText.value = 'auto';
// 🔧 修复:改为 async,等待节点切换完成后再关闭列表
onTap: () async {
try {
final success =
await controller.homeController.kr_performNodeSwitch('auto');
if (success) {
controller.homeController.kr_currentListStatus.value =
KRHomeViewsListStatus.kr_none;
}
} catch (e) {
KRLogUtil.kr_e('Auto选项切换异常: $e',
tag: 'NodeListView');
}
},
child: Container(
decoration: BoxDecoration(
@@ -189,14 +200,7 @@ class HINodeListView extends GetView<HINodeListController> {
return InkWell(
onTap: () {
// 自动选择这个国家下的节点延迟中最快的
final item = findFastestNode(country.outboundList);
KRLogUtil.kr_i(item.tag);
print('item${item.toString()}');
controller.homeController.kr_selectNode(item.tag);
controller.homeController.kr_currentListStatus.value =
KRHomeViewsListStatus.kr_none;
controller.homeController.kr_coutryText.value = country.country;
controller.homeController.onCountrySelected(country.country);
},
child: _kr_buildCountryListItem(context, country: country),
);