Skip to content

feat(deps)!: migrate to @fivecar/react-native-background-downloader#51

Merged
fivecar merged 1 commit into
mainfrom
fivecar/upgrade-background-no-mmkv
Jul 8, 2026
Merged

feat(deps)!: migrate to @fivecar/react-native-background-downloader#51
fivecar merged 1 commit into
mainfrom
fivecar/upgrade-background-no-mmkv

Conversation

@fivecar

@fivecar fivecar commented Jul 8, 2026

Copy link
Copy Markdown
Owner

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 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.

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.
@fivecar fivecar merged commit 152a929 into main Jul 8, 2026
3 checks passed
@fivecar fivecar deleted the fivecar/upgrade-background-no-mmkv branch July 8, 2026 23:12
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 6.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/index.ts
Comment on lines +940 to +941
if (!this.active && task.state === "DOWNLOADING") {
await task.pause();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread src/index.ts
ensureDownloadsAreRunning,
} from "@kesha-antonov/react-native-background-downloader";
getExistingDownloadTasks,
} from "@fivecar/react-native-background-downloader";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread package.json
},
"peerDependencies": {
"@kesha-antonov/react-native-background-downloader": "^3.2.6",
"@fivecar/react-native-background-downloader": "^4.5.6",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant