fix(downloads): persist failed downloads and offer retry - #6
Merged
Merged
Conversation
💯 Test Coverage
😎 Tests Results
👀 Tests Details • (52%)
|
ghostcoder42
force-pushed
the
fix/download-failure-retry
branch
from
September 3, 2026 05:54
7840e13 to
2a9f037
Compare
Downloads lived entirely in memory: a failure ended with a single Cancel action, and killing (or crashing) the app mid-transfer lost the task completely — nothing to retry from, and the partial file was swept away as an orphan on the next launch. Tasks are now persisted to MMKV from the moment they start, with the source URL, composite video id and quality captured when the transfer begins, and restored on app start in the Downloads tab: - failed downloads come back with their error message; - downloads interrupted by an app restart come back as 'Interrupted' with their stale progress cleared; both with a Retry button next to Cancel. Retry restarts the task in place and drops any partial file — interrupted transfers resume as fresh downloads, not byte-level resumes. It prefers the stored direct URL (which can outlive the video page) and, when the failure happened before a source was captured, re-scrapes the video page via the stored slug.
ghostcoder42
force-pushed
the
fix/download-failure-retry
branch
from
September 3, 2026 06:03
2a9f037 to
3e14556
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.
A failed download used to end with a single Cancel action and vanished on the next app start: the active-downloads store was memory-only, so there was nothing left to retry from — the download (and its partial file) was simply gone.
Failed tasks are now persisted to MMKV (with the source URL, composite video id and quality captured when the transfer starts) and restored on app start, so they reappear in the Downloads tab. Error rows get a Retry button next to Cancel: retry restarts the task in place, drops any partial file, and prefers the stored direct URL — falling back to re-scraping the video page via the stored slug when the failure happened before a source was captured.