Skip to content

feat: iOS push notifications (APNs via push gateway) (#4)#44

Merged
windoze95 merged 2 commits into
mainfrom
fix/flutter-push-notifications
Jun 28, 2026
Merged

feat: iOS push notifications (APNs via push gateway) (#4)#44
windoze95 merged 2 commits into
mainfrom
fix/flutter-push-notifications

Conversation

@windoze95

Copy link
Copy Markdown
Owner

New-episode push on iOS (roadmap LATER tier, #4), modeled on Cantinarr (native APNs via a platform channel — no Firebase). Consumes the backend's /api/push/register + gateway integration.

What

  • ios/Runner/AppDelegate.swift: UNUserNotificationCenter auth + registerForRemoteNotifications; a nullfeed/push method channel exposing requestPermissionAndToken / registerIfAuthorized / getInitialNotification; device-token → onApnsToken; foreground presentation + tap → onNotificationTap.
  • ios/Runner/Runner.entitlements (new, wired via CODE_SIGN_ENTITLEMENTS in all configs): aps-environment = production (matches the gateway's APNS_ENV=production).
  • lib/services/push_service.dart: requests permission after sign-in; on token → apiService.registerPushToken(token, deviceId, platform:"ios"); on tap (incl. cold-start via getInitialNotification) → ref.read(routerProvider).push('/player/$videoId') from data.video_id. Stable device_id persisted in Hive.
  • api_service.dart: registerPushToken (POST) / unregisterPushToken (DELETE); tolerates {"enabled":false}. Wired into auth: register on sign-in, unregister on logout.

Verification

  • dart format --set-exit-if-changed exit 0 · flutter analyze — No issues · flutter test151 passed (+ push_service/api_service/auth tests).

Deploy note (handled separately with your Apple access): the App ID codes.julian.nullfeed needs the Push Notifications capability, and delivery only reaches production/TestFlight builds (the gateway is production APNs). CI's --no-codesign build is unaffected.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RXMKM1rDWn8wNh93MMUtxY

Registers the device's APNs token with the backend so new-episode pushes
can be delivered, and routes a tapped notification to the player. Pure
platform-channel integration (no Firebase), modeled on the proven
Cantinarr pattern.

Native (AppDelegate): sets the UNUserNotificationCenter delegate, exposes
a `nullfeed/push` method channel over the implicit engine's messenger,
hex-encodes the device token and forwards it as `onApnsToken`, presents
foreground notifications, and forwards taps as `onNotificationTap`
(caching a cold-start tap until Dart pulls it). Adds Runner.entitlements
(aps-environment) and wires CODE_SIGN_ENTITLEMENTS into all three Runner
build configs.

Dart: PushService owns the channel; registerForPush() (interactive sign-in)
requests permission, registerIfAuthorized() (silent restore) refreshes the
token without prompting at cold launch, and taps route to /player/<id>.
A stable device id is generated once and persisted in Hive. ApiService
gains registerPushToken/unregisterPushToken against POST/DELETE
/api/push/register, tolerating {"enabled": false}. Wired into the auth
lifecycle: register on sign-in/restore, unregister on sign-out/expiry.

Tests cover token -> backend registration (incl. device-id generation and
dedup), tap -> route mapping (mocked channel), the API methods, and the
auth wiring.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RXMKM1rDWn8wNh93MMUtxY
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

`UNNotificationPresentationOptions.banner`/`.list` are iOS 14+, but the app
targets iOS 13, so the no-codesign release build failed to compile. Fall back to
the deprecated-but-functional `.alert` below iOS 14.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RXMKM1rDWn8wNh93MMUtxY
@windoze95 windoze95 merged commit 7cad819 into main Jun 28, 2026
6 checks passed
@windoze95 windoze95 deleted the fix/flutter-push-notifications branch June 28, 2026 14:32
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