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:
- If we are connected to the tunnelbroker, we trust redux and update notifs storage (MMKV) with data from redux.
- If we are disconnected from the tunnelbroker, we trust notifs storage (MMKV) and fetch data from there.
- We sum the number of unread thick threads and partial unread counts for each keyserver to get the total unread count.
- We set badge count to total unread count.
Test Plan:
- Apply this patch: https://gist.github.com/marcinwasowicz/35071cea6abade632df8bc30f71fb1ab to send messages and rescinds to native device from web.
- 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