An idea from @swankjesse.
Part 1
If we have an assisted class like so
@Inject
class LoginScreen(
apiService: ApiService, // injected
@Assisted token: UserToken
) {
@AssistedFactory
interface Factory {
fun create(token: UserToken): LoginScreen
}
}
It should be possible expose a function of the same matching parameter + return type signature on the dependency graph
@DependencyGraph
interface AppGraph {
fun createLoginScreen(token: String): LoginScreen
}
Part 2
We could also combine this with @GraphExtensions. These are factories of their own, so we could ostensibly reduce further. For example if a LoginScreen only exists in the extension, we could chain those assisted parameters all the way down
@DependencyGraph
interface AppGraph {
fun createLoginScreen(token: UserToken): LoginScreen
fun createLoggedInGraph(token: UserToken): LoggedInGraph
}
@GraphExtension
interface LoggedInGraph {
fun createLoginScreen(token: UserToken): LoginScreen
}
An idea from @swankjesse.
Part 1
If we have an assisted class like so
It should be possible expose a function of the same matching parameter + return type signature on the dependency graph
Part 2
We could also combine this with
@GraphExtensions. These are factories of their own, so we could ostensibly reduce further. For example if a LoginScreen only exists in the extension, we could chain those assisted parameters all the way down