mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 11:38:51 +01:00
Use constructor injection for ViewModels
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package feature.compose
|
||||
|
||||
import android.arch.lifecycle.ViewModel
|
||||
import android.content.Intent
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.multibindings.IntoMap
|
||||
import injection.ViewModelKey
|
||||
|
||||
@Module
|
||||
class ComposeActivityModule {
|
||||
|
||||
@Provides
|
||||
fun provideIntent(activity: ComposeActivity): Intent = activity.intent
|
||||
|
||||
@Provides
|
||||
@IntoMap
|
||||
@ViewModelKey(ComposeViewModel::class)
|
||||
fun provideComposeViewModel(viewModel: ComposeViewModel): ViewModel = viewModel
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user