DocHub
APNs sound, super_admin routing, repeat alerts, in-app banners

Push Notification Fixes — March 10, 2026

Server-Side (pushManager.ts)

APNs Sound

Added sound: "default" to the APNs aps payload. Previously notifications arrived silently.

Super Admin Push Recipients

Four API routes only sent push notifications to users with role = 'admin'. Updated all four to include super_admin:

  • /api/orders/[orderId]/payment-status
  • /api/driver/orders/[orderId]/claim
  • /api/driver/orders/[orderId]/pickup
  • /api/driver/orders/[orderId]/proof

Uses .in("role", ["admin", "super_admin"]) instead of .eq("role", "admin").

Restaurant Name in Title

Admin/super_admin users receive push titles with the restaurant name: "New order · Casa Nelba Roatan". Regular assigned staff get the generic "New order!" title since they already know their restaurant.

Flutter App (RicoyaManagerApp)

AppDelegate Push Data

willPresent callback was passing nil to Flutter’s MethodChannel. Now forwards title, body, and userInfo.

Repeat Alert Timer

Added 30-second repeat timer in OrdersProvider. If any orders remain in placed status, the “Order! Order! Order!” TTS alert re-fires every 30 seconds.

In-App Banner

NewOrderBanner widget overlays at the top of the ManagerShell when alerts fire. Shows “X new orders waiting!” for 5 seconds, then auto-hides. Controlled by showBanner flag in OrdersProvider.

Logout Cleanup

OrdersProvider.clear() called on sign-out to stop all timers and clear state. Previously the alert sound continued playing on the login screen.

APNs Key Configuration

Environment Key ID APNs Host Use Case
Production G3BHXM2HW6 api.push.apple.com TestFlight, App Store
Sandbox XZZ44W7RYR api.sandbox.push.apple.com Xcode debug builds

Production key cannot send to sandbox APNs (returns BadEnvironmentKeyInToken). Each environment requires its matching key.