Users lose their read receipt setting after relinking their app.
See: https://github.com/signalapp/Signal-Android/issues/7535
- [x] Request configuration sync after relink, not just on first run.
- [x] Minor: Add `is` dependency as discussed.
- [x] Unit tests!! Started a pattern where functions return their status that
can be logged instead of logging themselves. Makes for great tests and
might also help us debug user logs as the status will always be logged
(with `reason` field) whether it was done or not. Otherwise, we have to
look for the presence or absence of a log line. Of course, we have to be
careful about log noise, but I thought this was a nice fit here.
**Manual Tests**
- Started app and set read receipts on iOS.
- Sent message from another device with read receipts enabled.
- Confirmed messages were marked read on both sides.
- Unlinked primary device.
- Relinked primary device.
- Sent messages between primary and other device.
- Confirmed read receipts are still shown.
- Confirmed logs show configuration sync.
Going through the git history the existing logic of "dont do this if
it's already selected" was just for audio or video QOL enhancements to
not stop playing when the same conversation is selected.
- [x] Implement batch migration of attachments without index, i.e. use default
primary key index on `Message::id`.
- [x] Run attachment in background without index.
- [x] Prepare module for whole database migrations in the future. Once we enable
that, we have to force (remaining) attachment migration upon startup.
- [x] Run migrations explicitly on startup and remove implicit migrations from
Backbone models using a placeholder that throws an error.
- [x] `Signal.Debug`: Add support for generating real-world data for
benchmarking based on contents in `fixtures` folder. Add additional files
to create a larger variety of test cases, e.g. JPEG, PNG, GIF, MP4, TXT,
etc. **Test command:**
```
Signal.Debug.createConversation({
ConversationController,
WhisperMessage: Whisper.Message,
numMessages: 100,
});
```
- [x] Minor: Improve error message for `storage.fetch` failures.
- [x] Minor: Use ISO-8601 timestamp for key rotation (helped me debug an issue).
- [x] Update tests to explicitly run migrations.
Previously, this was formatted using locale specific settings. This will allow
easier debugging by matching key rotation timestamps against log timestamps.
Introduce placeholder migrations for Backbone models so they never implicitly
run migrations whenever they are `fetch`ed. We prefer to run our migrations
explicitly upon app startup and then let Backbone models be (slightly) dumb(er)
models, without inadvertently triggering migrations.
- [x] Run initial Backbone migrations 12–17 upon startup.
- [x] ~~Run attachment migration (without Backbone references to avoid
migrations): `MessageDataMigrator.processAll`.~~ Disabled in favor of
background processing without index.
- [x] ~~Run new migrations that can cover entire database (18+).~~
Not until we have such migrations.
- [x] Add `runMigrations` module that ensures migrations are only run once.
- [x] Add `settings` (`Signal.Settings`) module to interact with our app
settings (`items` store) using a domain API, e.g.
`isAttachmentMigrationComplete(…)` vs
`storage.get('attachmentMigration_isComplete')`. Required to check
attachment migration status without using Backbone.
- [x] Add `database` (`Signal.Database`) CommonJS module to provide
`Promise`-based interface to IndexedDB.
- [x] Add `debug` (`Signal.Debug`) module for generating synthetic data to test
performance of migration.
- [x] Minor: Add `sleep` module for doing promise based sleeps.
- [x] Minor: Extract `wrapDeferred` as CommonJS module named `deferredToPromise`.