Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ dependencies {

// Debug
debugImplementation(libs.bundles.debug)
debugImplementation(libs.chucker.library)

// Release
releaseImplementation(libs.chucker.library.no.op)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이렇게 해야 하는구만...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이렇게해야 확실한것같더라구요


// Androidx
implementation(libs.bundles.androidx)
Expand Down
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
Expand Down Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CoilClient도 로깅을 찍을까요 말까요? @Hyobeen-Park @Roel4990

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

음 일단 다 넣어두긴 했는데 뺼까요.>?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넣어도 크게 문제될것같진않습니다.

) = OkHttpClient.Builder()
.addInterceptor(loggingInterceptor)
.addInterceptor(chuckerInterceptor)
.build()

@Provides
Expand Down
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ firebaseBom = "34.3.0"
firebaseCrashlyticsPlugin = "3.0.6"

# Third Party
chucker = "4.0.0"
okhttp = "4.11.0"
retrofit = "2.9.0"
retrofitKotlinSerializationConverter = "1.0.0"
Expand Down Expand Up @@ -115,6 +116,8 @@ accompanist-pager-indicators = { module = "com.google.accompanist:accompanist-pa
accompanist-systemuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "accompanistSystemuicontroller" }

# Third Party
chucker-library = { group = "com.github.chuckerteam.chucker", name = "library", version.ref = "chucker" }
chucker-library-no-op = { group = "com.github.chuckerteam.chucker", name = "library-no-op", version.ref = "chucker" }
okhttp = { group = "com.squareup.okhttp3", name = "okhttp" }
okhttp-bom = { group = "com.squareup.okhttp3", name = "okhttp-bom", version.ref = "okhttp" }
okhttp-logging = { group = "com.squareup.okhttp3", name = "logging-interceptor", version.ref = "okhttp" }
Expand Down