diff --git a/shell/platform/tizen/channels/platform_view_channel.cc b/shell/platform/tizen/channels/platform_view_channel.cc index 779b50e4d46b3..c076e36a0f5ae 100644 --- a/shell/platform/tizen/channels/platform_view_channel.cc +++ b/shell/platform/tizen/channels/platform_view_channel.cc @@ -4,8 +4,8 @@ #include "platform_view_channel.h" #include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/plugin_registrar.h" -#include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/standard_method_codec.h" #include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/standard_message_codec.h" +#include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/standard_method_codec.h" #include "flutter/shell/platform/common/cpp/json_method_codec.h" #include "flutter/shell/platform/tizen/logger.h" #include "flutter/shell/platform/tizen/public/flutter_platform_view.h" @@ -52,6 +52,17 @@ flutter::EncodableMap extractMapFromMap( return flutter::EncodableMap(); } +flutter::EncodableList extractListFromMap( + const flutter::EncodableValue& arguments, const char* key) { + if (std::holds_alternative(arguments)) { + flutter::EncodableMap values = std::get(arguments); + flutter::EncodableValue value = values[flutter::EncodableValue(key)]; + if (std::holds_alternative(value)) + return std::get(value); + } + return flutter::EncodableList(); +} + PlatformViewChannel::PlatformViewChannel(flutter::BinaryMessenger* messenger) : channel_( std::make_unique>( @@ -126,8 +137,23 @@ void PlatformViewChannel::HandleMethodCall( it->second->resize(width, height); result->NotImplemented(); } else if (method == "touch") { - LoggerD("PlatformViewChannel touch"); - result->NotImplemented(); + int type, button; + double x, y, dx, dy; + + flutter::EncodableList event = extractListFromMap(arguments, "event"); + if (event.size() != 6) { + result->Error("Invalid Arguments"); + return; + } + type = std::get(event[0]); + button = std::get(event[1]); + x = std::get(event[2]); + y = std::get(event[3]); + dx = std::get(event[4]); + dy = std::get(event[5]); + + it->second->touch(type, button, x, y, dx, dy); + result->Success(); } else if (method == "setDirection") { LoggerD("PlatformViewChannel setDirection"); result->NotImplemented(); diff --git a/shell/platform/tizen/public/flutter_platform_view.h b/shell/platform/tizen/public/flutter_platform_view.h index b86b2f9ccccb9..e6f0464506340 100644 --- a/shell/platform/tizen/public/flutter_platform_view.h +++ b/shell/platform/tizen/public/flutter_platform_view.h @@ -23,7 +23,8 @@ class PlatformView { flutter::PluginRegistrar* getPluginRegistrar() { return registrar_; } virtual void dispose() = 0; virtual void resize(double width, double height) = 0; - virtual void touch() = 0; + virtual void touch(int type, int button, double x, double y, double dx, + double dy) = 0; virtual void setDirection(int direction) = 0; virtual void clearFocus() = 0;