Signal-iOS/SignalServiceKit/src/Account
Michelle Linington fdc983519a Dynaically update database location at runtime
Fixes an issue where users were no longer receiving messages after
restoration. During restoration, the restoring device copies the
transferred database files to a special "hotswap" directory since we
don't want to overwrite our currently in-use database. Once finished, it
re-opens the database pointing to our hotswap directory. It would then
move the hotswap database to its primary location on the next app
launch.

The problem here is our extensions don't know how to read the hotswap
directory. Even if we added that capability, it's going to be tricky to
coordinate which database they read and when as the main app shuffles
files around.

This fix adjusts our restoration flow. Instead of having a special
"primary" and "hotswap" directory that we need to fix up on the next
launch, we instead record a UserDefaults entry that points to our
current database directory.

Once transfer has completed, the main app only needs to update the
current database directory in UserDefaults. No post-launch swapping
needs to occur.

Extensions will listen for updates to this database location by
registering KVO on NSUserDefaults.

This change also adjusts the restoration flow to break it up into
discrete stages. The motivation here is we need to make sure that a
partial restoration doesn't put the extensions in an inconsistent state.
2021-10-04 09:53:35 -03:00
..
AccountServiceClient.swift Convert to new Promise library 2021-09-03 11:41:34 -07:00
CreatePreKeysOperation.swift Convert to new Promise library 2021-09-03 11:41:34 -07:00
RefreshPreKeysOperation.swift Convert to new Promise library 2021-09-03 11:41:34 -07:00
RotateSignedKeyOperation.swift Convert to new Promise library 2021-09-03 11:41:34 -07:00
TSAccountManager.h Dynaically update database location at runtime 2021-10-04 09:53:35 -03:00
TSAccountManager.m Dynaically update database location at runtime 2021-10-04 09:53:35 -03:00
TSAccountManager.swift Handle certain call messages sync. 2021-09-22 12:12:13 -07:00
TSPreKeyManager.h Fix build warnings around imports. 2021-06-07 11:11:30 -04:00
TSPreKeyManager.m Clean up ahead of PR. 2021-08-18 14:26:16 -03:00
TSPreKeyManager.swift Deprecate REST, Part 1 2021-08-18 14:25:36 -03:00