mirror of
https://github.com/Drop-OSS/wry-cef.git
synced 2026-01-30 20:55:24 +01:00
feat(android): add flag to opt out of automatic back navigation (#1622)
needed by https://github.com/tauri-apps/tauri/pull/14133 see https://github.com/tauri-apps/tauri/pull/14133#issuecomment-3361224695
This commit is contained in:
committed by
GitHub
parent
48e5e9903f
commit
093856a2a5
5
.changes/android-go-back-opt-out.md
Normal file
5
.changes/android-go-back-opt-out.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"wry": patch
|
||||
---
|
||||
|
||||
Add flag to opt out of automatic back navigation handling on Android via `WryActivity#handleBackNavigation`.
|
||||
@@ -14,6 +14,7 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
|
||||
abstract class WryActivity : AppCompatActivity() {
|
||||
private lateinit var mWebView: RustWebView
|
||||
open val handleBackNavigation: Boolean = true
|
||||
|
||||
open fun onWebViewCreate(webView: WebView) { }
|
||||
|
||||
@@ -102,7 +103,7 @@ abstract class WryActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && mWebView.canGoBack()) {
|
||||
if (handleBackNavigation && keyCode == KeyEvent.KEYCODE_BACK && mWebView.canGoBack()) {
|
||||
mWebView.goBack()
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user