Notifications (iOS)
Notification data flow
- APNs delivers payload
- Firebase Messaging resolves token + delivery callbacks
NotificationManager.shared handles notification details
- Your app presents the modal and tracks engagement events
Recommended delegate setup
UNUserNotificationCenter.current().delegate = NotificationManager.shared
Messaging.messaging().delegate = self
Forward system callbacks
func userNotificationCenter(
_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void
) {
NotificationManager.shared.userNotificationCenter(center, willPresent: notification, withCompletionHandler: completionHandler)
}
func userNotificationCenter(
_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void
) {
NotificationManager.shared.userNotificationCenter(center, didReceive: response, withCompletionHandler: completionHandler)
}
Build modal from SDK details
@ObservedObject private var notificationManager = NotificationManager.shared
.sheet(item: $notificationManager.latest) { details in
NotificationModalView(details: details)
}
Track interactions
NotificationManager.shared.trackCTAEngagement(notificationID: notifId, locationID: locationId)
NotificationManager.shared.trackMediaView(notificationID: notifId, locationID: locationId)
BubblPlugin.shared.trackSurveyEvent(
notificationId: "\(notifId)",
locationId: "\(locationId)",
activity: "dismissed"
) { _ in }