mirror of
https://github.com/readrops/Readrops.git
synced 2025-01-31 10:54:53 +01:00
Merge retrofit and retrofit services declarations in ApiModule
This commit is contained in:
parent
137e591573
commit
1533f67de8
@ -42,18 +42,14 @@ val apiModule = module {
|
||||
|
||||
factory { params -> FreshRSSDataSource(get(parameters = { params })) }
|
||||
|
||||
factory { params ->
|
||||
get<Retrofit>(named("freshrssRetrofit"), parameters = { params })
|
||||
.create(FreshRSSService::class.java)
|
||||
}
|
||||
|
||||
factory(named("freshrssRetrofit")) { (credentials: Credentials) ->
|
||||
factory { (credentials: Credentials) ->
|
||||
Retrofit.Builder()
|
||||
.baseUrl(credentials.url)
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
.client(get())
|
||||
.addConverterFactory(MoshiConverterFactory.create(get(named("freshrssMoshi"))))
|
||||
.build()
|
||||
.create(FreshRSSService::class.java)
|
||||
}
|
||||
|
||||
single(named("freshrssMoshi")) {
|
||||
@ -72,18 +68,14 @@ val apiModule = module {
|
||||
|
||||
factory { params -> NextNewsDataSource(get(parameters = { params })) }
|
||||
|
||||
factory { params ->
|
||||
get<Retrofit>(named("nextcloudNewsRetrofit"), parameters = { params })
|
||||
.create(NextNewsService::class.java)
|
||||
}
|
||||
|
||||
factory(named("nextcloudNewsRetrofit")) { (credentials: Credentials) ->
|
||||
factory { (credentials: Credentials) ->
|
||||
Retrofit.Builder()
|
||||
.baseUrl(credentials.url)
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
.client(get())
|
||||
.addConverterFactory(MoshiConverterFactory.create(get(named("nextcloudNewsMoshi"))))
|
||||
.build()
|
||||
.create(NextNewsService::class.java)
|
||||
}
|
||||
|
||||
single(named("nextcloudNewsMoshi")) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user