This differential enables NSE to perform coalescing of encrypted notifications. Previously notification coalescing was done by setting apns-collapse-id header in notification. This header was then equal to the identifier property of UNNotificationRequest (object received by the NSE on each mutable notification): https://developer.apple.com/documentation/usernotifications/unnotificationrequest/1649634-identifier?language=objc. The OS automatically replaces previous notification with the latest notification with the same request identifier property. In the world of encrypted notification this header cannot be set anymore. It would be a security breach since apple would see two encrypted notifications sharing the same collapse id. Unfortunately it is not possible to modify identifier property of UNNotificationRequest in the NSE. This forces us to:
- put collapseID in the encrypted payload.
- after decryption check for this field.
- If found then we have to create local notification with the same contents as the original one and request identifier equal to collapse id.
- Display local notification and silence the original one by calling content handler with blank notification content ([[UNNotificationContent alloc] init])
This is implemented in this diff.