alroyso 1 year ago
parent
commit
a55a29fdea

+ 7 - 0
README.md

@@ -19,3 +19,10 @@ dart run ffigen
 
 
 dart run build_runner build --delete-conflicting-outputs
+
+flutter build macos --dart-define OS_ARCH=amd64
+flutter build macos --dart-define OS_ARCH=arm64
+
+
+appdmg ./config.json ./MAC加速器-amd64.dmg
+appdmg ./config.json ./MAC加速器-arm64.dmg

+ 1 - 0
lib/app/controller/GlobalController.dart

@@ -61,6 +61,7 @@ class GlobalController extends GetxController {
     await controllers.config.initConfig();
     await controllers.service.initConfig();
 
+    //await  controllers.service.isService();
     // init service
     await controllers.service.startService();
     if (controllers.service.serviceStatus.value != RunningState.running) return;

+ 22 - 1
lib/app/controller/service.dart

@@ -71,8 +71,29 @@ class ServiceController extends GetxController {
     }
 
   }
+
+  Future<void> isService() async {
+    controllers.global.updateMsg("判断是不是 service-mode");
+    //serviceStatus.value = RunningState.starting;
+    if (Platform.isLinux) {
+      await fixBinaryExecutePermissions(Files.assetsClashService);
+      await fixBinaryExecutePermissions(Files.assetsClashCore);
+    }
+    try {
+      final data = await fetchInfo();
+      if(data.mode == 'service-mode'){
+        controllers.global.updateMsg("服务模式");
+        await serviceModeSwitch(false);
+      }
+
+    } catch (_) {
+
+    }
+    //serviceStatus.value = RunningState.running;
+  }
+
   Future<void> startService() async {
-    controllers.global.updateMsg("开启服务");
+    //controllers.global.updateMsg("开启服务");
     serviceStatus.value = RunningState.starting;
     if (Platform.isLinux) {
       await fixBinaryExecutePermissions(Files.assetsClashService);

+ 1 - 1
lib/app/modules/home/controllers/home_controller.dart

@@ -213,7 +213,7 @@ class HomeController extends GetxController {
           }
         } else {
           if(controllers.service.serviceMode.value == false){
-            controllers.global.updateMsg("需要开启服务,才能使用...");
+            controllers.global.updateMsg("需要开启服务,才能使用,记得卸载服务才能卸载软件...");
             return;
           }
         }

+ 12 - 19
lib/app/modules/home/views/home_view.dart

@@ -193,25 +193,18 @@ class HomeView extends GetView<HomeController> {
                     ],
                   ),
                 ),
-                // Padding(
-                //   padding: const EdgeInsets.fromLTRB(60, 10, 50, 0),
-                //   child: Row(
-                //     children: [
-                //       ElevatedButton(onPressed: () async {
-                //         if(controller.serviceStuatus.value == false){
-                //           await controller.installService();
-                //         } else{
-                //           await controller.UninstallService();
-                //         }
-                //       }, child: controller.serviceStuatus.value == false ? const Text("安装服务") : const Text("卸载服务")),
-                //       const SizedBox(width: 10,),
-                //       ElevatedButton(onPressed: () async{
-                //         await controller.coreRestart();
-                //       }, child: const Text("重启内核")),
-                //     ],
-                //
-                //   ),
-                // )
+               controllers.service.serviceMode.value == true ? Padding(
+                  padding: const EdgeInsets.fromLTRB(60, 10, 50, 0),
+                  child: Row(
+                    mainAxisAlignment: MainAxisAlignment.center,
+                    children: [
+                      ElevatedButton(onPressed: () async {
+                        await controllers.service.serviceModeSwitch(false);
+                      }, child: const Text("卸载服务")),
+                    ],
+
+                  ),
+                ) : Container()
                 // const SizedBox(height: 20,),
                 // Align(
                 //   alignment: Alignment.center,

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

@@ -68,7 +68,7 @@ class WelcomeView extends GetView<WelcomeController> {
 
               mainAxisAlignment: MainAxisAlignment.center,
               children: <Widget>[
-                const SizedBox(height: 500),
+                const SizedBox(height: 500 - 24 ),
                controller.isLoading.value == true ? const CircularProgressIndicator() : Container(), // 菊花加载指示器
                 const SizedBox(height: 10),// 用于给加载指示器和文字之间增加一些空间
                 Text(