Skip to content

Replace ServiceLocator by DI#1

Open
Aluminiy wants to merge 1 commit intoOtus-Android:masterfrom
Aluminiy:master
Open

Replace ServiceLocator by DI#1
Aluminiy wants to merge 1 commit intoOtus-Android:masterfrom
Aluminiy:master

Conversation

@Aluminiy
Copy link
Copy Markdown

No description provided.

fun create(@BindsInstance context: Context): AppComponent
}

override fun consumeProductsUseCase(): ConsumeProductsUseCase
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

эти override не нужны

val appComponent = (context.applicationContext as ProductsApplication).appComponent
val viewModel: FavoritesViewModel = viewModel(
factory = FavoritesViewModelFactory()
factory = appComponent.favoritesComponent().create().viewModelFactory()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

создание компонента лучше вынести из @Composable функции, например, в навигацию в composable и тут уже получать готовую вьюмодель

аналогично в другом экране

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants