From ea9748867025eb29bee639d79bdc08d40a8d192c Mon Sep 17 00:00:00 2001 From: arkon Date: Thu, 30 Sep 2021 17:52:07 -0400 Subject: [PATCH] Revert parseAs inline function change Some people sometimes get compile issues? --- .../eu/kanade/tachiyomi/network/OkHttpExtensions.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/network/OkHttpExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/network/OkHttpExtensions.kt index d78a0ee3c..71865f0ea 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/network/OkHttpExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/network/OkHttpExtensions.kt @@ -14,7 +14,7 @@ import rx.Observable import rx.Producer import rx.Subscription import uy.kohesive.injekt.Injekt -import uy.kohesive.injekt.api.get +import uy.kohesive.injekt.api.fullType import java.io.IOException import java.util.concurrent.atomic.AtomicBoolean import kotlin.coroutines.resumeWithException @@ -116,6 +116,10 @@ fun OkHttpClient.newCallWithProgress(request: Request, listener: ProgressListene } inline fun Response.parseAs(): T { - val responseBody = this.body?.string().orEmpty() - return Injekt.get().decodeFromString(responseBody) + // Avoiding Injekt.get() due to compiler issues + val json = Injekt.getInstance(fullType().type) + this.use { + val responseBody = it.body?.string().orEmpty() + return json.decodeFromString(responseBody) + } }