pull/1759/head
ag2s20150909 3 years ago
parent 36c4e9e685
commit 38929910f0
  1. 3
      app/src/main/java/io/legado/app/help/http/cronet/AbsCallBack.kt
  2. 8
      app/src/main/java/io/legado/app/help/http/cronet/CronetLoader.kt

@ -2,6 +2,7 @@ package io.legado.app.help.http.cronet
import io.legado.app.help.http.okHttpClient import io.legado.app.help.http.okHttpClient
import io.legado.app.utils.DebugLog import io.legado.app.utils.DebugLog
import io.legado.app.utils.rethrowAsIOException
import okhttp3.* import okhttp3.*
import okhttp3.EventListener import okhttp3.EventListener
import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.MediaType.Companion.toMediaTypeOrNull
@ -123,7 +124,7 @@ abstract class AbsCallBack(
//UrlResponseInfo可能为null //UrlResponseInfo可能为null
override fun onFailed(request: UrlRequest, info: UrlResponseInfo?, error: CronetException) { override fun onFailed(request: UrlRequest, info: UrlResponseInfo?, error: CronetException) {
DebugLog.i(javaClass.name, error.message.toString()) DebugLog.i(javaClass.name, error.message.toString())
mException = IOException(error.message, error) mException = error.rethrowAsIOException()
this.eventListener?.callFailed(mCall, error) this.eventListener?.callFailed(mCall, error)
responseCallback?.onFailure(mCall, error) responseCallback?.onFailure(mCall, error)
} }

@ -54,11 +54,13 @@ object CronetLoader : CronetEngine.Builder.LibraryLoader() {
/** /**
* 判断Cronet是否安装完成 * 判断Cronet是否安装完成
*/ */
@Synchronized
fun install(): Boolean { fun install(): Boolean {
if (cacheInstall) { synchronized(this) {
return true if (cacheInstall) {
return true
}
} }
if (AppConfig.isGooglePlay) { if (AppConfig.isGooglePlay) {
return false return false
} }

Loading…
Cancel
Save