Skip to content

Commit ee5b0b9

Browse files
committed
Apply reviewer's comments
1 parent 7978db9 commit ee5b0b9

8 files changed

+42
-32
lines changed

flutter/shell/platform/tizen/channels/text_input_channel.cc

+9-10
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "flutter/shell/platform/common/json_method_codec.h"
88
#include "flutter/shell/platform/tizen/flutter_tizen_engine.h"
99
#include "flutter/shell/platform/tizen/logger.h"
10-
1110
#ifndef WEARABLE_PROFILE
1211
#include "flutter/shell/platform/tizen/tizen_autofill.h"
1312
#endif
@@ -27,7 +26,9 @@ constexpr char kMultilineInputType[] = "TextInputType.multiline";
2726
constexpr char kUpdateEditingStateMethod[] =
2827
"TextInputClient.updateEditingState";
2928
constexpr char kPerformActionMethod[] = "TextInputClient.performAction";
29+
#ifndef WEARABLE_PROFILE
3030
constexpr char kRequestAutofillMethod[] = "TextInput.requestAutofill";
31+
#endif
3132
constexpr char kSetPlatformViewClient[] = "TextInput.setPlatformViewClient";
3233
constexpr char kTextCapitalization[] = "textCapitalization";
3334
constexpr char kTextEnableSuggestions[] = "enableSuggestions";
@@ -69,11 +70,12 @@ TextInputChannel::TextInputChannel(
6970
std::unique_ptr<MethodResult<rapidjson::Document>> result) {
7071
HandleMethodCall(call, std::move(result));
7172
});
73+
7274
#ifndef WEARABLE_PROFILE
73-
TizenAutofill& instance = TizenAutofill::GetInstance();
74-
instance.SetOnPopup(
75+
TizenAutofill& autofill = TizenAutofill::GetInstance();
76+
autofill.SetOnPopup(
7577
[this]() { input_method_context_->PopupAutofillItems(); });
76-
instance.SetOnCommit([this](std::string value) { OnCommit(value); });
78+
autofill.SetOnCommit([this](std::string value) { OnCommit(value); });
7779
#endif
7880
}
7981

