-
Notifications
You must be signed in to change notification settings - Fork 0
[FEAT/#410] Chucker 기능 추가했어요. #418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,15 @@ | ||
| package com.spoony.spoony.core.network | ||
|
|
||
| import android.content.Context | ||
| import com.chuckerteam.chucker.api.ChuckerInterceptor | ||
| import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory | ||
| import com.spoony.spoony.BuildConfig.BASE_URL | ||
| import com.spoony.spoony.core.network.qualifier.Auth | ||
| import com.spoony.spoony.core.network.qualifier.CoilClient | ||
| import dagger.Module | ||
| import dagger.Provides | ||
| import dagger.hilt.InstallIn | ||
| import dagger.hilt.android.qualifiers.ApplicationContext | ||
| import dagger.hilt.components.SingletonComponent | ||
| import javax.inject.Singleton | ||
| import kotlinx.serialization.json.Json | ||
|
|
@@ -79,34 +82,44 @@ object RetrofitModule { | |
| @Singleton | ||
| fun provideTokenAuthenticator(authenticator: TokenAuthenticator): Authenticator = authenticator | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| fun provideChuckerInterceptor(@ApplicationContext context: Context): ChuckerInterceptor = ChuckerInterceptor.Builder(context).build() | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| fun provideClient( | ||
| loggingInterceptor: HttpLoggingInterceptor, | ||
| authInterceptor: Interceptor, | ||
| tokenAuthenticator: TokenAuthenticator | ||
| tokenAuthenticator: TokenAuthenticator, | ||
| chuckerInterceptor: ChuckerInterceptor | ||
| ) = OkHttpClient.Builder() | ||
| .addInterceptor(loggingInterceptor) | ||
| .addInterceptor(authInterceptor) | ||
| .addInterceptor(chuckerInterceptor) | ||
| .authenticator(tokenAuthenticator) | ||
| .build() | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| @Auth | ||
| fun provideAuthClient( | ||
| loggingInterceptor: HttpLoggingInterceptor | ||
| loggingInterceptor: HttpLoggingInterceptor, | ||
| chuckerInterceptor: ChuckerInterceptor | ||
| ) = OkHttpClient.Builder() | ||
| .addInterceptor(loggingInterceptor) | ||
| .addInterceptor(chuckerInterceptor) | ||
| .build() | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| @CoilClient | ||
| fun provideCoilClient( | ||
| loggingInterceptor: HttpLoggingInterceptor | ||
| loggingInterceptor: HttpLoggingInterceptor, | ||
| chuckerInterceptor: ChuckerInterceptor | ||
|
Comment on lines
+118
to
+119
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CoilClient도 로깅을 찍을까요 말까요? @Hyobeen-Park @Roel4990
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 음 일단 다 넣어두긴 했는데 뺼까요.>?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 넣어도 크게 문제될것같진않습니다. |
||
| ) = OkHttpClient.Builder() | ||
| .addInterceptor(loggingInterceptor) | ||
| .addInterceptor(chuckerInterceptor) | ||
| .build() | ||
|
|
||
| @Provides | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게 해야 하는구만...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게해야 확실한것같더라구요