HomePhabricator
Diffusion Comm c60c0337be1f

Update badge count from JS on native taking into account thick threads

Description

Update badge count from JS on native taking into account thick threads

Summary:
This differential uses JSI from previous differential to update badge count by taking into account unread thick threads. The algorithm is the same as for the keyservers:

  1. If we are connected to the tunnelbroker, we trust redux and update notifs storage (MMKV) with data from redux.
  2. If we are disconnected from the tunnelbroker, we trust notifs storage (MMKV) and fetch data from there.
  3. We sum the number of unread thick threads and partial unread counts for each keyserver to get the total unread count.
  4. We set badge count to total unread count.

Test Plan:

  1. Apply this patch: https://gist.github.com/marcinwasowicz/35071cea6abade632df8bc30f71fb1ab to send messages and rescinds to native device from web.
  2. Ensure that badge count stays consistent both in the background (notifs code modifies badge count) and in the foreground (JS modifies badge count)

Reviewers: kamil, tomek

Reviewed By: tomek

Subscribers: ashoat

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