@@ -249,9 +251,9 @@ void TextInputChannel::HandleMethodCall(
249251
auto hints_iter = autofill_iter->value.FindMember(kHints);
250252
if (hints_iter != autofill_iter->value.MemberEnd() &&
251253
hints_iter->value.IsArray()) {
254+
autofill_hints_.clear();
252255
for (auto hint = hints_iter->value.GetArray().Begin();
253256
hint != hints_iter->value.GetArray().End(); hint++) {
254-
autofill_hints_.clear();
255257
autofill_hints_.push_back(hint->GetString());
256258
}
257259
}
@@ -319,12 +321,9 @@ void TextInputChannel::HandleMethodCall(
319321
cursor_offset);
320322
}
321323
SendStateUpdate();
322-
} else if (method.compare(kRequestAutofillMethod) == 0) {
323324
#ifndef WEARABLE_PROFILE
324-
TizenAutofill& instance = TizenAutofill::GetInstance();
325-
instance.RequestAutofill(autofill_hints_, autofill_id_);
326-
#else
327-
result->NotImplemented();
325+
} else if (method.compare(kRequestAutofillMethod) == 0) {
326+
TizenAutofill::GetInstance().RequestAutofill(autofill_hints_, autofill_id_);
328327
#endif
329328
} else {
330329
result->NotImplemented();

flutter/shell/platform/tizen/channels/text_input_channel.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ class TextInputChannel {
8181
// https://api.flutter.dev/flutter/services/TextCapitalization.html
8282
std::string text_capitalization_ = "";
8383

84+
// The active autofill client id.
8485
std::string autofill_id_;
8586

86-
// Hints for request autofill. See availabel options:
87+
// A list of autofill hint strings. See available options:
8788
// https://api.flutter.dev/flutter/services/AutofillHints-class.html
8889
std::vector<std::string> autofill_hints_;
8990
};

flutter/shell/platform/tizen/nui_autofill_popup.cc

+22-13
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,34 @@
1111
#include "flutter/shell/platform/tizen/tizen_autofill.h"
1212

1313
namespace flutter {
14-
bool NuiAutofillPopup::OnTouch(Dali::Actor actor,
14+
15+
bool NuiAutofillPopup::Touched(Dali::Actor actor,
1516
const Dali::TouchEvent& event) {
1617
const Dali::PointState::Type state = event.GetState(0);
1718
if (Dali::PointState::DOWN == state) {
18-
auto t = actor.GetProperty(Dali::Actor::Property::NAME).Get<std::string>();
19-
on_commit_(t);
20-
OnHide();
19+
std::string text =
20+
actor.GetProperty(Dali::Actor::Property::NAME).Get<std::string>();
21+
on_commit_(text);
22+
Hide();
2123
}
2224
return true;
2325
}
2426

25-
void NuiAutofillPopup::OnHide() {
26-
// TODO : There is a phenomenon where white traces remain for a while when
27-
// popup disappears.
27+
void NuiAutofillPopup::Hide() {
28+
// TODO(Swanseo0) : There is a phenomenon where white traces remain for a
29+
// while when popup disappears.
2830
popup_.SetDisplayState(Dali::Toolkit::Popup::HIDDEN);
2931
}
3032

31-
void NuiAutofillPopup::OnHidden() {
33+
void NuiAutofillPopup::Hidden() {
3234
popup_.Unparent();
3335
popup_.Reset();
3436
}
3537

38+
void NuiAutofillPopup::OutsideTouched() {
39+
Hide();
40+
}
41+
3642
void NuiAutofillPopup::PrepareAutofill() {
3743
popup_ = Dali::Toolkit::Popup::New();
3844
popup_.SetProperty(Dali::Actor::Property::NAME, "popup");
@@ -42,14 +48,16 @@ void NuiAutofillPopup::PrepareAutofill() {
4248
Dali::AnchorPoint::TOP_LEFT);
4349
popup_.SetProperty(Dali::Toolkit::Popup::Property::TAIL_VISIBILITY, false);
4450
popup_.SetBackgroundColor(Dali::Color::WHITE_SMOKE);
45-
popup_.OutsideTouchedSignal().Connect(this, &NuiAutofillPopup::OnHide);
46-
popup_.HiddenSignal().Connect(this, &NuiAutofillPopup::OnHidden);
51+
popup_.OutsideTouchedSignal().Connect(this,
52+
&NuiAutofillPopup::OutsideTouched);
53+
popup_.HiddenSignal().Connect(this, &NuiAutofillPopup::Hidden);
4754
popup_.SetProperty(Dali::Toolkit::Popup::Property::BACKING_ENABLED, false);
4855
popup_.SetProperty(Dali::Toolkit::Popup::Property::AUTO_HIDE_DELAY, 2500);
4956
}
5057

5158
void NuiAutofillPopup::PopupAutofill(Dali::Actor* actor) {
52-
const auto& items = TizenAutofill::GetInstance().GetAutofillItems();
59+
const std::vector<std::unique_ptr<AutofillItem>>& items =
60+
TizenAutofill::GetInstance().GetAutofillItems();
5361
if (items.size() > 0) {
5462
PrepareAutofill();
5563
Dali::Toolkit::TableView content =
@@ -59,14 +67,15 @@ void NuiAutofillPopup::PopupAutofill(Dali::Actor* actor) {
5967
content.SetProperty(Dali::Actor::Property::PADDING,
6068
Dali::Vector4(10, 10, 0, 0));
6169
for (uint32_t i = 0; i < items.size(); ++i) {
62-
auto label = Dali::Toolkit::TextLabel::New(items[i]->label_);
70+
Dali::Toolkit::TextLabel label =
71+
Dali::Toolkit::TextLabel::New(items[i]->label_);
6372
label.SetProperty(Dali::Actor::Property::NAME, items[i]->value_);
6473
label.SetResizePolicy(Dali::ResizePolicy::DIMENSION_DEPENDENCY,
6574
Dali::Dimension::HEIGHT);
6675
label.SetProperty(Dali::Toolkit::TextLabel::Property::TEXT_COLOR,
6776
Dali::Color::WHITE_SMOKE);
6877
label.SetProperty(Dali::Toolkit::TextLabel::Property::POINT_SIZE, 7.0f);
69-
label.TouchedSignal().Connect(this, &NuiAutofillPopup::OnTouch);
78+
label.TouchedSignal().Connect(this, &NuiAutofillPopup::Touched);
7079
content.AddChild(label, Dali::Toolkit::TableView::CellPosition(i, 0));
7180
content.SetFitHeight(i);
7281
}

flutter/shell/platform/tizen/nui_autofill_popup.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,20 @@ using OnRendering = std::function<void()>;
1616

1717
class NuiAutofillPopup : public Dali::ConnectionTracker {
1818
public:
19-
bool OnTouch(Dali::Actor actor, const Dali::TouchEvent& event);
19+
void Hide();
2020

21-
void OnHide();
21+
void Hidden();
2222

23-
void OnHidden();
23+
void OutsideTouched();
2424

2525
void PrepareAutofill();
2626

2727
void PopupAutofill(Dali::Actor* actor);
2828

2929
void SetOnCommit(OnCommit callback) { on_commit_ = callback; }
3030

31+
bool Touched(Dali::Actor actor, const Dali::TouchEvent& event);
32+
3133
private:
3234
Dali::Toolkit::Popup popup_;
3335
OnCommit on_commit_;

flutter/shell/platform/tizen/tizen_autofill.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void TizenAutofill::RegisterAutofillItem(std::string view_id,
133133
autofill_save_item_set_sensitive_data(save_item, item.sensitive_data_);
134134
autofill_save_item_set_value(save_item, item.value_.c_str());
135135

136-
char* app_id;
136+
char* app_id = nullptr;
137137
app_get_id(&app_id);
138138

139139
autofill_save_view_info_h save_view_info = nullptr;

flutter/shell/platform/tizen/tizen_autofill.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class TizenAutofill {
4545
void OnCommit(std::string str) { on_commit_(str); }
4646

4747
void OnPopup() { on_popup_(); }
48-
#
48+
4949
const std::vector<std::unique_ptr<AutofillItem>>& GetAutofillItems() {
5050
return response_items_;
5151
}
@@ -57,7 +57,6 @@ class TizenAutofill {
5757

5858
void InitailizeAutofill();
5959

60-
// TODO : implement convert flutter hint to tizen hint function
6160
std::optional<autofill_hint_e> ConvertAutofillHint(std::string hint);
6261

6362
autofill_h autofill_;

flutter/shell/platform/tizen/tizen_view_elementary.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ void TizenViewElementary::PrepareInputMethod() {
385385
item.get());
386386
}
387387
}
388-
// TODO : Change ctxpopup's position to focused input field.
388+
// TODO(Swanseo0) : Change ctxpopup's position to focused input field.
389389
evas_object_move(ctxpopup_, 0, 0);
390390
evas_object_show(ctxpopup_);
391391
});

flutter/shell/platform/tizen/tizen_window_elementary.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ void TizenWindowElementary::PrepareInputMethod() {
464464
item.get());
465465
}
466466
}
467-
// TODO : Change ctxpopup's position to focused input field.
467+
// TODO(Swanseo0) : Change ctxpopup's position to focused input field.
468468
evas_object_move(ctxpopup_, initial_geometry_.left, initial_geometry_.top);
469469
evas_object_show(ctxpopup_);
470470
});

0 commit comments

Comments
 (0)