Fix styling of BlockingCall and Request
This commit is contained in:
parent
39c5ac1ff6
commit
13e00bd52a
|
|
@ -1,7 +1,5 @@
|
|||
package ru.touchin.network.blocking
|
||||
|
||||
import okhttp3.Request
|
||||
import okio.Timeout
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
|
@ -9,12 +7,7 @@ import ru.touchin.network.utils.getAnnotation
|
|||
|
||||
class BlockingCall(
|
||||
private val callDelegate: Call<Any>
|
||||
) : Call<Any> {
|
||||
override fun clone(): Call<Any> = callDelegate.clone()
|
||||
|
||||
override fun execute(): Response<Any> {
|
||||
return callDelegate.execute()
|
||||
}
|
||||
) : Call<Any> by callDelegate {
|
||||
|
||||
override fun enqueue(callback: Callback<Any>) {
|
||||
if (PendingRequestsManager.isPending.get()) {
|
||||
|
|
@ -40,15 +33,5 @@ class BlockingCall(
|
|||
})
|
||||
}
|
||||
|
||||
override fun isExecuted(): Boolean = callDelegate.isExecuted
|
||||
|
||||
override fun cancel() = callDelegate.cancel()
|
||||
|
||||
override fun isCanceled(): Boolean = callDelegate.isCanceled
|
||||
|
||||
override fun request(): Request = callDelegate.request()
|
||||
|
||||
override fun timeout(): Timeout = callDelegate.timeout()
|
||||
|
||||
private fun Call<Any>.isBlocking() = request().getAnnotation(BlockingRequest::class.java) != null
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,4 +3,5 @@ package ru.touchin.network.utils
|
|||
import okhttp3.Request
|
||||
import retrofit2.Invocation
|
||||
|
||||
fun <T: Annotation> Request.getAnnotation(annotation: Class<T>) = tag(Invocation::class.java)?.method()?.getAnnotation(annotation)
|
||||
fun <T: Annotation> Request.getAnnotation(annotation: Class<T>) =
|
||||
tag(Invocation::class.java)?.method()?.getAnnotation(annotation)
|
||||
|
|
|
|||
Loading…
Reference in New Issue