HomePhabricator
Diffusion Comm 1abc6043ed20

Implement thick thread badge updates and rescinds handling in native notifs code

Description

Implement thick thread badge updates and rescinds handling in native notifs code

Summary:
This differential implements badge count and rescind handling in the NSE/CommNotificationsHandler.

Notes on rescinds:

  1. The difference between thick thread rescind and thin thread rescind is presence of notificationId/rescindID property.
  2. Thin thread rescinds remove single notification while thick thread rescinds remove all notification for particular therad.
  3. In future we want thin thread rescinds work like thick thread rescinds.

Notes on badge count:

  1. Badge count value is calculated based on the sum of unread counts for each keyserver and the size of unread thick threads set.
  2. Visual notifs and badge updates add relevant threadID to the unread thick threads set. Rescinds remove threadID from unread thick threads set.

Test Plan:

  1. Apply this patch: https://gist.github.com/marcinwasowicz/3e766542268c0840626ece5af61cc5db
  2. Build native app, log in to two different users on native and web, background native app.
  3. Send text message from web to native.
  4. Ensure the following happens:
    1. Keyserver based notif is delivered, badge count is 1.
    2. Thread creation and text message thick thread notifs are delivered, badge count is 2.
    3. After a little while thick thread notifs are removed, keyserver notif stays and badge count is 1 again.

Backgrounding the app is necessary since the JS code cannot update badge count with thick threads yet. This will be the matter of next diffs.

Reviewers: tomek, kamil, bartek

Reviewed By: tomek

Subscribers: ashoat

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