feat: add genre filter for songs and albums - #1060
Draft
huynhsontung wants to merge 9 commits into
Draft
Conversation
Remember and restore the user's last selected sort order on SongsPage and AlbumsPage across app navigations and restarts. - Add PersistentSongsSortBy and PersistentAlbumsSortBy properties to ISettingsService and SettingsService. - Inject ISettingsService into SongsPageViewModel and AlbumsPageViewModel to initialize and persist sort order selections. - Synchronize visual state and flyout radio item check state in SongsPage and AlbumsPage on navigation. - Safely handle ApplicationLanguages.PrimaryLanguageOverride in MediaGroupingHelpers for unpackaged test environments. - Add unit tests in Screenbox.Core.Tests covering sort order initialization and persistence.
…nce persistence Replace string-based sort orders with strongly-typed SongSortOrder and AlbumSortOrder enums across settings, viewmodels, views, and unit tests.
…in SettingsService Retain 'Persistent...' naming convention for sort order properties in ISettingsService and SettingsService.
…scing workarounds Create DispatcherQueueTestHelper and global TestInitializer hook to enable DispatcherQueue and DispatcherQueueSynchronizationContext during test execution. Simplify SongsPageViewModel and AlbumsPageViewModel to use non-nullable DispatcherQueue and DispatcherQueueTimer directly.
…sPage and AlbumsPage
Use compiled {x:Bind IsSortBy(ViewModel.SortBy, ...)} on RadioMenuFlyoutItem.IsChecked to guarantee the active sort item is always selected when restoring from settings or navigating between pages.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…ewModel and AlbumsPageViewModel Add PumpEvents to DispatcherQueueTestHelper to process enqueued DispatcherQueue callbacks during tests. Update SongsPageViewModelTests and AlbumsPageViewModelTests to verify that Receive enqueues and executes FetchSongs/FetchAlbums by asserting that GroupedSongs and GroupedAlbums are populated with updated library data.
Remove Win32 message pump P/Invokes from DispatcherQueueTestHelper. Test vm.Receive directly and verify side-effects via vm.FetchSongs and vm.FetchAlbums.
huynhsontung
changed the base branch from
main
to
implement_persistent_sort_preference
August 20, 2026 05:13
huynhsontung
force-pushed
the
filter_music_by_genre
branch
from
August 20, 2026 07:26
e0e2dc5 to
9ca043d
Compare
Add dynamic genre filtering to songs and albums views. Genres are extracted from the user music library and exposed with 'All genres', 'Unknown genre', and library genres.
huynhsontung
force-pushed
the
filter_music_by_genre
branch
from
August 20, 2026 07:27
9ca043d to
455b62d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #698
Context
Users with large music collections need a way to filter songs and albums by genre directly in the library views. Unlike static sorting options, genres vary depending on the files present in the user's library and must be dynamically extracted.
Motivation
Providing a genre dropdown alongside the existing sort-by controls enables users to quickly narrow down their library views by specific music genres, view tracks with missing genre metadata ("Unknown genre"), or view all items ("All genres").
Impact & Changes
MusicLibrary: Added read-onlyGenresproperty to the immutable music library snapshot.LibraryService: AddedExtractGenresto automatically extract, deduplicate, and sort unique non-empty genre strings from library songs when buildingMusicLibrarysnapshots.SongsPageViewModel&AlbumsPageViewModel: AddedSelectedGenre,Genres, andSetGenreCommand. FilterSongsandGroupedSongs/GroupedAlbumsdynamically based on selected genre.GenreButtondropdown next toSortByButtoninSongsPage.xamlandAlbumsPage.xaml.RadioMenuFlyoutItemelements as soon as the genre list is available (during page navigation and library updates) to ensure instantaneous flyout opening.SelectedGenrestate across backward navigation.AllGenres,FilterByGenreAutomationName, and access keyCommandFilterByGenreKey.SongsPageViewModelTestsandAlbumsPageViewModelTests.