Last active
January 2, 2019 15:03
-
-
Save raghunandankavi2010/ef947aeb7ecdd54b47657ff7b970fda1 to your computer and use it in GitHub Desktop.
koin
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
class class RetrofitDependency : RetrofitInterface { | |
override fun provideRetrofit(): Retrofit { | |
val logging = HttpLoggingInterceptor() | |
logging.level = HttpLoggingInterceptor.Level.BASIC | |
val okHttpClient = OkHttpClient.Builder() | |
.addInterceptor(logging) | |
.connectTimeout(10, TimeUnit.SECONDS) | |
.writeTimeout(10, TimeUnit.SECONDS) | |
.readTimeout(30, TimeUnit.SECONDS) | |
.build() | |
val moshi = Moshi.Builder() | |
.add(KotlinJsonAdapterFactory()) | |
.build() | |
return Retrofit.Builder() | |
.baseUrl(BuildConfig.BASE_URL) | |
.client(okHttpClient) | |
.addConverterFactory(MoshiConverterFactory.create(moshi)) | |
.build() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment