Skip to content

Commit

Permalink
fix: incorrect albums songs sort (#409
Browse files Browse the repository at this point in the history
  • Loading branch information
zyrouge committed Jan 11, 2024
1 parent cf3efad commit fc971c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ class SettingsManager(private val symphony: Symphony) {
val lastUsedPlaylistSongsSortReverse = _lastUsedPlaylistSongsSortReverse.asStateFlow()
private val _lastUsedAlbumSongsSortBy = MutableStateFlow(getLastUsedAlbumSongsSortBy())
val lastUsedAlbumSongsSortBy = _lastUsedAlbumSongsSortBy.asStateFlow()
private val _lastUsedAlbumSongsSortReverse = MutableStateFlow(getLastUsedAlbumsSortReverse())
private val _lastUsedAlbumSongsSortReverse =
MutableStateFlow(getLastUsedAlbumSongsSortReverse())
val lastUsedAlbumSongsSortReverse = _lastUsedAlbumSongsSortReverse.asStateFlow()
private val _lastUsedTreePathSortBy = MutableStateFlow(getLastUsedTreePathSortBy())
val lastUsedTreePathSortBy = _lastUsedTreePathSortBy.asStateFlow()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,10 @@ fun SongListType.getLastUsedSortBy(context: ViewContext) = when (this) {
SongListType.Playlist -> context.symphony.settings.lastUsedPlaylistSongsSortBy
}

fun SongListType.setLastUsedSortBy(context: ViewContext, sort: SongSortBy) {
when (this) {
SongListType.Default -> context.symphony.settings.setLastUsedSongsSortBy(sort)
SongListType.Playlist -> context.symphony.settings.setLastUsedPlaylistSongsSortBy(sort)
SongListType.Album -> context.symphony.settings.setLastUsedAlbumSongsSortBy(sort)
}
fun SongListType.setLastUsedSortBy(context: ViewContext, sort: SongSortBy) = when (this) {
SongListType.Default -> context.symphony.settings.setLastUsedSongsSortBy(sort)
SongListType.Playlist -> context.symphony.settings.setLastUsedPlaylistSongsSortBy(sort)
SongListType.Album -> context.symphony.settings.setLastUsedAlbumSongsSortBy(sort)
}

fun SongListType.getLastUsedSortReverse(context: ViewContext) = when (this) {
Expand All @@ -160,13 +158,8 @@ fun SongListType.getLastUsedSortReverse(context: ViewContext) = when (this) {
SongListType.Album -> context.symphony.settings.lastUsedAlbumSongsSortReverse
}

fun SongListType.setLastUsedSortReverse(context: ViewContext, reverse: Boolean) {
when (this) {
SongListType.Default -> context.symphony.settings.setLastUsedSongsSortReverse(reverse)
SongListType.Playlist -> context.symphony.settings.setLastUsedPlaylistSongsSortReverse(
reverse
)

SongListType.Album -> context.symphony.settings.setLastUsedAlbumSongsSortReverse(reverse)
}
fun SongListType.setLastUsedSortReverse(context: ViewContext, reverse: Boolean) = when (this) {
SongListType.Default -> context.symphony.settings.setLastUsedSongsSortReverse(reverse)
SongListType.Playlist -> context.symphony.settings.setLastUsedPlaylistSongsSortReverse(reverse)
SongListType.Album -> context.symphony.settings.setLastUsedAlbumSongsSortReverse(reverse)
}

0 comments on commit fc971c5

Please sign in to comment.