Reorder parameters of JSON parsing method (#8321)
(cherry picked from commit 073e9f94ff06a538c4aa06aa3db0ac1a6cf5be5b) # Conflicts: # core/src/main/java/eu/kanade/tachiyomi/network/OkHttpExtensions.kt
This commit is contained in:
parent
4e3af63a8e
commit
d8b27a4f43
@ -122,12 +122,12 @@ fun OkHttpClient.newCachelessCallWithProgress(request: Request, listener: Progre
|
||||
}
|
||||
|
||||
inline fun <reified T> Response.parseAs(/* SY --> */json: Json = Injekt.get()/* SY <-- */): T {
|
||||
return internalParseAs(this, typeOf<T>(), /* SY --> */ json /* SY <-- */)
|
||||
return internalParseAs(typeOf<T>(), this, /* SY --> */ json /* SY <-- */)
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@OptIn(ExperimentalSerializationApi::class)
|
||||
fun <T> internalParseAs(response: Response, type: KType, /* SY --> */ json: Json /* SY <-- */): T {
|
||||
fun <T> internalParseAs(type: KType, response: Response, /* SY --> */ json: Json /* SY <-- */): T {
|
||||
val deserializer = serializer(type) as KSerializer<T>
|
||||
return response.body.source().use {
|
||||
json.decodeFromBufferedSource(deserializer, it)
|
||||
|
Loading…
x
Reference in New Issue
Block a user