Fix: onPageStarted url param is String? in GV 147
Browse files
app/src/main/java/dev/nova/browser/TabManager.kt
CHANGED
|
@@ -106,7 +106,8 @@ class TabManager(private val runtime: GeckoRuntime, private val context: Context
|
|
| 106 |
}
|
| 107 |
}
|
| 108 |
session.progressDelegate = object : GeckoSession.ProgressDelegate {
|
| 109 |
-
|
|
|
|
| 110 |
loadingStates[tabId] = true
|
| 111 |
progressStates[tabId] = 0
|
| 112 |
}
|
|
@@ -197,9 +198,7 @@ class TabManager(private val runtime: GeckoRuntime, private val context: Context
|
|
| 197 |
|
| 198 |
private fun persistHistory() {
|
| 199 |
try {
|
| 200 |
-
|
| 201 |
-
history.forEach { arr.put(it) }
|
| 202 |
-
File(context.filesDir, "history.json").writeText(arr.toString())
|
| 203 |
} catch (e: Exception) {
|
| 204 |
Log.w("Nova", "persistHistory failed", e)
|
| 205 |
}
|
|
@@ -207,9 +206,8 @@ class TabManager(private val runtime: GeckoRuntime, private val context: Context
|
|
| 207 |
|
| 208 |
private fun loadHistory() {
|
| 209 |
try {
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
val arr = JSONArray(f.readText())
|
| 213 |
history.clear()
|
| 214 |
for (i in 0 until arr.length()) {
|
| 215 |
val url = arr.optString(i)
|
|
|
|
| 106 |
}
|
| 107 |
}
|
| 108 |
session.progressDelegate = object : GeckoSession.ProgressDelegate {
|
| 109 |
+
// GV 147 signature: url is nullable here.
|
| 110 |
+
override fun onPageStarted(session: GeckoSession, url: String?) {
|
| 111 |
loadingStates[tabId] = true
|
| 112 |
progressStates[tabId] = 0
|
| 113 |
}
|
|
|
|
| 198 |
|
| 199 |
private fun persistHistory() {
|
| 200 |
try {
|
| 201 |
+
historyFile.writeText(JSONArray().apply { history.forEach { put(it) } }.toString())
|
|
|
|
|
|
|
| 202 |
} catch (e: Exception) {
|
| 203 |
Log.w("Nova", "persistHistory failed", e)
|
| 204 |
}
|
|
|
|
| 206 |
|
| 207 |
private fun loadHistory() {
|
| 208 |
try {
|
| 209 |
+
if (!historyFile.exists()) return
|
| 210 |
+
val arr = JSONArray(historyFile.readText())
|
|
|
|
| 211 |
history.clear()
|
| 212 |
for (i in 0 until arr.length()) {
|
| 213 |
val url = arr.optString(i)
|