feat(deps)!: migrate to @fivecar/react-native-background-downloader#51
Conversation
Replace @kesha-antonov/react-native-background-downloader with @fivecar/react-native-background-downloader (MMKV-free fork), and adapt to its new task API: - checkForExistingDownloads() -> getExistingDownloadTasks() - download() -> createDownloadTask() + explicit task.start() - ensureDownloadsAreRunning() removed; its old pause/resume workaround is gone along with it - task.pause()/resume()/stop() and completeHandler() are now genuinely async (they await the native bridge call instead of firing and forgetting), so internal call sites that have an ordering dependency on completion now await them instead of using `void` BREAKING CHANGE: DownloadQueue#terminate(), #pauseAll(), and #resumeAll() are now async and return Promise<void> instead of void, so that they can correctly await the underlying task stop/pause/resume calls, which are no longer fire-and-forget in the new downloader library. Callers must now await these methods (or otherwise handle the returned promise) instead of calling them synchronously. @fivecar/react-native-background-downloader is now a peerDependency (matching react-native-fs and @react-native-async-storage/async-storage), so consuming apps must install it directly. The separate @types/kesha-antonov__react-native-background-downloader dev dependency is no longer needed since the new package ships its own types.
|
🎉 This PR is included in version 6.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 013e6ac78a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!this.active && task.state === "DOWNLOADING") { | ||
| await task.pause(); |
There was a problem hiding this comment.
Resume revived paused tasks when active
When init() restores an unfinished task whose native state is PAUSED, the default active queue now only reattaches handlers and skips this inactive-queue pause branch, so the task remains paused indefinitely and the later spec loop also skips it because it appears in existingTasks. This regresses the advertised/default behavior that suspended downloads are resumed on launch unless the caller passed startActive: false; resume PAUSED revived tasks when this.active is true.
Useful? React with 👍 / 👎.
| ensureDownloadsAreRunning, | ||
| } from "@kesha-antonov/react-native-background-downloader"; | ||
| getExistingDownloadTasks, | ||
| } from "@fivecar/react-native-background-downloader"; |
There was a problem hiding this comment.
Update install docs for the new peer package
After this import change, apps must install @fivecar/react-native-background-downloader, but the README's install section still tells users to install @kesha-antonov/react-native-background-downloader. A consumer following the documented peer-dependency steps will not have the module this package imports, so bundling/typechecking fails with an unresolved @fivecar/... module.
Useful? React with 👍 / 👎.
| }, | ||
| "peerDependencies": { | ||
| "@kesha-antonov/react-native-background-downloader": "^3.2.6", | ||
| "@fivecar/react-native-background-downloader": "^4.5.6", |
There was a problem hiding this comment.
Handle unknown totals from the v4 downloader
The v4 downloader line introduces progress events where bytesTotal can be -1 when the server omits Content-Length, but addTask() still computes fraction as bytesDownloaded / bytesTotal before calling onProgress. For chunked or otherwise unknown-size downloads, consumers now receive negative progress values instead of an indeterminate/unknown progress signal, so the progress mapping needs to guard bytesTotal <= 0.
Useful? React with 👍 / 👎.
Replace @kesha-antonov/react-native-background-downloader with
@fivecar/react-native-background-downloader (MMKV-free fork), and adapt
to its new task API:
is gone along with it
async (they await the native bridge call instead of firing and
forgetting), so internal call sites that have an ordering dependency
on completion now await them instead of using
voidBREAKING CHANGE: DownloadQueue#terminate(), #pauseAll(), and
#resumeAll() are now async and return Promise instead of void,
so that they can correctly await the underlying task stop/pause/resume
calls, which are no longer fire-and-forget in the new downloader
library. Callers must now await these methods (or otherwise handle the
returned promise) instead of calling them synchronously.
@fivecar/react-native-background-downloader is now a peerDependency
(matching react-native-fs and @react-native-async-storage/async-storage),
so consuming apps must install it directly. The separate
@types/kesha-antonov__react-native-background-downloader dev dependency
is no longer needed since the new package ships its own types.