This differential implements notifications removal from NotificationCenter when receiving rescind. The API used to remove a notification from NotificationCenter is the same as we use in CommIOSNotifications native module. We additionally do a trick with semaphore and dispatch
queue to ensure we don't exit too early from NSE before asynchronous UNUserNotificationCenter API fires.
Details
Remove condition codeVersion > 1000 from send.js and rescind.js in keyserver. Send some notification from one user. Then send some notifications from another user. Generate rescind for only one of those users! Ensure notifications for this one user a removed while for
the other stay in notification center.
Diff Detail
- Repository
- rCOMM Comm
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
native/ios/NotificationService/NotificationService.mm | ||
---|---|---|
79 ↗ | (On Diff #23338) | Shouldn't we only call postRemovalCallback within this if condition? I don't understand why we'd call it if we haven't removed anything |
81 ↗ | (On Diff #23338) | What's confusing to me is that it appears postRemovalCallback can be called multiple times. If it gets called multiple times, won't the semaphore wait be concluded on the first time, and then the subsequent times might be missed? If it's meant to only be called once, then I think it would be good to add a return or something here, to make it more clear to the reader than it's only called once. |
native/ios/NotificationService/NotificationService.mm | ||
---|---|---|
81 ↗ | (On Diff #23338) |
I think the naming is bad for this lambda.
This lambda increments zero-valued semaphore that NSE callback is waiting on. If we never execute code inside if statement we might be stuck waiting for the semaphore to be incremented until time-expiration callback fires.
This is my programming mistake. This callback should be fired after for loop scope. This way we call it once and only once. So the plan is:
|