refactor(webview): Replace WebView with its Compose counterpart

Co-authored-by: null2264 <palembani@gmail.com>
This commit is contained in:
arkon 2024-11-26 22:01:37 +07:00 committed by Ahmad Ansori Palembani
parent a199ff326d
commit 5e84586ff5
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
15 changed files with 687 additions and 328 deletions

View file

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