pull/1391/head
gedoor 3 years ago
parent d46d35d085
commit 7b8b3a1753
  1. 7
      app/src/main/java/io/legado/app/help/http/HttpHelper.kt

@ -3,11 +3,11 @@ package io.legado.app.help.http
import io.legado.app.help.AppConfig import io.legado.app.help.AppConfig
import io.legado.app.help.http.cronet.CronetInterceptor import io.legado.app.help.http.cronet.CronetInterceptor
import io.legado.app.help.http.cronet.CronetLoader import io.legado.app.help.http.cronet.CronetLoader
import io.legado.app.help.http.cronet.cronetEngine
import okhttp3.ConnectionSpec import okhttp3.ConnectionSpec
import okhttp3.Credentials import okhttp3.Credentials
import okhttp3.Interceptor import okhttp3.Interceptor
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import timber.log.Timber
import java.net.InetSocketAddress import java.net.InetSocketAddress
import java.net.Proxy import java.net.Proxy
import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ConcurrentHashMap
@ -45,11 +45,8 @@ val okHttpClient: OkHttpClient by lazy {
chain.proceed(request) chain.proceed(request)
}) })
if (AppConfig.isCronet && CronetLoader.install()) { if (AppConfig.isCronet && CronetLoader.install()) {
try { cronetEngine?.let {
//提供CookieJar 用于同步Cookie
builder.addInterceptor(CronetInterceptor(null)) builder.addInterceptor(CronetInterceptor(null))
} catch (e: Exception) {
Timber.e(e, "初始化Cronet失败")
} }
} }
builder.build() builder.build()

Loading…
Cancel
Save