diff --git a/flutter/shell/platform/tizen/BUILD.gn b/flutter/shell/platform/tizen/BUILD.gn index 51ac0c8..0026bc7 100644 --- a/flutter/shell/platform/tizen/BUILD.gn +++ b/flutter/shell/platform/tizen/BUILD.gn @@ -188,10 +188,9 @@ template("embedder") { minor_version = 0 } - if (major_version >= 6 || (major_version >= 5 && minor_version >= 5)) { - sources += [ - "tizen_autofill.cc", - ] + if (((major_version >= 5 && minor_version >= 5) || major_version >= 6) && + target_name != "flutter_tizen_wearable") { + sources += [ "tizen_autofill.cc" ] libs += [ "capi-ui-autofill", @@ -201,11 +200,12 @@ template("embedder") { defines += [ "AUTOFILL_SUPPORT" ] } - if ((major_version >= 7 || (major_version >= 6 && minor_version >= 5)) && target_name != "flutter_tizen_wearable") { + if (((major_version >= 6 && minor_version >= 5) || major_version >= 7) && + target_name != "flutter_tizen_wearable") { sources += [ "flutter_tizen_nui.cc", - "tizen_view_nui.cc", "nui_autofill_popup.cc", + "tizen_view_nui.cc", ] libs += [ diff --git a/flutter/shell/platform/tizen/channels/text_input_channel.cc b/flutter/shell/platform/tizen/channels/text_input_channel.cc index 4049f4a..b187e4c 100644 --- a/flutter/shell/platform/tizen/channels/text_input_channel.cc +++ b/flutter/shell/platform/tizen/channels/text_input_channel.cc @@ -27,6 +27,7 @@ constexpr char kMultilineInputType[] = "TextInputType.multiline"; constexpr char kUpdateEditingStateMethod[] = "TextInputClient.updateEditingState"; constexpr char kPerformActionMethod[] = "TextInputClient.performAction"; +constexpr char kRequestAutofillMethod[] = "TextInput.requestAutofill"; constexpr char kSetPlatformViewClient[] = "TextInput.setPlatformViewClient"; constexpr char kTextCapitalization[] = "textCapitalization"; constexpr char kTextEnableSuggestions[] = "enableSuggestions"; @@ -45,8 +46,6 @@ constexpr char kSelectionIsDirectionalKey[] = "selectionIsDirectional"; constexpr char kTextKey[] = "text"; constexpr char kBadArgumentError[] = "Bad Arguments"; constexpr char kInternalConsistencyError[] = "Internal Consistency Error"; - -constexpr char kRequestAutofillMethod[] = "TextInput.requestAutofill"; constexpr char kAutofill[] = "autofill"; constexpr char kUniqueIdentifier[] = "uniqueIdentifier"; constexpr char kHints[] = "hints"; @@ -70,9 +69,11 @@ TextInputChannel::TextInputChannel( std::unique_ptr> result) { HandleMethodCall(call, std::move(result)); }); +#ifdef AUTOFILL_SUPPORT TizenAutofill& instance = TizenAutofill::GetInstance(); instance.SetPopupCallback( [this]() { input_method_context_->PopupAutofillItems(); }); +#endif instance.SetCommitCallback([this](std::string value) { OnCommit(value); }); } @@ -318,10 +319,12 @@ void TextInputChannel::HandleMethodCall( cursor_offset); } SendStateUpdate(); -#ifdef AUTOFILL_SUPPORT } else if (method.compare(kRequestAutofillMethod) == 0) { +#ifdef AUTOFILL_SUPPORT TizenAutofill& instance = TizenAutofill::GetInstance(); instance.RequestAutofill(autofill_hints_, autofill_id_); +#else + result->NotImplemented(); #endif } else { result->NotImplemented(); diff --git a/flutter/shell/platform/tizen/nui_autofill_popup.cc b/flutter/shell/platform/tizen/nui_autofill_popup.cc index 6e3dc24..22386d3 100644 --- a/flutter/shell/platform/tizen/nui_autofill_popup.cc +++ b/flutter/shell/platform/tizen/nui_autofill_popup.cc @@ -1,3 +1,7 @@ +// Copyright 2023 Samsung Electronics Co., Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + #include "flutter/shell/platform/tizen/nui_autofill_popup.h" #include @@ -6,8 +10,6 @@ #include "flutter/shell/platform/tizen/tizen_autofill.h" -#include "flutter/shell/platform/tizen/logger.h" - namespace flutter { bool NuiAutofillPopup::OnTouch(Dali::Actor actor, const Dali::TouchEvent& event) { diff --git a/flutter/shell/platform/tizen/tizen_autofill.cc b/flutter/shell/platform/tizen/tizen_autofill.cc index 1c3301a..3f721b0 100644 --- a/flutter/shell/platform/tizen/tizen_autofill.cc +++ b/flutter/shell/platform/tizen/tizen_autofill.cc @@ -8,7 +8,6 @@ #include #include -#include #include "flutter/shell/platform/tizen/logger.h" @@ -17,15 +16,14 @@ TizenAutofill::TizenAutofill() { } TizenAutofill::~TizenAutofill() { - autofill_destroy(ah_); + autofill_destroy(autofill_); } void TizenAutofill::InitailizeAutofill() { - autofill_create(&ah_); + autofill_create(&autofill_); - int ret; - ret = autofill_connect( - ah_, + int ret = autofill_connect( + autofill_, [](autofill_h ah, autofill_connection_status_e status, void* user_data) { }, NULL); @@ -34,7 +32,7 @@ void TizenAutofill::InitailizeAutofill() { } autofill_fill_response_set_received_cb( - ah_, + autofill_, [](autofill_h ah, autofill_fill_response_h fill_response, void* data) { int count = 0; autofill_fill_response_get_group_count(fill_response, &count); @@ -110,7 +108,7 @@ void TizenAutofill::RequestAutofill(std::vector hints, } } - int ret = autofill_fill_request(ah_, view_info); + int ret = autofill_fill_request(autofill_, view_info); if (ret != AUTOFILL_ERROR_NONE) { FT_LOG(Error) << "autofill_fill_request error"; } @@ -145,9 +143,7 @@ void TizenAutofill::RegisterAutofillItem(std::string view_id, free(app_id); } - int ret; - - ret = autofill_commit(ah_, svi_h); + int ret = autofill_commit(autofill_, svi_h); if (ret != AUTOFILL_ERROR_NONE) { FT_LOG(Error) << "autofill_commit error"; } diff --git a/flutter/shell/platform/tizen/tizen_autofill.h b/flutter/shell/platform/tizen/tizen_autofill.h index a00d7e5..ea96f7c 100644 --- a/flutter/shell/platform/tizen/tizen_autofill.h +++ b/flutter/shell/platform/tizen/tizen_autofill.h @@ -66,7 +66,7 @@ class TizenAutofill { // TODO : implement convert flutter hint to tizen hint function std::optional ConvertAutofillHint(std::string hint); - autofill_h ah_; + autofill_h autofill_; std::vector> response_items_; diff --git a/flutter/shell/platform/tizen/tizen_view_elementary.cc b/flutter/shell/platform/tizen/tizen_view_elementary.cc index 3967fc8..5a878c4 100644 --- a/flutter/shell/platform/tizen/tizen_view_elementary.cc +++ b/flutter/shell/platform/tizen/tizen_view_elementary.cc @@ -8,7 +8,9 @@ #include #include "flutter/shell/platform/tizen/logger.h" +#ifdef AUTOFILL_SUPPORT #include "flutter/shell/platform/tizen/tizen_autofill.h" +#endif #include "flutter/shell/platform/tizen/tizen_view_event_handler_delegate.h" namespace flutter { diff --git a/flutter/shell/platform/tizen/tizen_view_nui.cc b/flutter/shell/platform/tizen/tizen_view_nui.cc index 017e036..db06fd9 100644 --- a/flutter/shell/platform/tizen/tizen_view_nui.cc +++ b/flutter/shell/platform/tizen/tizen_view_nui.cc @@ -5,6 +5,7 @@ #include "flutter/shell/platform/tizen/tizen_view_nui.h" #include + #include #include "flutter/shell/platform/tizen/logger.h" diff --git a/flutter/shell/platform/tizen/tizen_window_elementary.cc b/flutter/shell/platform/tizen/tizen_window_elementary.cc index a4d6723..4b70f54 100644 --- a/flutter/shell/platform/tizen/tizen_window_elementary.cc +++ b/flutter/shell/platform/tizen/tizen_window_elementary.cc @@ -11,6 +11,9 @@ #include #include "flutter/shell/platform/tizen/logger.h" +#ifdef AUTOFILL_SUPPORT +#include "flutter/shell/platform/tizen/tizen_autofill.h" +#endif #include "flutter/shell/platform/tizen/tizen_view_event_handler_delegate.h" namespace flutter { diff --git a/tools/generate_sysroot.py b/tools/generate_sysroot.py index ed12310..81acd4b 100755 --- a/tools/generate_sysroot.py +++ b/tools/generate_sysroot.py @@ -43,10 +43,6 @@ 'capi-system-system-settings-devel', 'capi-ui-efl-util', 'capi-ui-efl-util-devel', - 'capi-ui-autofill', - 'capi-ui-autofill-devel', - 'capi-ui-autofill-common', - 'capi-ui-autofill-common-devel', 'cbhm', 'cbhm-devel', 'coregl', @@ -117,6 +113,14 @@ 'wayland-devel', ] +# Only available for Tizen 5.5 and above. +autofill_packages = [ + 'capi-ui-autofill', + 'capi-ui-autofill-devel', + 'capi-ui-autofill-common', + 'capi-ui-autofill-common-devel', +] + # Only available for Tizen 6.5 and above. dali_packages = [ 'dali2', @@ -159,6 +163,9 @@ def generate_sysroot(sysroot: Path, api_version: float, arch: str, quiet=False): existing_rpms = [f for f in download_path.iterdir() if f.suffix == '.rpm'] packages = base_packages + unified_packages + if api_version >= 5.5: + packages += autofill_packages + if api_version >= 6.5: packages += dali_packages