HomePhabricator
Diffusion Comm 7d230d26f9cb

Modify TemporaryMessageStorage API, so that we can have two storages: one…

Description

Modify TemporaryMessageStorage API, so that we can have two storages: one (created by default init) for messages and the other for rescinds.

Summary:
This differential modifies TemporaryMesssageStorage API. Changes are:

  1. Public API does not allow to create TemporaryMessageStorage at an arbitrary disk location. There are just two locations: one for messages with messageInfos and the other for rescinds.
  2. Location for rescinds will use different directory and will prefix semaphores with differenti strings.

REMINDER: On iOS we can't store messages in SQLite directly from Notification Service. We agreed on workaround where NotificationService stores messages in a temporary flat file. AppDelegate reads and then removes (clears) content of this file when app is launched and transfers messages to the database. The class being subject of this differential provides an API to do that. Initially it was used exclusively for visible notifications since rescinds were handled by AppDelegate, Now that rescinds are handled by NSE we have to store them in a flat file as well so that AppDelegate can read them and update unread statuses of relevant threads on App start.

Test Plan:
Remove codeVersion > 1000 condition. Kill the app. Send some notifications. Attach debugger to moveMessagesToDatabase. Launch the app and observe that messages payloads were persisted. This tests that previous functionality was not broken. Future differentials will use
new api for temporarily storing rescinds.

Reviewers: bartek, tomek, atul, kamil

Reviewed By: tomek, atul

Subscribers: ashoat

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