|
4 | 4 | #include "platform_view_channel.h"
|
5 | 5 |
|
6 | 6 | #include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/plugin_registrar.h"
|
7 |
| -#include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/standard_method_codec.h" |
8 | 7 | #include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/standard_message_codec.h"
|
| 8 | +#include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/standard_method_codec.h" |
9 | 9 | #include "flutter/shell/platform/common/cpp/json_method_codec.h"
|
10 | 10 | #include "flutter/shell/platform/tizen/logger.h"
|
11 | 11 | #include "flutter/shell/platform/tizen/public/flutter_platform_view.h"
|
@@ -52,6 +52,17 @@ flutter::EncodableMap extractMapFromMap(
|
52 | 52 | return flutter::EncodableMap();
|
53 | 53 | }
|
54 | 54 |
|
| 55 | +flutter::EncodableList extractListFromMap( |
| 56 | + const flutter::EncodableValue& arguments, const char* key) { |
| 57 | + if (std::holds_alternative<flutter::EncodableMap>(arguments)) { |
| 58 | + flutter::EncodableMap values = std::get<flutter::EncodableMap>(arguments); |
| 59 | + flutter::EncodableValue value = values[flutter::EncodableValue(key)]; |
| 60 | + if (std::holds_alternative<flutter::EncodableList>(value)) |
| 61 | + return std::get<flutter::EncodableList>(value); |
| 62 | + } |
| 63 | + return flutter::EncodableList(); |
| 64 | +} |
| 65 | + |
55 | 66 | PlatformViewChannel::PlatformViewChannel(flutter::BinaryMessenger* messenger)
|
56 | 67 | : channel_(
|
57 | 68 | std::make_unique<flutter::MethodChannel<flutter::EncodableValue>>(
|
@@ -126,8 +137,23 @@ void PlatformViewChannel::HandleMethodCall(
|
126 | 137 | it->second->resize(width, height);
|
127 | 138 | result->NotImplemented();
|
128 | 139 | } else if (method == "touch") {
|
129 |
| - LoggerD("PlatformViewChannel touch"); |
130 |
| - result->NotImplemented(); |
| 140 | + int type, button; |
| 141 | + double x, y, dx, dy; |
| 142 | + |
| 143 | + flutter::EncodableList event = extractListFromMap(arguments, "event"); |
| 144 | + if (event.size() != 6) { |
| 145 | + result->Error("Invalid Arguments"); |
| 146 | + return; |
| 147 | + } |
| 148 | + type = std::get<int>(event[0]); |
| 149 | + button = std::get<int>(event[1]); |
| 150 | + x = std::get<double>(event[2]); |
| 151 | + y = std::get<double>(event[3]); |
| 152 | + dx = std::get<double>(event[4]); |
| 153 | + dy = std::get<double>(event[5]); |
| 154 | + |
| 155 | + it->second->touch(type, button, x, y, dx, dy); |
| 156 | + result->Success(); |
131 | 157 | } else if (method == "setDirection") {
|
132 | 158 | LoggerD("PlatformViewChannel setDirection");
|
133 | 159 | result->NotImplemented();
|
|
0 commit comments