Page MenuHomePhabricator

Fix broken collapsable notifs in badge only threads on iOS
ClosedPublic

Authored by marcin on Sep 9 2024, 2:09 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 22, 4:11 PM
Unknown Object (File)
Fri, Nov 22, 3:53 PM
Unknown Object (File)
Fri, Nov 22, 10:32 AM
Unknown Object (File)
Sun, Nov 10, 1:03 AM
Unknown Object (File)
Sat, Nov 9, 9:45 PM
Unknown Object (File)
Sat, Nov 9, 7:02 PM
Unknown Object (File)
Oct 22 2024, 6:30 PM
Unknown Object (File)
Oct 22 2024, 6:30 PM
Subscribers
None

Details

Summary

When user receives notification with collapse id in badge only thread it will result in notification with "ENCRYPTED" body. This diff fixes that.

Test Plan
  1. Prior to this diff every collapsable notif (image, change settings etc.) resulted in ENCRYPTED notifs in a badge-only thread on iOS.
  2. After this diff the issue is fixed.

Diff Detail

Repository
rCOMM Comm
Branch
marcin/eng-9185
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

marcin requested review of this revision.Sep 9 2024, 2:26 AM
This revision is now accepted and ready to land.Sep 9 2024, 2:50 AM
This revision was landed with ongoing or failed builds.Sep 9 2024, 3:09 AM
This revision was automatically updated to reflect the committed changes.

Just wondering, what codepath led to the ENCRYPTED notif? Curious why we saw that instead of Obj-C exception or C++ exception

Just wondering, what codepath led to the ENCRYPTED notif? Curious why we saw that instead of Obj-C exception or C++ exception

The code path flows like this:

  1. First the keyserver inserts ENCRYPTED body to aps dictionary on encrypted badge only notification: https://github.com/CommE2E/comm/blob/5e6732ede2db1aed9e4f2cb15db249a87e643aa3/keyserver/src/push/crypto.js#L88
  2. The NSE decrypts notification. There is no body property in decryptedPayload so it does not overwrite the body property that is in aps dictionary: https://github.com/CommE2E/comm/blob/5e6732ede2db1aed9e4f2cb15db249a87e643aa3/native/ios/NotificationService/NotificationService.mm#L679-L687
  3. Then the NSE sees that this notification has collapse key so it creates local notification that has the same body as the original notification (which is ENCRYPTED): https://github.com/CommE2E/comm/blob/5e6732ede2db1aed9e4f2cb15db249a87e643aa3/native/ios/NotificationService/NotificationService.mm#L251