airbnb / mavericks

Mavericks: Android on Autopilot
https://airbnb.io/mavericks/
Apache License 2.0
5.85k stars 499 forks source link

How to inject SavedStateHandle with hilt? #660

Open Kilnn opened 2 years ago

Kilnn commented 2 years ago
class AuthCodeViewModel @AssistedInject constructor(
    @Assisted initState: AuthCodeState,
    savedStateHandle: SavedStateHandle
) : MavericksViewModel<AuthCodeState>(initState) {

    @AssistedFactory
    interface Factory : AssistedViewModelFactory<AuthCodeViewModel, AuthCodeState> {
        override fun create(state: AuthCodeState): AuthCodeViewModel
    }

    companion object : MavericksViewModelFactory<AuthCodeViewModel, AuthCodeState> by hiltMavericksViewModelFactory()
}

It is not working!