Architecture
Key files
PushManager
File:Utils/Push/PushManager.swift
- Device token registration
- Notification permission handling
- Push payload parsing
- Route extraction
- Pending route management
Push routes
Routes map notification targets to in-app destinations:Route parsing
Kind overrides
Some notification kinds have special routing:Notification service extension
Target:DialedNotificationService
Enriches notifications before display:
Communication style
For chat DMs, usesINSendMessageIntent:
- Sender avatar in notification
- Communication notification style
- Notification grouping
Attachment style
For media notifications:- Downloads image/avatar JPEGs
- Attaches to notification
- Shows rich preview
Token registration
Handling flow
- Notification received (background or foreground)
- Service extension enriches if applicable
- User taps notification
- PushManager extracts route from payload
- Sets
pendingRoutepublished property - Shell view observes and navigates
Notification kinds
Common notification kinds and their handling:Testing push
Use Xcode’s push notification simulator:- Create
.apnsfile with payload - Drag onto simulator
- Or use
xcrun simctl pushcommand