Updated on 2026-08-14
This commit is contained in:
parent
e029da2b32
commit
a31c66d60f
10 changed files with 328 additions and 266 deletions
|
|
@ -41,7 +41,9 @@ interface NetworkComponent {
|
|||
@get:Named(Server.ApiDucatus.URL_DUCATUS)
|
||||
val retrofitDucatus: Retrofit
|
||||
|
||||
@get:Named(Server.ApiBlockchair.URL_BLOCKCHAIR)
|
||||
val retrofitBlockchair: Retrofit
|
||||
|
||||
@get:Named("socket")
|
||||
val socket: Socket
|
||||
|
||||
}
|
||||
|
|
@ -147,6 +147,19 @@ internal class NetworkModule {
|
|||
return builder.build()
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
@Named(Server.ApiBlockchair.URL_BLOCKCHAIR)
|
||||
fun provideRetrofitBlockchair(): Retrofit {
|
||||
val builder = Retrofit.Builder()
|
||||
.baseUrl(Server.ApiBlockchair.URL_BLOCKCHAIR)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
if (BuildConfig.DEBUG)
|
||||
builder.client(createOkHttpClient())
|
||||
return builder.build()
|
||||
}
|
||||
|
||||
private fun createOkHttpClient(): OkHttpClient {
|
||||
return OkHttpClient.Builder().addInterceptor(createHttpLoggingInterceptor()).build()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue