Turn Add to Next Up into a toggle in the reader (issue #160)#175
Merged
Conversation
The reader's top-bar button only ever added the on-screen episode to the Next Up queue; there was no way to see or undo that from the reader itself. ReaderViewModel now exposes queuedItemIds, a StateFlow derived from QueueRepository.observeQueue(), so the icon reflects the current page's queued state live as the user swipes the pager and updates immediately if the queue changes elsewhere (e.g. the queue screen). Tapping the icon now adds when not queued and removes (via the new removeFromQueue) when already queued, swapping the icon and content description accordingly.
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.
Summary
ReaderViewModelexposes a newqueuedItemIds: StateFlow<Set<String>>derived fromQueueRepository.observeQueue(), kept reactive across pager swipes and external queue changes; a newremoveFromQueue(itemId)removes an episode.ReaderScreenswaps betweenPlaylistAdd/PlaylistAddCheckicons andcd_add_to_queue/cd_remove_from_next_upcontent descriptions based on the current page's queued state.cd_remove_from_next_upadded tovalues/values-de/values-es/values-fr/values-it.Closes #160
Test plan
./gradlew assembleDebug testDebugUnitTest lintDebug— clean except one known-flaky failure per run (ArticleListViewModelTest / QueueViewModelTest, matching the Investigate CI-only hang in SettingsViewModelTest #54/Investigate CI-only failure in ArticleListViewModelTest.defaultToAllArticleViewSetting_showsAllByDefault #60 "Dispatchers.Main used concurrently" pattern), confirmed unrelated by re-running the affected class alone and seeing it pass.ReaderViewModelTestcases:queuedItemIdsreflectsaddToQueue, andremoveFromQueueactually removes the item (verified via the reactive flow before the direct repository check, to avoid a DB-commit race).