From bae3c7f5df52a2e52d5b1a871636ee54b56b5ac8 Mon Sep 17 00:00:00 2001 From: gedoor Date: Mon, 29 Nov 2021 15:03:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/help/http/HttpHelper.kt | 3 +-- .../main/java/io/legado/app/help/http/cronet/CronetLoader.kt | 2 +- .../main/java/io/legado/app/ui/config/OtherConfigFragment.kt | 3 +++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/http/HttpHelper.kt b/app/src/main/java/io/legado/app/help/http/HttpHelper.kt index 3e5ac9fa7..ffdb66f9b 100644 --- a/app/src/main/java/io/legado/app/help/http/HttpHelper.kt +++ b/app/src/main/java/io/legado/app/help/http/HttpHelper.kt @@ -3,7 +3,6 @@ package io.legado.app.help.http import io.legado.app.help.AppConfig import io.legado.app.help.http.cronet.CronetInterceptor import io.legado.app.help.http.cronet.CronetLoader -import io.legado.app.help.http.cronet.cronetEngine import okhttp3.ConnectionSpec import okhttp3.Credentials import okhttp3.Interceptor @@ -44,7 +43,7 @@ val okHttpClient: OkHttpClient by lazy { .build() chain.proceed(request) }) - if (AppConfig.isCronet && CronetLoader.install() && cronetEngine != null) { + if (AppConfig.isCronet && CronetLoader.install() && !AppConfig.isGooglePlay) { builder.addInterceptor(CronetInterceptor(null)) } builder.build() diff --git a/app/src/main/java/io/legado/app/help/http/cronet/CronetLoader.kt b/app/src/main/java/io/legado/app/help/http/cronet/CronetLoader.kt index 2e926d10d..e077166e0 100644 --- a/app/src/main/java/io/legado/app/help/http/cronet/CronetLoader.kt +++ b/app/src/main/java/io/legado/app/help/http/cronet/CronetLoader.kt @@ -261,7 +261,7 @@ object CronetLoader : CronetEngine.Builder.LibraryLoader() { downloadTempFile: File, destSuccessFile: File ) { - if (download) { + if (download || AppConfig.isGooglePlay) { return } download = true diff --git a/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt index 5322e8967..b4b4d4ceb 100644 --- a/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt @@ -37,6 +37,9 @@ class OtherConfigFragment : BasePreferenceFragment(), override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { putPrefBoolean(PreferKey.processText, isProcessTextEnabled()) addPreferencesFromResource(R.xml.pref_config_other) + if (AppConfig.isGooglePlay) { + preferenceScreen.removePreferenceRecursively("Cronet") + } upPreferenceSummary(PreferKey.userAgent, AppConfig.userAgent) upPreferenceSummary(PreferKey.preDownloadNum, AppConfig.preDownloadNum.toString()) upPreferenceSummary(PreferKey.threadCount, AppConfig.threadCount.toString())