fix compatibility with old android releases
This commit is contained in:
+2
-2
@@ -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()
|
||||
|
||||
+1
-1
@@ -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) }
|
||||
)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user