Fix a bug which caused a song collection to not display in HomeScreen
This commit is contained in:
@@ -47,6 +47,7 @@ import it.vfsfitvnm.vimusic.ui.views.PlaylistPreviewItem
|
|||||||
import it.vfsfitvnm.vimusic.ui.views.SongItem
|
import it.vfsfitvnm.vimusic.ui.views.SongItem
|
||||||
import it.vfsfitvnm.vimusic.utils.*
|
import it.vfsfitvnm.vimusic.utils.*
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.flow.flowOf
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
@ExperimentalAnimationApi
|
@ExperimentalAnimationApi
|
||||||
@@ -75,7 +76,11 @@ fun HomeScreen(intentVideoId: String?) {
|
|||||||
|
|
||||||
val preferences = LocalPreferences.current
|
val preferences = LocalPreferences.current
|
||||||
|
|
||||||
val songCollection by remember(preferences.homePageSongCollection) {
|
val songCollection by remember(preferences.isReady, preferences.homePageSongCollection) {
|
||||||
|
if (!preferences.isReady) {
|
||||||
|
return@remember flowOf(emptyList())
|
||||||
|
}
|
||||||
|
|
||||||
when (preferences.homePageSongCollection) {
|
when (preferences.homePageSongCollection) {
|
||||||
SongCollection.MostPlayed -> Database.mostPlayed()
|
SongCollection.MostPlayed -> Database.mostPlayed()
|
||||||
SongCollection.Favorites -> Database.favorites()
|
SongCollection.Favorites -> Database.favorites()
|
||||||
|
|||||||
Reference in New Issue
Block a user