PlayerAndroid/app/src/main/java/code/name/monkey/retromusic/MainModule.kt

51 lines
1.5 KiB
Kotlin
Raw Normal View History

2020-07-20 19:05:48 +00:00
package code.name.monkey.retromusic
import code.name.monkey.retromusic.activities.albums.AlbumDetailsViewModel
import code.name.monkey.retromusic.activities.artists.ArtistDetailsViewModel
import code.name.monkey.retromusic.activities.genre.GenreDetailsViewModel
import code.name.monkey.retromusic.activities.playlist.PlaylistDetailsViewModel
import code.name.monkey.retromusic.activities.search.SearchViewModel
import code.name.monkey.retromusic.fragments.LibraryViewModel
import code.name.monkey.retromusic.model.Genre
import code.name.monkey.retromusic.model.Playlist
import code.name.monkey.retromusic.network.networkModule
import code.name.monkey.retromusic.providers.RepositoryImpl
import org.eclipse.egit.github.core.Repository
import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.dsl.bind
2020-07-20 19:05:48 +00:00
import org.koin.dsl.module
private val dataModule = module {
single {
RepositoryImpl(get(), get())
} bind Repository::class
}
2020-07-20 19:05:48 +00:00
private val viewModules = module {
2020-07-20 19:05:48 +00:00
viewModel {
LibraryViewModel(get())
}
viewModel { (albumId: Int) ->
AlbumDetailsViewModel(get(), albumId)
}
viewModel { (artistId: Int) ->
ArtistDetailsViewModel(get(), artistId)
}
viewModel { (playlist: Playlist) ->
PlaylistDetailsViewModel(get(), playlist)
}
viewModel { (genre: Genre) ->
GenreDetailsViewModel(get(), genre)
}
viewModel {
SearchViewModel(get())
}
}
val appModules = listOf(dataModule, viewModules, networkModule)