diff --git a/app/src/main/java/io/legado/app/help/http/cronet/CronetHelper.kt b/app/src/main/java/io/legado/app/help/http/cronet/CronetHelper.kt index b4a8d7720..ab4353049 100644 --- a/app/src/main/java/io/legado/app/help/http/cronet/CronetHelper.kt +++ b/app/src/main/java/io/legado/app/help/http/cronet/CronetHelper.kt @@ -27,19 +27,16 @@ val cronetEngine: ExperimentalCronetEngine by lazy { val builder = ExperimentalCronetEngine.Builder(appCtx).apply { - if (!AppConfig.isGooglePlay) { + if (!AppConfig.isGooglePlay&&CronetLoader.install()) { setLibraryLoader(CronetLoader)//设置自定义so库加载 } setStoragePath(appCtx.externalCacheDir?.absolutePath)//设置缓存路径 - enableHttpCache(HTTP_CACHE_DISK, (1024 * 1024 * 50))//设置缓存模式 + enableHttpCache(HTTP_CACHE_DISK, (1024 * 1024 * 50).toLong())//设置缓存模式 enableQuic(true)//设置支持http/3 enableHttp2(true) //设置支持http/2 enablePublicKeyPinningBypassForLocalTrustAnchors(true) - //enableNetworkQualityEstimator(true) - //Brotli压缩 - enableBrotli(true) - //setExperimentalOptions("{\"quic_version\": \"h3-29\"}") + enableBrotli(true)//Brotli压缩 } val engine = builder.build() Log.d("Cronet", "Cronet Version:" + engine.versionString) diff --git a/app/src/main/java/io/legado/app/help/http/cronet/CronetInterceptor.kt b/app/src/main/java/io/legado/app/help/http/cronet/CronetInterceptor.kt index e55cd9c06..ccd63d415 100644 --- a/app/src/main/java/io/legado/app/help/http/cronet/CronetInterceptor.kt +++ b/app/src/main/java/io/legado/app/help/http/cronet/CronetInterceptor.kt @@ -45,7 +45,7 @@ class CronetInterceptor(private val cookieJar: CookieJar?) : Interceptor { val callback = CronetUrlRequestCallback(request, call) val urlRequest = buildRequest(request, callback) urlRequest.start() - return callback.waitForDone(urlRequest) + return callback.waitForDone(urlRequest) } private fun getCookie(url: HttpUrl): String {