From dd5222749638e9174e0454beba6601fbee78b80f Mon Sep 17 00:00:00 2001 From: Mariotaku Date: Wed, 22 May 2024 12:14:24 +0900 Subject: [PATCH 1/2] fix(android): moved currentUrl assignment to onPageStarted --- src/android/kotlin/RustWebViewClient.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/kotlin/RustWebViewClient.kt b/src/android/kotlin/RustWebViewClient.kt index 2dae181d9..3b69dcab7 100644 --- a/src/android/kotlin/RustWebViewClient.kt +++ b/src/android/kotlin/RustWebViewClient.kt @@ -39,6 +39,7 @@ class RustWebViewClient(context: Context): WebViewClient() { } override fun onPageStarted(view: WebView, url: String, favicon: Bitmap?) { + currentUrl = url if (interceptedState[url] == false) { val webView = view as RustWebView for (script in webView.initScripts) { @@ -49,7 +50,6 @@ class RustWebViewClient(context: Context): WebViewClient() { } override fun onPageFinished(view: WebView, url: String) { - currentUrl = url return onPageLoaded(url) } From 9adb67df4188046388c9629b4731fcd38a5d4b4c Mon Sep 17 00:00:00 2001 From: Amr Bashir Date: Wed, 22 May 2024 19:21:21 +0300 Subject: [PATCH 2/2] change file --- .changes/currentUrl.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/currentUrl.md diff --git a/.changes/currentUrl.md b/.changes/currentUrl.md new file mode 100644 index 000000000..13557bc99 --- /dev/null +++ b/.changes/currentUrl.md @@ -0,0 +1,5 @@ +--- +"wry": patch +--- + +On Android, set `RustWebViewClient.currentUrl` field early in `onPageStarted` method instead of `onPageFinished`