소스 검색

Revert parseAs inline function change

Some people sometimes get compile issues?
arkon 3 년 전
부모
커밋
ea97488670
1개의 변경된 파일7개의 추가작업 그리고 3개의 파일을 삭제
  1. 7 3
      app/src/main/java/eu/kanade/tachiyomi/network/OkHttpExtensions.kt

+ 7 - 3
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 <reified T> Response.parseAs(): T {
-    val responseBody = this.body?.string().orEmpty()
-    return Injekt.get<Json>().decodeFromString(responseBody)
+    // Avoiding Injekt.get<Json>() due to compiler issues
+    val json = Injekt.getInstance<Json>(fullType<Json>().type)
+    this.use {
+        val responseBody = it.body?.string().orEmpty()
+        return json.decodeFromString(responseBody)
+    }
 }