-
Notifications
You must be signed in to change notification settings - Fork 1
origin/JetpackCompose #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: new_main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| package com.example.playlistmaker.di | ||
|
|
||
| import com.example.playlistmaker.media.domain.interactor.PlaylistInteractor | ||
| import com.example.playlistmaker.media.ui.MediaLibraryViewModel | ||
| import com.example.playlistmaker.media.ui.PlaylistUi | ||
| import com.example.playlistmaker.player.domain.interactor.FavoritesInteractor | ||
| import com.example.playlistmaker.search.domain.model.Track | ||
| import kotlinx.coroutines.flow.first | ||
| import org.koin.androidx.viewmodel.dsl.viewModel | ||
| import org.koin.core.qualifier.named | ||
| import org.koin.dsl.module | ||
|
|
||
| val mediaLibraryComposeModule = module { | ||
|
|
||
| single<suspend () -> List<Track>>(named("getFavoritesOnce")) { | ||
| suspend { get<FavoritesInteractor>().observeFavorites().first() } | ||
| } | ||
|
Comment on lines
+15
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Лучше это в юзкейс вынести, а не создавать как лямбду, так как это бизнес логика |
||
|
|
||
| single<suspend () -> List<PlaylistUi>>(named("getPlaylistsOnce")) { | ||
| suspend { | ||
| get<PlaylistInteractor>().observeAll().first().map { p -> | ||
| PlaylistUi( | ||
| id = p.id, | ||
| title = p.name, | ||
| trackCount = p.trackCount, | ||
| coverUrl = p.coverPath | ||
| ) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| viewModel { | ||
| MediaLibraryViewModel( | ||
| getFavoritesOnce = get(named("getFavoritesOnce")), | ||
| getPlaylistsOnce = get(named("getPlaylistsOnce")), | ||
| ) | ||
| } | ||
| } | ||
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Все новые зависимости стоит делать через version catalog механизм - файл
libs.versions.toml, чтобы все внешние зависимости проекта находились в одном месте - так удобнее будет с ними работать, а также все модули проекта будут зависеть от одних и тех же версий сторонних зависимостей. В Android Studio можно это сделать автоматически - нужно поставить каретку на зависимость, нажать Alt + Enter (cmd + Enter на маке) и выбрать соответствующий пункт, чтобы автоматически мигрировать зависимость на versions catalog