eygraber
02/22/2022, 6:11 AM@Inject
to a typealias?
My use case is where I have a type that I want to use in two different scopes:
class Foo
@AppScope
@Inject
typealias AppFoo = Foo
@ScreenScope
@Inject
typealias ScreenFoo = Foo
Currently I have to use provider functions, which is a lot more verbose, especially since I now need a component for those function:
@Component
abstract class FooComponent {
@AppScope @Provides fun provideAppFoo() = AppFoo()
@ScreenScope @Provides fun provideScreenFoo() = ScreenFoo()
}
(this example is contrived, but I do have an actual use case for something like this)evant
02/22/2022, 7:21 PMAppFoo()
and ScreenFoo()
.eygraber
02/22/2022, 7:53 PMclass Foo(val context: Context)
@AppScope
@Inject
typealias AppFoo = Foo
@ScreenScope
@Inject
typealias ScreenFoo = Foo