This helps running a Signal Desktop instance from a backup (copy of profile
folder) when testing functionality such as database migrations, import/export,
etc.
Usage:
```
BACKUP=development-backup-2018-04-04 PROFILE=development ./scripts/start-backup
```
WARNING: This deletes the original profile and overwrites it with backup.
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.