feat: parallel or sequential download mode#32
Merged
Conversation
Simultaneous downloads always ran in parallel up to the native concurrency limit. A new Download Mode setting chooses between parallel and one at a time; in sequential mode the download service holds newly enqueued books and starts the next only when the active one finishes or is cancelled, so a freed slot advances the held queue. Held books are surfaced to the UI: the library list marks them as Queued and refuses to re-select them, and the summary notification shows the queued count and titles. The in-app Cancel action now runs the same service-side cleanup as the notification Cancel — it clears the notification, drops the book from the active and pending queues, and advances the queue — instead of only cancelling the native task. Queued books can be removed from the queue from the library list.
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
Adds a Download Mode setting (parallel or one at a time), makes queued books visible in sequential mode, and gives the in-app Cancel action the same cleanup as the notification Cancel.
What changed
User impact
Users can choose one-at-a-time downloads; queued books are clearly marked and cannot be selected twice, and the notification lists what is still queued. Cancelling a running download from the library now also dismisses its notification and starts the next queued book, and a queued book can be removed before it starts.
Implementation notes
Sequential gating lives in the download service, composing with the native queue without changing the concurrency limit. Queued books are exposed through the same in-memory stage-progress store the library screen already polls, marked with a queued stage that is cleared when the book starts, is removed, or the queue drains. The in-app cancel path previously called nativeCancelDownload directly, bypassing the service; it now also sends a stop-monitoring signal so the service performs the notification and queue cleanup, unifying it with the notification Cancel path.
Validation
Automated validation:
npm run typecheckManual Android validation: