From 8ff6fbb153fe68b980574d8a7e05c5183587c3b8 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 18 Jun 2019 17:46:52 +0200 Subject: [PATCH] Handle redirection --- .../main/java/im/vector/riotredesign/core/utils/Dialogs.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/riotredesign/core/utils/Dialogs.kt b/vector/src/main/java/im/vector/riotredesign/core/utils/Dialogs.kt index 6aa636600f..2bd880a3b9 100644 --- a/vector/src/main/java/im/vector/riotredesign/core/utils/Dialogs.kt +++ b/vector/src/main/java/im/vector/riotredesign/core/utils/Dialogs.kt @@ -20,6 +20,7 @@ package im.vector.riotredesign.core.utils import android.content.Context import android.webkit.WebView +import android.webkit.WebViewClient import androidx.appcompat.app.AlertDialog /** @@ -29,9 +30,13 @@ import androidx.appcompat.app.AlertDialog */ fun Context.displayInWebView(url: String) { val wv = WebView(this) + + // Set a WebViewClient to ensure redirection is handled directly in the WebView + wv.webViewClient = WebViewClient() + wv.loadUrl(url) AlertDialog.Builder(this) .setView(wv) .setPositiveButton(android.R.string.ok, null) .show() -} \ No newline at end of file +}