feat: webview manager and js bridge skeleton

This commit is contained in:
2026-08-16 16:01:36 +08:00
parent a764208c0e
commit 394a553da7
5 changed files with 93 additions and 0 deletions
@@ -0,0 +1,25 @@
package top.yeij.hearth.webview
import android.util.Log
class JsBridge(
private val deviceWidthPx: Int,
private val deviceHeightPx: Int,
private val density: Float,
private val darkMode: Boolean,
) {
private val gson = com.google.gson.Gson()
@android.webkit.JavascriptInterface
fun getDeviceInfo(): String {
Log.d("HearthBridge", "getDeviceInfo called")
return gson.toJson(
mapOf(
"widthPx" to deviceWidthPx,
"heightPx" to deviceHeightPx,
"density" to density,
"darkMode" to darkMode
)
)
}
}