Skip to content

Commit

Permalink
[webview_flutter] Add ewk_set_version_policy() call
Browse files Browse the repository at this point in the history
If EWK, the web engine of webview flutter, has an upgrade as a UWE feature,
`ewk_set_version_policy(1)` must be called before set arguments.

+ Add missing ewk_shutdown().
  • Loading branch information
JSUYA committed Jan 12, 2024
1 parent 00d1524 commit f386143
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/webview_flutter/tizen/src/ewk_internal_api_binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ bool EwkInternalApiBinding::Initialize() {
main.SetArguments = reinterpret_cast<EwkSetArgumentsFnPtr>(
dlsym(handle_, "ewk_set_arguments"));

main.SetVersionPolicy = reinterpret_cast<EwkSetVersionPolicyFnPtr>(
dlsym(handle_, "ewk_set_version_policy"));

// ewk_settings
settings.ImePanelEnabledSet =
reinterpret_cast<EwkSettingsImePanelEnabledSetFnPtr>(
Expand All @@ -60,7 +63,8 @@ bool EwkInternalApiBinding::Initialize() {
return view.SetBackgroundColor && view.FeedTouchEvent && view.SendKeyEvent &&
view.OffscreenRenderingEnabledSet && view.ImeWindowSet &&
view.KeyEventsEnabledSet && view.SupportVideoHoleSet &&
main.SetArguments && settings.ImePanelEnabledSet &&
console_message.LevelGet && console_message.TextGet &&
console_message.LineGet && console_message.SourceGet;
main.SetArguments && main.SetVersionPolicy &&
settings.ImePanelEnabledSet && console_message.LevelGet &&
console_message.TextGet && console_message.LineGet &&
console_message.SourceGet;
}
2 changes: 2 additions & 0 deletions packages/webview_flutter/tizen/src/ewk_internal_api_binding.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ typedef struct {
} EwkViewProcTable;

typedef void (*EwkSetArgumentsFnPtr)(int argc, char** argv);
typedef void (*EwkSetVersionPolicyFnPtr)(int preference);

typedef struct {
EwkSetArgumentsFnPtr SetArguments = nullptr;
EwkSetVersionPolicyFnPtr SetVersionPolicy = nullptr;
} EwkMainProcTable;

typedef struct Ewk_Settings Ewk_Settings;
Expand Down
4 changes: 4 additions & 0 deletions packages/webview_flutter/tizen/src/webview.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ void WebView::Dispose() {
&WebView::OnUrlChange);
evas_object_del(webview_instance_);
}

ewk_shutdown();
}

void WebView::Offset(double left, double top) {
Expand Down Expand Up @@ -286,6 +288,8 @@ void WebView::SetDirection(int direction) {
}

void WebView::InitWebView() {
EwkInternalApiBinding::GetInstance().main.SetVersionPolicy(1);

char* chromium_argv[] = {
const_cast<char*>("--disable-pinch"),
const_cast<char*>("--js-flags=--expose-gc"),
Expand Down

0 comments on commit f386143

Please sign in to comment.