mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-28 00:37:58 +03:00
Revert parseAs inline function change
Some people sometimes get compile issues?
This commit is contained in:
parent
c2255b0a0f
commit
ea97488670
1 changed files with 7 additions and 3 deletions
|
@ -14,7 +14,7 @@ import rx.Observable
|
||||||
import rx.Producer
|
import rx.Producer
|
||||||
import rx.Subscription
|
import rx.Subscription
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.fullType
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
import kotlin.coroutines.resumeWithException
|
import kotlin.coroutines.resumeWithException
|
||||||
|
@ -116,6 +116,10 @@ fun OkHttpClient.newCallWithProgress(request: Request, listener: ProgressListene
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun <reified T> Response.parseAs(): T {
|
inline fun <reified T> Response.parseAs(): T {
|
||||||
val responseBody = this.body?.string().orEmpty()
|
// Avoiding Injekt.get<Json>() due to compiler issues
|
||||||
return Injekt.get<Json>().decodeFromString(responseBody)
|
val json = Injekt.getInstance<Json>(fullType<Json>().type)
|
||||||
|
this.use {
|
||||||
|
val responseBody = it.body?.string().orEmpty()
|
||||||
|
return json.decodeFromString(responseBody)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue