alroyso 4 months ago
parent
commit
5817e7ed9d
1 changed files with 13 additions and 15 deletions
  1. 13 15
      windows/wl_base_help_plugin.cpp

+ 13 - 15
windows/wl_base_help_plugin.cpp

@@ -257,7 +257,18 @@ WlBaseHelpPlugin::~WlBaseHelpPlugin() {}
 void WlBaseHelpPlugin::HandleMethodCall(
     const flutter::MethodCall<flutter::EncodableValue>& method_call,
     std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
-    
+     if (method_call.method_name().compare("startProxy") == 0) {
+        const auto* arguments = std::get_if<flutter::EncodableMap>(method_call.arguments());
+        int port = std::get<int>(arguments->at(flutter::EncodableValue("port")));
+        startProxy(port);
+        result->Success();
+      } else if (method_call.method_name().compare("stopProxy") == 0) {
+        stopProxy();
+        result->Success();
+      } else if (method_call.method_name().compare("isProxyEnabled") == 0) {
+        bool enabled = isProxyEnabled();
+        result->Success(flutter::EncodableValue(enabled));
+      }
 
     if (method_call.method_name().compare("isProcessRunning") == 0) {
         const auto* arguments = std::get_if<flutter::EncodableMap>(method_call.arguments());
@@ -302,20 +313,7 @@ void WlBaseHelpPlugin::HandleMethodCall(
       version_stream << "7";
     }
     result->Success(flutter::EncodableValue(version_stream.str()));
-  } else if (method_call.method_name().compare("startProxy") == 0) {
-       const auto* arguments = std::get_if<flutter::EncodableMap>(method_call.arguments());
-       int port = std::get<int>(arguments->at(flutter::EncodableValue("port")));
-       startProxy(port);
-       result->Success();
-     } else if (method_call.method_name().compare("stopProxy") == 0) {
-       stopProxy();
-       result->Success();
-     } else if (method_call.method_name().compare("isProxyEnabled") == 0) {
-       bool enabled = isProxyEnabled();
-       result->Success(flutter::EncodableValue(enabled));
-     } else {
-       result->NotImplemented();
-     } else {
+  } else {
     result->NotImplemented();
   }
 }