Handle redirection

This commit is contained in:
Benoit Marty 2019-06-18 17:46:52 +02:00
parent 9d3a8e7c40
commit 8ff6fbb153
1 changed files with 6 additions and 1 deletions

View File

@ -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()
}
}