Skip to content

Commit

Permalink
Remove TextInputChannel's dependency on FlutterTizenEngine (flutter-t…
Browse files Browse the repository at this point in the history
  • Loading branch information
swift-kim committed Nov 14, 2021
1 parent 0126f7c commit 2283903
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
7 changes: 4 additions & 3 deletions shell/platform/tizen/channels/text_input_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ bool IsASCIIPrintableKey(char c) {

} // namespace

TextInputChannel::TextInputChannel(BinaryMessenger* messenger,
FlutterTizenEngine* engine)
TextInputChannel::TextInputChannel(
BinaryMessenger* messenger,
std::unique_ptr<TizenInputMethodContext> input_method_context)
: channel_(std::make_unique<MethodChannel<rapidjson::Document>>(
messenger,
kChannelName,
&JsonMethodCodec::GetInstance())),
input_method_context_(std::make_unique<TizenInputMethodContext>(engine)) {
input_method_context_(std::move(input_method_context)) {
channel_->SetMethodCallHandler(
[this](const MethodCall<rapidjson::Document>& call,
std::unique_ptr<MethodResult<rapidjson::Document>> result) {
Expand Down
7 changes: 3 additions & 4 deletions shell/platform/tizen/channels/text_input_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

namespace flutter {

class FlutterTizenEngine;

enum class EditStatus { kNone, kPreeditStart, kPreeditEnd, kCommit };

struct TextEditingContext {
Expand All @@ -36,8 +34,9 @@ struct TextEditingContext {

class TextInputChannel {
public:
explicit TextInputChannel(BinaryMessenger* messenger,
FlutterTizenEngine* engine);
explicit TextInputChannel(
BinaryMessenger* messenger,
std::unique_ptr<TizenInputMethodContext> input_method_context);
virtual ~TextInputChannel();

bool IsSoftwareKeyboardShowing() { return is_software_keyboard_showing_; }
Expand Down
4 changes: 3 additions & 1 deletion shell/platform/tizen/flutter_tizen_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "flutter/shell/platform/tizen/logger.h"
#include "flutter/shell/platform/tizen/system_utils.h"
#include "flutter/shell/platform/tizen/tizen_input_method_context.h"

namespace flutter {

Expand Down Expand Up @@ -257,7 +258,8 @@ bool FlutterTizenEngine::RunEngine(const char* entrypoint) {
navigation_channel = std::make_unique<NavigationChannel>(
internal_plugin_registrar_->messenger());
text_input_channel = std::make_unique<TextInputChannel>(
internal_plugin_registrar_->messenger(), this);
internal_plugin_registrar_->messenger(),
std::make_unique<TizenInputMethodContext>(this));
platform_view_channel = std::make_unique<PlatformViewChannel>(
internal_plugin_registrar_->messenger());
key_event_handler_ = std::make_unique<KeyEventHandler>(this);
Expand Down

0 comments on commit 2283903

Please sign in to comment.