@@ -10,6 +10,7 @@ import com.squareup.moshi.Moshi
1010import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
1111import dagger.Module
1212import dagger.Provides
13+ import ink.trmnl.android.BuildConfig
1314import ink.trmnl.android.network.TrmnlApiService
1415import okhttp3.Cache
1516import okhttp3.OkHttpClient
@@ -30,11 +31,6 @@ object NetworkModule {
3031 fun provideOkHttpClient (
3132 @ApplicationContext context : Context ,
3233 ): OkHttpClient {
33- val loggingInterceptor =
34- HttpLoggingInterceptor ().apply {
35- level = HttpLoggingInterceptor .Level .BODY
36- }
37-
3834 // Create cache directory
3935 val cacheDir = File (context.cacheDir, " http_cache" )
4036 val cache = Cache (cacheDir, CACHE_SIZE )
@@ -59,8 +55,16 @@ object NetworkModule {
5955 .header(" User-Agent" , userAgent)
6056 .build()
6157 chain.proceed(request)
62- }.addInterceptor(loggingInterceptor)
63- .cache(cache)
58+ }.apply {
59+ // Only add logging interceptor in debug builds
60+ if (BuildConfig .DEBUG ) {
61+ addInterceptor(
62+ HttpLoggingInterceptor ().apply {
63+ level = HttpLoggingInterceptor .Level .BODY
64+ },
65+ )
66+ }
67+ }.cache(cache)
6468 .connectTimeout(30 , TimeUnit .SECONDS )
6569 .readTimeout(30 , TimeUnit .SECONDS )
6670 .writeTimeout(30 , TimeUnit .SECONDS )
0 commit comments