Skip to content

Register the device for push and act on what arrives - #785

Open
michaelst wants to merge 1 commit into
claude/push-notifications-transactions-bd9810from
claude/push-notifications-device-bd9810
Open

Register the device for push and act on what arrives#785
michaelst wants to merge 1 commit into
claude/push-notifications-transactions-bd9810from
claude/push-notifications-device-bd9810

Conversation

@michaelst

Copy link
Copy Markdown
Owner

Phase 2b, device half. Stacked on #784 - review that first.

What

  • ios/Runner/PushChannel.swift: UNUserNotificationCenter + didRegisterForRemoteNotificationsWithDeviceToken, registered with addApplicationLifeCycleDelegate rather than written onto the app delegate, so plugins keep receiving the same callbacks. No Firebase.
  • The device token is PATCHed onto the API token once there is a session to hang it off, and again whenever iOS reissues one.
  • A silent push invalidates transactions, the budget summary and banks - a sync that finished on the server lands on screen without a pull to refresh.
  • A tap opens the transactions tab.
  • Push Notifications capability (aps-environment) and the remote-notification background mode, without which iOS drops the silent push.

Shell change

The tab moved out of _ShellState into selected_tab.dart, because a tapped notification has to be able to move it. Kept in its own file so the Cupertino port can watch the same provider rather than inherit a shell edit.

Copy that was no longer true

POST /api/banks/:id/sync said "there is no completion signal - pull to refresh" in the API description, the controller doc and the snackbar. There is one now, so all three say what happens. That regenerates the spec and banks_api.dart.

Gates

dart run build_runner build, dart format --line-length 110, flutter analyze, flutter test (86 pass). Elixir gates still green.

Not verified here

Nothing iOS has been built or run: this machine has no CocoaPods and no simulator runtime, and push does not work on the simulator anyway - APNs issues no device token there. The Swift compiles only in CI's macOS job. Confirming it works means a real device, a .p8 on the server, and a Plaid sandbox purchase.

🤖 Generated with Claude Code

A small Swift channel rather than Firebase: `UNUserNotificationCenter` plus
`didRegisterForRemoteNotificationsWithDeviceToken`, registered as a Flutter application life cycle
delegate so plugins keep receiving the same callbacks.

- The device token is PATCHed onto the API token once there is a session to hang it off.
- A silent push invalidates the transactions, budget summary and banks providers, so a sync that
  finished on the server lands on screen without the user pulling to refresh.
- A tapped notification opens the transactions tab. The shell's tab moved into its own provider to
  make that possible, which keeps it out of whatever the Cupertino port does to the shell.

Needs the Push Notifications capability and the remote-notification background mode, both declared
here. The sync screen's "pull to refresh" copy is now false, so it says what actually happens.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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