Commit Graph

121 Commits

Author SHA1 Message Date
Michelle Linington
ccf9383533 Improvements to database swap flow
Added a bunch of comments clarifying the database swap requirements.
Also, removed the baseDir parameter from GRDBDatabaseStorageAdapter.
2021-10-04 09:53:36 -03:00
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
Matthew Chen
e70302ac8f Refine NSE completion blocking, message processing. 2021-09-27 19:04:46 -03:00
Matthew Chen
7356ee90dc Deduplication message decryption to avoid spurious errors when NSE and main app message processing race. 2021-09-22 12:05:28 -07:00
Michelle Linington
51f3a58a61 Message send log recording and resend responses 2021-07-21 22:58:51 -07:00
Matthew Chen
2a0ebc0afe Merge branch 'release/5.16.0' 2021-07-09 15:49:59 -03:00
Matthew Chen
27459a0e2b Respond to CR. 2021-07-09 15:47:10 -03:00
Matthew Chen
587f80969a Fix deadlock crash in DatabaseChangeObserver. 2021-07-09 13:32:19 -03:00
Matthew Chen
89a5dea49b Use file coordinator to protect database creation. 2021-07-08 17:40:45 -03:00
Matthew Chen
d230c45c4c Refine isCheckpointing flag. 2021-07-08 17:35:31 -03:00
Matthew Chen
4f17b816c9 Rework database checkpointing. 2021-07-08 17:35:31 -03:00
Matthew Chen
64309341c6 Rework database checkpointing. 2021-07-08 17:35:31 -03:00
Matthew Chen
a444862311 Rework database checkpointing. 2021-07-08 17:35:31 -03:00
Matthew Chen
6f232977ea Rework database checkpointing. 2021-07-08 17:35:31 -03:00
Matthew Chen
a30400af64 Rework database checkpointing. 2021-07-08 17:35:31 -03:00
Matthew Chen
78fd304b74 Respond to CR. 2021-07-02 22:15:07 -03:00
Matthew Chen
f2b76e60f9 Refine names. 2021-07-02 22:08:53 -03:00
Matthew Chen
103d0d0942 Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
c403dee9c2 Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
f06b72bc2a Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
f65d6e8e2d Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
d6a03a4770 Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
d2f75a81a8 Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
d4d96d698f Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
a314ad2432 Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
03acf2ffdd Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
03cc35819e Remove uiRead(). 2021-07-02 22:04:58 -03:00
Nora Trapp
e439bb619e Move isArchived, isMarkedUnread, and mutedUntilDate off of TSThread 2021-05-13 12:54:33 -07:00
Nora Trapp
bf660c85ce Add TSGroupMember table to allow performant querying of group membership 2021-04-08 13:44:00 -07:00
Matthew Chen
a00d14ddc4 Payments: Models 2021-04-06 13:57:06 -03:00
Nora Trapp
0ef7fc24e6 Revert database recovery attempts, just flag when we detect corruption and prevent app launch. 2021-04-01 12:50:41 -07:00
Nora Trapp
722675525d Change device transfer hotswap to avoid database corruption. 2021-04-01 12:50:41 -07:00
Nora Trapp
db5532b590 protect database recovery from orphan data cleaner 2021-04-01 12:50:41 -07:00
Nora Trapp
0fee67ae60 Attempt to recover database if corruption was detected 2021-04-01 12:50:41 -07:00
Matthew Chen
86b8eb08b8 Remove YapDatabase.
Apply asset from design.

Fix rebase breakage.
2021-03-25 11:41:16 -03:00
Matthew Chen
d0cbf8cfd0 Rework dependency access. 2021-03-25 09:24:27 -03:00
Jordan Rose
15a4a1a9cd MediaGallery: delete old Finder API, including its Yap implementation 2021-03-04 10:30:54 -08:00
Jordan Rose
26037ff8f4 Database: Remove @escaping from all synchronous transaction callbacks 2021-03-04 10:30:54 -08:00
Matthew Chen
d82b6f8250 Create a new GRDB storage adapter after grdb schema migrations. 2021-01-27 09:45:12 -03:00
Matthew Chen
f7ec15b808 Refine query filtering. 2020-12-23 18:14:32 -03:00
Matthew Chen
111338b59d Rewrite conversation view. 2020-12-10 12:44:13 -03:00
Matthew Chen
13e7456d22 Fix some of the performance tests. 2020-10-16 10:15:16 -03:00
Michelle Linington
7494eed9cc PR Feedback, update schema_dump to support sqlclient updates 2020-08-20 13:07:23 -07:00
Michelle Linington
c0dee48b37 IOS-784: Improvements to sqlclient script
This change makes the debug the sqlcipher database with command line
much easier. Leverages simctl to make simulator discovery and
introspection super straightforward
2020-08-20 13:07:23 -07:00
Nora Trapp
427f42874d Track who was mentioned in a given message in a queryable way 2020-08-04 14:09:06 -07:00
Matthew Chen
a261fcda06 Fix database issues around device transfer. 2020-07-03 16:07:30 -03:00
Matthew Chen
3cedd3ccdf Overhaul database observation. 2020-06-18 09:28:49 -03:00
Matthew Chen
577b0acf20 Merge remote-tracking branch 'private/release/3.10.6' into release/3.11.0 2020-06-11 15:33:09 -03:00
Matthew Chen
62de796e54 Deduplicate thread touches by deferring them until the transaction is finalized. 2020-06-11 13:18:49 -03:00
Matthew Chen
77531974d3 Deduplicate thread touches by deferring them until the transaction is finalized. 2020-06-11 13:18:49 -03:00