|
1 | 1 | package com.ninecraft.booket.core.network.di |
2 | 2 |
|
| 3 | +import android.content.Context |
3 | 4 | import android.util.Log |
| 5 | +import com.chuckerteam.chucker.api.ChuckerInterceptor |
| 6 | +import com.ninecraft.booket.core.di.ApplicationContext |
4 | 7 | import com.ninecraft.booket.core.di.DataScope |
5 | 8 | import com.ninecraft.booket.core.network.BuildConfig |
6 | 9 | import com.ninecraft.booket.core.network.TokenAuthenticator |
@@ -83,18 +86,27 @@ interface NetworkGraph { |
83 | 86 | return interceptor |
84 | 87 | } |
85 | 88 |
|
| 89 | + @Provides |
| 90 | + fun provideChuckerInterceptor( |
| 91 | + @ApplicationContext context: Context, |
| 92 | + ): ChuckerInterceptor { |
| 93 | + return ChuckerInterceptor(context) |
| 94 | + } |
| 95 | + |
86 | 96 | @Provides |
87 | 97 | fun provideOkHttpClient( |
88 | 98 | httpLoggingInterceptor: HttpLoggingInterceptor, |
89 | 99 | tokenInterceptor: TokenInterceptor, |
90 | 100 | tokenAuthenticator: TokenAuthenticator, |
| 101 | + chuckerInterceptor: ChuckerInterceptor, |
91 | 102 | ): OkHttpClient { |
92 | 103 | return OkHttpClient.Builder() |
93 | 104 | .connectTimeout(MaxTimeoutMillis, TimeUnit.MILLISECONDS) |
94 | 105 | .readTimeout(MaxTimeoutMillis, TimeUnit.MILLISECONDS) |
95 | 106 | .writeTimeout(MaxTimeoutMillis, TimeUnit.MILLISECONDS) |
96 | 107 | .addInterceptor(tokenInterceptor) |
97 | 108 | .authenticator(tokenAuthenticator) |
| 109 | + .addInterceptor(chuckerInterceptor) |
98 | 110 | .addInterceptor(httpLoggingInterceptor) |
99 | 111 | .build() |
100 | 112 | } |
|
0 commit comments