alroyso 1 year ago
parent
commit
519f81e75b

+ 7 - 31
lib/app/controller/GlobalController.dart

@@ -109,25 +109,6 @@ class GlobalController extends GetxController {
   }
 
   Future<void> updateNode() async {
-    // NodeMode? targetNode;
-    // if (selectedNode.value == null) {
-    //   targetNode = await findNodeWithMinUsers(nodeModes);
-    // } else {
-    //   targetNode = selectedNode.value;
-    // }
-    // if (targetNode != null){
-    //   selectNode(targetNode);
-    //   ProxieProxiesItem? targetProxie = await findProxieByName(targetNode.name);
-    //   if (targetProxie != null) {
-    //     handleSetProxieGroup(targetProxie, targetNode.name);
-    //   }
-    // }
-    // await updateDate();
-  }
-
-  Future<void> startSysMode() async {
-
-    await makeProxy();
     NodeMode? targetNode;
     if (selectedNode.value == null) {
       targetNode = await findNodeWithMinUsers(nodeModes);
@@ -136,24 +117,19 @@ class GlobalController extends GetxController {
     }
     if (targetNode != null){
       selectNode(targetNode);
-     await swift(targetNode.name);
+      await swift(targetNode.name);
 
     }
+  }
+
+  Future<void> startSysMode() async {
+
+    await makeProxy();
+
     //await updateDate();
   }
   Future<void> startTunMode() async {
     await makeProxy();
-    NodeMode? targetNode;
-    if (selectedNode.value == null) {
-      targetNode = await findNodeWithMinUsers(nodeModes);
-    } else {
-      targetNode = selectedNode.value;
-    }
-    if (targetNode != null){
-      selectNode(targetNode);
-      await swift(targetNode.name);
-    }
-
   }
 
   Future<void> swift(String name) async {

+ 9 - 12
lib/app/modules/home/controllers/home_controller.dart

@@ -88,10 +88,11 @@ class HomeController extends GetxController {
   }
 
   Future<void> handleButtonClick() async {
-
+    if(connectStatus.value == ConnectionStatus.connecting ){
+      return;
+    }
     // 如果当前状态是已连接或正在连接,则停止服务
-    if (connectStatus.value == ConnectionStatus.connecting ||
-        connectStatus.value == ConnectionStatus.stopped) {
+    if (connectStatus.value == ConnectionStatus.stopped) {
       controllers.global.allowStatusUpdate = false;
       await controllers.config.setBreakConnections(true);
       // // 停止服务
@@ -129,15 +130,11 @@ class HomeController extends GetxController {
         await controllers.global.systemProxySwitch(true);
       }
 
-      //await controllers.global.handleSetProxieGroup();
-      await controllers.global.updateDate();
-
-      // updateStatus(ConnectionStatus.connecting);
-      // await Future.delayed(const Duration(seconds: 5));
-      // updateStatus(ConnectionStatus.stopped);
-      await controllers.tray.updateTray();
       updateStatus(ConnectionStatus.connecting);
       await Future.delayed(const Duration(seconds: 3));
+      await controllers.global.updateNode();
+      await controllers.global.updateDate();
+      await controllers.tray.updateTray();
       updateStatus(ConnectionStatus.stopped);
     }
   }
@@ -237,8 +234,8 @@ class HomeController extends GetxController {
   String GetExpiredAt() => "到期时间:${userMode.value.expiredAt}";
   String GetTraffic() => "用户流量:${userMode.value.unusedTraffic}";
   String GetNode() => controllers.global.selectedNode.value?.name ?? "未选择节点";
-  String getHttp() => "https://127.0.0.1:${controllers.core.config.value.mixedPort}";
-  String getSocket() => "socks5://127.0.0.1:${controllers.core.config.value.mixedPort}";
+  String getHttp() => "http 127.0.0.1:${controllers.core.config.value.mixedPort}";
+  String getSocket() => "socks 127.0.0.1:${controllers.core.config.value.mixedPort}";
 
   void RouteNode() =>  Get.toNamed(Routes.NODE);
 }

+ 2 - 2
lib/app/modules/welcome/views/welcome_view.dart

@@ -28,10 +28,10 @@ class WelcomeView extends GetView<WelcomeController> {
               ),
             ],
           )
-              : Container(child: TextButton(child: const Text("重新获取"),onPressed: (){
+              : TextButton(child: const Text("重新获取"),onPressed: (){
                 controller.fetchSysConfig();
 
-          },),), // 当不在加载时,你可能想要显示其他的 Widget
+          },), // 当不在加载时,你可能想要显示其他的 Widget
         );
 
       }),

+ 1 - 0
lib/main.dart

@@ -141,6 +141,7 @@ class _MyAppState extends State<MyApp> {
 
 
     return GetMaterialApp(
+      debugShowCheckedModeBanner: false,
       scrollBehavior: const MaterialScrollBehavior().copyWith(
           scrollbars: true,
           dragDevices: kTouchLikeDeviceTypes