Created
November 8, 2019 18:05
-
-
Save wangerekaharun/b49d88729433bb1800bff641caac17f8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val retrofit = module(override = true) { | |
| single { | |
| val interceptor = HttpLoggingInterceptor() | |
| if (BuildConfig.DEBUG) { | |
| interceptor.apply { interceptor.level = HttpLoggingInterceptor.Level.BODY } | |
| } else { | |
| interceptor.apply { interceptor.level = HttpLoggingInterceptor.Level.NONE } | |
| } | |
| val client = OkHttpClient.Builder() | |
| .addInterceptor(interceptor).build() | |
| Retrofit.Builder() | |
| .baseUrl(Utils.BASE_URL) | |
| .addConverterFactory(GsonConverterFactory.create()) | |
| .client(client) | |
| .build() | |
| } | |
| } | |
| val authClient = module { | |
| single { | |
| val interceptor = HttpLoggingInterceptor() | |
| if (BuildConfig.DEBUG) { | |
| interceptor.apply { interceptor.level = HttpLoggingInterceptor.Level.BODY } | |
| } else { | |
| interceptor.apply { interceptor.level = HttpLoggingInterceptor.Level.NONE } | |
| } | |
| OkHttpClient.Builder().addInterceptor(AuthInterceptor()).addInterceptor(interceptor).build() | |
| } | |
| } | |
| val authRetrofit = module { | |
| single { | |
| Retrofit.Builder() | |
| .baseUrl(Utils.BASE_URL) | |
| .client(get()) | |
| .addConverterFactory(GsonConverterFactory.create()) | |
| .build() | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Noted. Thanks for pointing this out