Skip to content

Commit 46ce1fd

Browse files
committed
[webview_flutter_tizen] Fix back key, exit key handling
- If the key passed to the webview is the exit key, SendKey() returns false so that the embedder terminates the app without processing it in the platform view. - If the key passed to the webview is the back key and the page back button no longer works, SendKey() returns false so that SystemNavigatePop is triggered.
1 parent c95a018 commit 46ce1fd

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

packages/webview_flutter/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.9.7
2+
3+
* Fix back key, exit key handling.
4+
15
## 0.9.6
26

37
* Update code format.

packages/webview_flutter/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ This package is not an _endorsed_ implementation of `webview_flutter`. Therefore
2323
```yaml
2424
dependencies:
2525
webview_flutter: ^4.10.0
26-
webview_flutter_tizen: ^0.9.6
26+
webview_flutter_tizen: ^0.9.7
2727
```
2828
2929
## Example

packages/webview_flutter/pubspec.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: webview_flutter_tizen
22
description: Tizen implementation of the webview_flutter plugin.
33
homepage: https://github.com/flutter-tizen/plugins
44
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/webview_flutter
5-
version: 0.9.6
5+
version: 0.9.7
66

77
environment:
88
sdk: ">=3.1.0 <4.0.0"
@@ -27,4 +27,3 @@ topics:
2727
- html
2828
- webview
2929
- webview-flutter
30-

packages/webview_flutter/tizen/src/webview.cc

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,17 @@ bool WebView::SendKey(const char* key, const char* string, const char* compose,
302302
return false;
303303
}
304304

305-
if (strcmp(key, "XF86Back") == 0 && !is_down &&
306-
ewk_view_back_possible(webview_instance_)) {
307-
ewk_view_back(webview_instance_);
308-
return true;
305+
if (strcmp(key, "XF86Exit") == 0 && !is_down) {
306+
return false;
307+
}
308+
309+
if (strcmp(key, "XF86Back") == 0 && !is_down) {
310+
if (ewk_view_back_possible(webview_instance_)) {
311+
ewk_view_back(webview_instance_);
312+
return true;
313+
} else {
314+
return false;
315+
}
309316
}
310317

311318
if (is_down) {

0 commit comments

Comments
 (0)