Skip to content

Add shared events and active request tooling - #10

Merged
victorycodedev merged 7 commits into
mainfrom
feature/fetch-polish-phases
Oct 23, 2026
Merged

victorycodedev merged 7 commits into
mainfrom
feature/fetch-polish-phases

Conversation

@victorycodedev

Copy link
Copy Markdown
Owner

What changed?

  • Added opt-in shared terminal events so a request can notify whichever NativePHP screen is active when it finishes.
  • Added active-request inspection with Fetch::active(), Fetch::isActive(), and Fetch::cancelAll().
  • Added typed live request snapshots covering state, attempt, transferred bytes, total bytes, progress, and next retry time.
  • Added FetchActiveRequestsChanged so activity and transfer screens can refresh from lifecycle changes without polling.
  • Corrected Android active upload/download progress snapshot updates for parity with iOS.
  • Hardened Android and iOS retry state, terminal cleanup, temporary upload cleanup, and callback synchronization.
  • Preserved all existing request APIs, bridge names, event classes, event payloads, retry behavior, cancellation behavior, and NativePHP #[On(...)] behavior.
  • Added and expanded regression, contract, reliability, JavaScript, and documentation coverage.
  • Added a user-facing What's New page for the upcoming 1.2.0 release and expanded the API reference.
  • Fixed CI dependency checks.

Why?

These changes make long-running requests easier to observe and control across navigation. Applications can now build transfer or activity screens, react to active-request changes without polling, and deliver an opt-in terminal result to the currently active screen.

The native reliability work prevents stale progress and retry state from leaking between attempts and ensures terminal operations release their native state consistently.

How was it tested?

Automated checks completed locally:

  • composer validate --strict
  • composer test
    • 157 tests
    • 788 assertions
  • composer analyse
  • composer format:check
  • npm test --prefix resources/js
    • 19 JavaScript tests
  • npm run syntax --prefix resources/js
  • npm run format:check --prefix resources/js
  • npm audit --prefix resources/js --audit-level=high
  • npm audit --prefix docs --audit-level=high
    • 0 vulnerabilities
  • npm run docs:build --prefix docs
  • Swift source syntax parsing
  • nativephp.json JSON validation
  • git diff --check

The shared-event flow, active-request snapshots, retry state, and Android/iOS progress behavior were also exercised in generated NativePHP applications and simulators/emulators during the phased implementation.

Platforms tested

  • PHP
  • JavaScript
  • Android
  • iOS
  • Not applicable / documentation only

Breaking changes?

None.

Existing applications can update without changing their current request code or event listeners. The existing PHP and JavaScript APIs, native bridge contracts, event names and payloads, retries, cancellation, downloads, progress events, global lifecycle delivery, and NativeComponent #[On(...)] behavior remain compatible. New shared events and active-request APIs are opt-in.

Checklist

  • Tests were added or updated where appropriate.
  • Existing relevant tests pass.
  • Documentation was updated where necessary.
  • Public API and event/bridge compatibility were considered.
  • Android/iOS behavior parity was considered where relevant.
  • No unnecessary native dependencies were introduced.
  • No secrets, tokens, temporary logging, or debugging code were committed.
  • Native changes were tested in a generated NativePHP application where practical.

@victorycodedev
victorycodedev merged commit 6300ceb into main Oct 23, 2026
12 checks passed
@victorycodedev
victorycodedev deleted the feature/fetch-polish-phases branch October 23, 2026 14:28
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.

1 participant