fix: loadDataWithBaseURL→loadUrl file:// 直接加载缓存HTML
This commit is contained in:
Binary file not shown.
@@ -1,2 +1,2 @@
|
|||||||
#Tue Jul 21 15:13:59 CST 2026
|
#Tue Jul 21 19:20:43 CST 2026
|
||||||
gradle.version=8.13
|
gradle.version=8.13
|
||||||
|
|||||||
Binary file not shown.
@@ -25,9 +25,8 @@ class MainActivity : AppCompatActivity() {
|
|||||||
addJavascriptInterface(Bridge(this@MainActivity), "Android")
|
addJavascriptInterface(Bridge(this@MainActivity), "Android")
|
||||||
|
|
||||||
if (cacheFile.exists()) {
|
if (cacheFile.exists()) {
|
||||||
val html = cacheFile.readText()
|
loadUrl("file://" + cacheFile.absolutePath)
|
||||||
loadDataWithBaseURL("https://gca.local/", html, "text/html", "UTF-8", null)
|
Log.i(TAG, "Loaded cached hot-update HTML (${cacheFile.length()}B)")
|
||||||
Log.i(TAG, "Loaded cached hot-update HTML (${html.length}B)")
|
|
||||||
} else {
|
} else {
|
||||||
loadUrl("file:///android_asset/index.html")
|
loadUrl("file:///android_asset/index.html")
|
||||||
Log.i(TAG, "Loaded embedded index.html")
|
Log.i(TAG, "Loaded embedded index.html")
|
||||||
|
|||||||
Reference in New Issue
Block a user