Skip to content

Conversation

@WcaleNieWolny
Copy link

@WcaleNieWolny WcaleNieWolny commented Jan 16, 2026

Summary

  • Fixed parameter passing for pause, resume, stop, checkStatus, and getFileInfo methods
  • Updated example app to use the corrected API

Problem

Capacitor requires method parameters to be passed as objects with named properties. The native side uses call.getString("id") which looks for a property named "id" inside an object.

Before (broken):

CapacitorDownloader.stop("my-id")  // Native receives bare string, call.getString("id") returns null

After (works):

CapacitorDownloader.stop({ id: "my-id" })  // Native receives object, call.getString("id") works

Changes

Method Before After
pause pause(id: string) pause(options: { id: string })
resume resume(id: string) resume(options: { id: string })
stop stop(id: string) stop(options: { id: string })
checkStatus checkStatus(id: string) checkStatus(options: { id: string })
getFileInfo getFileInfo(path: string) getFileInfo(options: { path: string })

Breaking Change

This is a breaking change for users calling these methods with bare strings. They will need to update to the object syntax.

Summary by CodeRabbit

  • Documentation

    • API documentation, README, and code examples updated to reflect the new standardized method parameter structures across all plugin methods.
  • Refactor

    • Plugin API methods refactored to accept options objects instead of direct parameters. This standardization applies to all task control and file information retrieval operations, requiring users to update existing method calls accordingly.

✏️ Tip: You can customize this high-level summary in your review settings.

Capacitor requires method parameters to be passed as objects with named
properties, not bare strings. The native side uses call.getString("id")
which expects an object like { id: "value" }.

Changed methods:
- pause(id) -> pause({ id })
- resume(id) -> resume({ id })
- stop(id) -> stop({ id })
- checkStatus(id) -> checkStatus({ id })
- getFileInfo(path) -> getFileInfo({ path })

Also updated example app to use the new API.
@coderabbitai
Copy link

coderabbitai bot commented Jan 16, 2026

📝 Walkthrough

Walkthrough

This PR standardizes the CapacitorDownloaderPlugin API by refactoring five methods (pause, resume, stop, checkStatus, getFileInfo) to accept options objects containing the required parameter instead of direct string arguments. Changes are applied consistently across TypeScript definitions, implementation, documentation, and example code.

Changes

Cohort / File(s) Summary
API Definitions & Documentation
README.md, src/definitions.ts
Updated method signatures for pause, resume, stop, checkStatus, and getFileInfo to accept options objects (e.g., { id: string } or { path: string }) instead of primitive parameters. Parameter documentation sections updated correspondingly.
Web Implementation
src/web.ts
Refactored five methods to extract parameters from options object (e.g., options.id, options.path) in method bodies while maintaining existing error handling and behavior.
Example Application
example-app/src/main.js
Updated all API method calls to use new options object syntax for consistency with refactored signatures.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 From strings to objects, neat and tidy,
Five methods now speak in options so nifty,
Consistency flows through definitions and code,
Example paths guide us down this refactored road,
Structured parameters make the API more true!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly describes the main change: refactoring method signatures to pass parameters as objects to the native layer.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 514ad1d and 3b5fef0.

📒 Files selected for processing (4)
  • README.md
  • example-app/src/main.js
  • src/definitions.ts
  • src/web.ts
🧰 Additional context used
🧬 Code graph analysis (1)
src/web.ts (1)
src/definitions.ts (1)
  • DownloadTask (6-13)
🔇 Additional comments (4)
src/definitions.ts (1)

58-95: LGTM: options-object signatures + docs are consistent.
The updated JSDoc and method signatures align with the native call pattern and keep return types intact.

src/web.ts (1)

10-28: LGTM: web stub signatures now mirror the updated API.
Uses options.id/options.path consistently with the new contract.

example-app/src/main.js (1)

33-92: LGTM: example app updated to object-based calls.
All affected actions now pass { id } / { path } as required.

README.md (1)

80-156: Docs look consistent with the updated API.
Signatures and parameter tables match the new options-object shape.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants