Revert DataStore migration

This commit is contained in:
vfsfitvnm
2022-06-10 21:03:21 +02:00
parent 3d91e23733
commit 4d79747a5d
8 changed files with 136 additions and 148 deletions

View File

@@ -80,11 +80,7 @@ fun HomeScreen(
val preferences = LocalPreferences.current
val songCollection by remember(preferences.isReady, preferences.homePageSongCollection) {
if (!preferences.isReady) {
return@remember flowOf(emptyList())
}
val songCollection by remember(preferences.homePageSongCollection) {
when (preferences.homePageSongCollection) {
SongCollection.MostPlayed -> Database.mostPlayed()
SongCollection.Favorites -> Database.favorites()
@@ -311,21 +307,19 @@ fun HomeScreen(
val songCollections = enumValues<SongCollection>()
val nextSongCollection = songCollections[(preferences.homePageSongCollection.ordinal + 1) % songCollections.size]
BasicText(
text = when (nextSongCollection) {
SongCollection.MostPlayed -> "Most played"
SongCollection.Favorites -> "Favorites"
SongCollection.History -> "History"
},
style = typography.xxs.secondary.bold,
modifier = Modifier
.clickable(
indication = rememberRipple(bounded = true),
interactionSource = remember { MutableInteractionSource() }
) {
preferences.onHomePageSongCollectionChange(
nextSongCollection
)
BasicText(
text = when (nextSongCollection) {
SongCollection.MostPlayed -> "Most played"
SongCollection.Favorites -> "Favorites"
SongCollection.History -> "History"
},
style = typography.xxs.secondary.bold,
modifier = Modifier
.clickable(
indication = rememberRipple(bounded = true),
interactionSource = remember { MutableInteractionSource() },
onClick = {
preferences.homePageSongCollection = nextSongCollection
}
// .alignByBaseline()
.padding(horizontal = 16.dp)

View File

@@ -80,13 +80,17 @@ fun AppearanceScreen() {
EnumValueSelectorEntry(
title = "Theme mode",
selectedValue = preferences.colorPaletteMode,
onValueSelected = preferences.onColorPaletteModeChange
onValueSelected = {
preferences.colorPaletteMode = it
}
)
EnumValueSelectorEntry(
title = "Thumbnail roundness",
selectedValue = preferences.thumbnailRoundness,
onValueSelected = preferences.onThumbnailRoundnessChange
onValueSelected = {
preferences.thumbnailRoundness = it
}
)
}
}