Skip to content

Commit

Permalink
Disable HttpLoggingInterceptor for release builds
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandr7035 committed Jul 21, 2023
1 parent 38915ed commit b05a384
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions app/src/main/java/by/alexandr7035/affinidi_id/di/DataModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import by.alexandr7035.data.helpers.vc_mapping.CredentialSubjectCasterImpl
import by.alexandr7035.data.helpers.vc_mapping.SignedCredentialToDomainMapper
import by.alexandr7035.data.helpers.vc_mapping.SignedCredentialToDomainMapperImpl
import by.alexandr7035.data.repository.*
import com.cioccarellia.ksprefs.BuildConfig
import com.cioccarellia.ksprefs.KsPrefs
import com.cioccarellia.ksprefs.config.EncryptionType
import com.cioccarellia.ksprefs.config.model.AutoSavePolicy
Expand All @@ -50,10 +51,20 @@ object DataModule {
@Provides
@Singleton
fun provideHttpClient(): OkHttpClient {
return OkHttpClient.Builder().addInterceptor(AuthInterceptor()).addInterceptor(ErrorInterceptor())
.addInterceptor(NullBodyHandlerInterceptor()).addInterceptor(HttpLoggingInterceptor().apply {

val builder = OkHttpClient.Builder()
.addInterceptor(AuthInterceptor())
.addInterceptor(ErrorInterceptor())
.addInterceptor(NullBodyHandlerInterceptor())
.retryOnConnectionFailure(false)

if (BuildConfig.DEBUG) {
builder.addInterceptor(HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.BODY
}).retryOnConnectionFailure(false).build()
})
}

return builder.build()
}

@Provides
Expand Down

0 comments on commit b05a384

Please sign in to comment.