feat: 提交国家分组功能和debug功能
This commit is contained in:
@@ -12,6 +12,15 @@ class HINodeListController extends GetxController {
|
||||
/// 首页服务
|
||||
final KRHomeController homeController = Get.find<KRHomeController>();
|
||||
|
||||
/// 调试模式状态
|
||||
final RxBool isDebugMode = false.obs;
|
||||
|
||||
/// 模式按钮点击计数器
|
||||
int modeButtonClickCount = 0;
|
||||
|
||||
/// 最后一次点击时间
|
||||
DateTime? lastModeButtonClickTime;
|
||||
|
||||
/// 获取连接类型字符串
|
||||
String kr_getConnectionTypeString() {
|
||||
final connectionType = KRSingBoxImp.instance.kr_connectionType.value;
|
||||
@@ -41,4 +50,48 @@ class HINodeListController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
/// 处理模式按钮点击(用于激活调试模式)
|
||||
void kr_handleModeButtonClick() {
|
||||
final now = DateTime.now();
|
||||
|
||||
// 检查是否在2秒内连续点击
|
||||
if (lastModeButtonClickTime != null &&
|
||||
now.difference(lastModeButtonClickTime!).inSeconds > 2) {
|
||||
// 超过2秒,重置计数器
|
||||
modeButtonClickCount = 0;
|
||||
}
|
||||
|
||||
modeButtonClickCount++;
|
||||
lastModeButtonClickTime = now;
|
||||
|
||||
KRLogUtil.kr_i('模式按钮点击次数: $modeButtonClickCount', tag: 'HINodeListController');
|
||||
|
||||
if (modeButtonClickCount >= 5) {
|
||||
// 激活调试模式
|
||||
isDebugMode.value = true;
|
||||
modeButtonClickCount = 0; // 重置计数器
|
||||
KRLogUtil.kr_i('🐛 调试模式已激活!', tag: 'HINodeListController');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// 获取要显示的节点列表(根据调试模式过滤)
|
||||
List<dynamic> kr_getFilteredNodeList() {
|
||||
if (isDebugMode.value) {
|
||||
// 调试模式:显示所有节点
|
||||
return kr_subscribeService.allList;
|
||||
} else {
|
||||
// 正常模式:只显示 country-auto 节点
|
||||
return kr_subscribeService.allList.where((node) => node.tag.endsWith('-auto')).toList();
|
||||
}
|
||||
}
|
||||
|
||||
/// 重置调试模式
|
||||
void kr_resetDebugMode() {
|
||||
isDebugMode.value = false;
|
||||
modeButtonClickCount = 0;
|
||||
lastModeButtonClickTime = null;
|
||||
KRLogUtil.kr_i('调试模式已重置', tag: 'HINodeListController');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user