Sinan Gunes
02/15/2021, 12:43 PM@Assistedwasyl
02/15/2021, 12:44 PMSinan Gunes
02/15/2021, 12:47 PMAssistedFactorywasyl
02/15/2021, 12:49 PMSinan Gunes
02/15/2021, 12:51 PMSinan Gunes
02/15/2021, 12:52 PMclass ChatRepositoryImpl @AssistedInject constructor(@Assisted("baseUrl") baseUrl: String)
    : ChatRepository by buildRetrofit(baseUrl).create(ChatRepository::class.java) {
}
@AssistedFactory
interface ChatRepoFactory {
    @Singleton
    fun create(@Assisted("baseUrl") baseUrl: String): ChatRepositoryImpl
}wasyl
02/15/2021, 12:53 PM@Singletonclass ChatRepositoryImpl@InjectSinan Gunes
02/15/2021, 12:54 PM@SingletonChatRepositoryImplAssisted Injection cannot be scopedwasyl
02/15/2021, 12:56 PMwasyl
02/15/2021, 12:57 PMval instance1 = factory.create(baseUrl = "foo")
val instance2 = factory.create(baseUrl = "bar")Sinan Gunes
02/15/2021, 12:58 PMSinan Gunes
02/15/2021, 12:59 PMwasyl
02/15/2021, 1:04 PMI would expect to return different instances.If you want to return the same instances for the same `baseUrl`s then you just need to do that manually, Dagger won’t do that for you. So you’d need a
@SingletonChatRepoFactorySinan Gunes
02/15/2021, 1:09 PM