pull/1463/head^2
gedoor 3 years ago
parent 5c42cc0c77
commit bae3c7f5df
  1. 3
      app/src/main/java/io/legado/app/help/http/HttpHelper.kt
  2. 2
      app/src/main/java/io/legado/app/help/http/cronet/CronetLoader.kt
  3. 3
      app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt

@ -3,7 +3,6 @@ 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
@ -44,7 +43,7 @@ val okHttpClient: OkHttpClient by lazy {
.build() .build()
chain.proceed(request) chain.proceed(request)
}) })
if (AppConfig.isCronet && CronetLoader.install() && cronetEngine != null) { if (AppConfig.isCronet && CronetLoader.install() && !AppConfig.isGooglePlay) {
builder.addInterceptor(CronetInterceptor(null)) builder.addInterceptor(CronetInterceptor(null))
} }
builder.build() builder.build()

@ -261,7 +261,7 @@ object CronetLoader : CronetEngine.Builder.LibraryLoader() {
downloadTempFile: File, downloadTempFile: File,
destSuccessFile: File destSuccessFile: File
) { ) {
if (download) { if (download || AppConfig.isGooglePlay) {
return return
} }
download = true download = true

@ -37,6 +37,9 @@ class OtherConfigFragment : BasePreferenceFragment(),
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
putPrefBoolean(PreferKey.processText, isProcessTextEnabled()) putPrefBoolean(PreferKey.processText, isProcessTextEnabled())
addPreferencesFromResource(R.xml.pref_config_other) addPreferencesFromResource(R.xml.pref_config_other)
if (AppConfig.isGooglePlay) {
preferenceScreen.removePreferenceRecursively("Cronet")
}
upPreferenceSummary(PreferKey.userAgent, AppConfig.userAgent) upPreferenceSummary(PreferKey.userAgent, AppConfig.userAgent)
upPreferenceSummary(PreferKey.preDownloadNum, AppConfig.preDownloadNum.toString()) upPreferenceSummary(PreferKey.preDownloadNum, AppConfig.preDownloadNum.toString())
upPreferenceSummary(PreferKey.threadCount, AppConfig.threadCount.toString()) upPreferenceSummary(PreferKey.threadCount, AppConfig.threadCount.toString())

Loading…
Cancel
Save