|
@@ -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();
|
|
|
}
|
|
|
}
|