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
@@ -25,67 +25,20 @@ class HINodeListController extends GetxController {
/// 更新连接类型
void kr_updateConnectionType(KRConnectionType type) {
KRSingBoxImp.instance.kr_updateConnectionType(type);
KRLogUtil.kr_i('连接类型已更新为: $type', tag: 'HINodeListController');
if (KRSingBoxImp().kr_connectionType.value != type) {
KRSingBoxImp.instance.kr_updateConnectionType(type);
KRLogUtil.kr_i('连接类型已更新为: $type', tag: 'HINodeListController');
// 这里可以添加其他需要的逻辑
}
// 如果当前有选择的国家,触发重选检查
if (homeController.currentSelectedCountry.isNotEmpty) {
KRLogUtil.kr_i('连接类型更新后,检查是否需要重选节点', tag: 'HINodeListController');
// 延迟一下让连接类型更新完成
Future.delayed(const Duration(milliseconds: 500), () {
homeController.checkCountryReselection(KRSingBoxImp.instance.kr_activeGroups);
// homeController.checkCountryReselection(KRSingBoxImp.instance.kr_activeGroups);
});
}
}
/// 获取当前国家内的有效节点标签列表
List<String> getValidNodesInCurrentCountry() {
final country = homeController.currentSelectedCountry.value;
if (country.isEmpty) {
return [];
}
final countryGroup = kr_subscribeService.countryOutboundList
.firstWhereOrNull((group) => group.country == country);
if (countryGroup == null) {
return [];
}
return countryGroup.outboundList
.where((node) => node.urlTestDelay.value < 65535 && node.urlTestDelay.value > 0)
.map((node) => node.tag)
.toList();
}
/// 手动触发当前国家内的重选
void manualReselection() {
final country = homeController.currentSelectedCountry.value;
if (country.isEmpty) {
KRLogUtil.kr_w('没有选择国家,无法进行重选', tag: 'HINodeListController');
return;
}
KRLogUtil.kr_i('用户手动触发国家内重选', tag: 'HINodeListController');
homeController.performCountryReselection(country);
}
/// 获取当前国家内节点的延迟统计(委托给homeController
Map<String, dynamic> getCurrentCountryLatencyStats() {
return homeController.getCurrentCountryNodeStats();
}
/// 启用/禁用动态重选功能(委托给homeController
void setDynamicReselectionEnabled(bool enabled) {
homeController.setCountryReselectionEnabled(enabled);
}
/// 获取动态重选状态信息
Map<String, dynamic> getDynamicReselectionStatus() {
return {
'enabled': homeController.isCountryReselectionEnabled.value,
'currentCountry': homeController.currentSelectedCountry.value,
'latencyThreshold': homeController.countryReselectionLatencyThreshold,
};
}
}