Commit 9e8e6209 authored by Marius Volkhart's avatar Marius Volkhart

Change OkHttpClient initialization in Dagger graph

Rather than using the Kotlin apply function, directly invoke the builder methods on the OkHttpClient.Builder instance. This produces noticeably better bytecode and the apply function does not add value in this case.
parent 32e8e70f
...@@ -111,12 +111,12 @@ class AppModule { ...@@ -111,12 +111,12 @@ class AppModule {
@Provides @Provides
@Singleton @Singleton
fun provideOkHttpClient(logger: HttpLoggingInterceptor): OkHttpClient { fun provideOkHttpClient(logger: HttpLoggingInterceptor): OkHttpClient {
return OkHttpClient.Builder().apply { return OkHttpClient.Builder()
addInterceptor(logger) .addInterceptor(logger)
connectTimeout(15, TimeUnit.SECONDS) .connectTimeout(15, TimeUnit.SECONDS)
readTimeout(20, TimeUnit.SECONDS) .readTimeout(20, TimeUnit.SECONDS)
writeTimeout(15, TimeUnit.SECONDS) .writeTimeout(15, TimeUnit.SECONDS)
}.build() .build()
} }
@Provides @Provides
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment