mirror of
https://github.com/null2264/yokai.git
synced 2025-06-20 18:24:42 +00:00
refactor(webview): Replace WebView with its Compose counterpart
Co-authored-by: null2264 <palembani@gmail.com>
This commit is contained in:
parent
a199ff326d
commit
5e84586ff5
15 changed files with 687 additions and 328 deletions
|
@ -7,6 +7,8 @@ import android.webkit.CookieManager
|
|||
import android.webkit.WebSettings
|
||||
import android.webkit.WebView
|
||||
import co.touchlab.kermit.Logger
|
||||
import kotlin.coroutines.resume
|
||||
import kotlinx.coroutines.suspendCancellableCoroutine
|
||||
|
||||
object WebViewUtil {
|
||||
const val MINIMUM_WEBVIEW_VERSION = 114
|
||||
|
@ -65,3 +67,7 @@ private fun WebView.getDefaultUserAgentString(): String {
|
|||
|
||||
return defaultUserAgentString
|
||||
}
|
||||
|
||||
suspend fun WebView.getHtml(): String = suspendCancellableCoroutine {
|
||||
evaluateJavascript("document.documentElement.outerHTML") { html -> it.resume(html) }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue