fix compatibility with old android releases

This commit is contained in:
Fabian Freund
2026-06-21 04:26:27 +02:00
parent 947beca065
commit 2060275c0e
2 changed files with 3 additions and 3 deletions
@@ -489,7 +489,7 @@ class GeckoAddonsApiImpl(private val context: Context) : GeckoAddonsApi {
}
val responseBody = response.body.useStream { stream ->
String(stream.readAllBytes(), Charsets.UTF_8)
String(stream.readBytes(), Charsets.UTF_8)
}
val json = JSONObject(responseBody)
val currentVersion = json.optJSONObject("current_version") ?: return null
@@ -564,7 +564,7 @@ class GeckoAddonsApiImpl(private val context: Context) : GeckoAddonsApi {
}
val body = response.body.useStream { stream ->
String(stream.readAllBytes(), Charsets.UTF_8)
String(stream.readBytes(), Charsets.UTF_8)
}
val json = JSONObject(body)
val results = json.optJSONArray("results") ?: return emptyList()
@@ -83,7 +83,7 @@ class GeckoFetchApiImpl : GeckoFetchApi {
GeckoFetchResponse(
url = response.url,
status = response.status.toLong(),
body = response.body.useStream { stream -> stream.readAllBytes() },
body = response.body.useStream { stream -> stream.readBytes() },
headers = response.headers.map { it -> GeckoHeader(it.name, it.value) }
)))
}