From 7ac50280fdac8a44b49bf822fa8cd83a2a18dd26 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Mon, 6 May 2024 00:25:13 +0200 Subject: [PATCH] fix: http logging in debug builds not working due to cronet --- app/src/main/java/com/github/libretube/api/RetrofitInstance.kt | 3 ++- app/src/main/java/com/github/libretube/helpers/ImageHelper.kt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/libretube/api/RetrofitInstance.kt b/app/src/main/java/com/github/libretube/api/RetrofitInstance.kt index af17c68de..b1f232552 100644 --- a/app/src/main/java/com/github/libretube/api/RetrofitInstance.kt +++ b/app/src/main/java/com/github/libretube/api/RetrofitInstance.kt @@ -67,7 +67,6 @@ object RetrofitInstance { private fun buildClient(): OkHttpClient { val httpClient = OkHttpClient().newBuilder() - .addInterceptor(CronetInterceptor.newBuilder(CronetHelper.cronetEngine).build()) if (BuildConfig.DEBUG) { val loggingInterceptor = HttpLoggingInterceptor().apply { @@ -77,6 +76,8 @@ object RetrofitInstance { httpClient.addInterceptor(loggingInterceptor) } + httpClient.addInterceptor(CronetInterceptor.newBuilder(CronetHelper.cronetEngine).build()) + return httpClient.build() } } diff --git a/app/src/main/java/com/github/libretube/helpers/ImageHelper.kt b/app/src/main/java/com/github/libretube/helpers/ImageHelper.kt index 8c7e38b44..7103bd097 100644 --- a/app/src/main/java/com/github/libretube/helpers/ImageHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/ImageHelper.kt @@ -37,7 +37,6 @@ object ImageHelper { val maxCacheSize = PreferenceHelper.getString(PreferenceKeys.MAX_IMAGE_CACHE, "128") val httpClient = OkHttpClient().newBuilder() - .addInterceptor(CronetInterceptor.newBuilder(CronetHelper.cronetEngine).build()) if (BuildConfig.DEBUG) { val loggingInterceptor = HttpLoggingInterceptor().apply { @@ -47,6 +46,8 @@ object ImageHelper { httpClient.addInterceptor(loggingInterceptor) } + httpClient.addInterceptor(CronetInterceptor.newBuilder(CronetHelper.cronetEngine).build()) + imageLoader = ImageLoader.Builder(context) .callFactory(CronetHelper.callFactory) .crossfade(true)