Skip to content

Commit 8ff624e

Browse files
committed
add pure network module in release
1 parent b8e3e68 commit 8ff624e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

data/src/release/java/com/dkin/chevit/data/di/NetworkModule.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import okhttp3.MediaType.Companion.toMediaType
1818
import okhttp3.OkHttpClient
1919
import retrofit2.Converter
2020
import retrofit2.Retrofit
21+
import javax.inject.Named
2122

2223
@Module
2324
@InstallIn(SingletonComponent::class)
@@ -61,6 +62,15 @@ internal object NetworkModule {
6162
.addInterceptor(tokenInterceptor)
6263
.build()
6364

65+
@Provides
66+
@Singleton
67+
@Named("Pure")
68+
fun providePureOkHttpClient() = OkHttpClient.Builder()
69+
.connectTimeout(20, TimeUnit.SECONDS)
70+
.readTimeout(20, TimeUnit.SECONDS)
71+
.writeTimeout(20, TimeUnit.SECONDS)
72+
.build()
73+
6474
@Provides
6575
@Singleton
6676
fun provideRetrofit(
@@ -71,4 +81,16 @@ internal object NetworkModule {
7181
.addConverterFactory(jsonConverter)
7282
.baseUrl(BuildConfig.API_URL)
7383
.build()
84+
85+
@Provides
86+
@Singleton
87+
@Named("Pure")
88+
fun providePureRetrofit(
89+
@Named("Pure") okHttpClient: OkHttpClient,
90+
@JsonConverter jsonConverter: Converter.Factory,
91+
): Retrofit = Retrofit.Builder()
92+
.client(okHttpClient)
93+
.addConverterFactory(jsonConverter)
94+
.baseUrl(BuildConfig.API_URL)
95+
.build()
7496
}

0 commit comments

Comments
 (0)