mirror of
https://github.com/gedoor/legado.git
synced 2024-07-19 01:17:25 +08:00
优化
This commit is contained in:
parent
4dea547895
commit
dc7486a8b1
@ -22,7 +22,6 @@ abstract class AbsCallBack(
|
||||
val mCall: Call,
|
||||
private val eventListener: EventListener? = null,
|
||||
private val responseCallback: Callback? = null
|
||||
|
||||
) : UrlRequest.Callback(), AutoCloseable {
|
||||
|
||||
val buffer = Buffer()
|
||||
|
@ -10,6 +10,7 @@ import java.nio.ByteBuffer
|
||||
|
||||
@Keep
|
||||
class BodyUploadProvider(private val body: RequestBody) : UploadDataProvider(), AutoCloseable {
|
||||
|
||||
private val buffer = Buffer()
|
||||
|
||||
init {
|
||||
|
@ -17,6 +17,7 @@ import kotlin.coroutines.resumeWithException
|
||||
@Keep
|
||||
@Suppress("unused")
|
||||
class CronetCoroutineInterceptor : Interceptor {
|
||||
|
||||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
if (chain.call().isCanceled()) {
|
||||
throw IOException("Canceled")
|
||||
|
@ -11,6 +11,7 @@ import java.io.IOException
|
||||
@Keep
|
||||
@Suppress("unused")
|
||||
class CronetInterceptor : Interceptor {
|
||||
|
||||
@Throws(IOException::class)
|
||||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
if (chain.call().isCanceled()) {
|
||||
|
@ -14,8 +14,8 @@ import java.util.concurrent.TimeUnit
|
||||
@Keep
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
class NewCallBack(originalRequest: Request, mCall: Call) : AbsCallBack(originalRequest, mCall) {
|
||||
private val responseFuture = CompletableFuture<Response>()
|
||||
|
||||
private val responseFuture = CompletableFuture<Response>()
|
||||
|
||||
@Throws(IOException::class)
|
||||
override fun waitForDone(urlRequest: UrlRequest): Response {
|
||||
|
Loading…
Reference in New Issue
Block a user