HomePhabricator
Diffusion Comm 3b3f4fdc076c

Enable encrypted notification coalescing in NSE on iOS

Description

Enable encrypted notification coalescing in NSE on iOS

Summary:
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:

  1. put collapseID in the encrypted payload.
  2. after decryption check for this field.
  3. If found then we have to create local notification with the same contents as the original one and request identifier equal to collapse id.
  4. 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.

Test Plan:
Impossible to test without some changes on the keyserver.

  1. Build iOS app
  2. Apply this patch: https://gist.github.com/marcinwasowicz/a318bb475e575df662429702905b4a01
  3. Send a couple of photos to the same user, or update some chat settings a couple of times (the same setting!).
  4. Ensure that coalescing takes place.

Reviewers: tomek, atul, bartek

Reviewed By: tomek

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D9144

Details

Provenance
marcinAuthored on Sep 12 2023, 4:49 AM
Reviewer
tomek
Differential Revision
D9144: Enable encrypted notification coalescing in NSE on iOS
Parents
rCOMM91da37a13cb2: [lib/native] introduce XXL size to AvatarSize
Branches
Unknown
Tags
Unknown