10/30/2018, 6:41 PM
I'm looking for feedback, is this an inneficient way to use inline functions? is there a better way to call my retrofit createWebService multiple times?
Copy code
single { PusherRepositoryAuthImpl(get()) as PusherRepository }
    single { createWebService<PusherDataSource>(get(), getProperty(DatasourceProperties.SERVER_URL)) }

    single { LoginRepositoryImpl(get()) as LoginRepository }
    single { createWebService<LoginDataSource>(get(), getProperty(DatasourceProperties.SERVER_URL)) }

    single { SignupRepositoryImpl(get()) as SignUpRepository }
    single { createWebService<SignupDataSource>(get(), getProperty(DatasourceProperties.SERVER_URL)) }
My web service
Copy code
inline fun <reified T> createWebService(okHttpClient: OkHttpClient, url: String): T {
    val retrofit = Retrofit.Builder()
    return retrofit.create(