Fix a bug which caused a song collection to not display in HomeScreen
This commit is contained in:
parent
a56e7181f1
commit
b4e9715592
1 changed files with 6 additions and 1 deletions
|
@ -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()
|
||||||
|
|
Loading…
Reference in a new issue