Commit Graph

1499 Commits

Author SHA1 Message Date
Jordan Rose
a31100f0f5 Fix copyrights 2022-01-26 09:50:56 -08:00
Jordan Rose
01518551eb Import SignalMetadataKit wholesale into SignalServiceKit
The only modifications are those necessary to build as part of SSK.
The follow-up commits will clean that up a bit.
2022-01-26 09:50:55 -08:00
Nora Trapp
a2f51dc4a3 Cleanup old feature flags 2022-01-24 10:53:55 -08:00
Ehren Kret
c8cbd0bca0 Regenerate SDS extensions 2022-01-24 12:47:21 -06:00
Nora Trapp
c005afd79b Adjust megaphone priority and remove old megaphones 2022-01-24 10:42:34 -08:00
Matthew Chen
fc749b4d72 Change phone number. 2021-11-19 14:28:18 -03:00
Nora Trapp
edc89c3db1 Store badge receipt credential presentation on the durable job 2021-11-17 15:14:03 -08:00
Eugene Bistolas
a3662309c8 [Badging] Boost durable receipt redemption + apple pay cancellation, plus polish 2021-11-17 09:29:02 -10:00
Eugene Bistolas
78cb9352c3 [Badging] Durable receiptCredential fetch and redemption 2021-11-15 12:47:35 -10:00
Michelle Linington
905b7f6507 PR Feedback
- Rename the conversation avatar size class enum cases
- Add explanatory comment for explicit type declaration
2021-11-09 14:25:55 -08:00
Michelle Linington
9123bbd0b4 Partial progress on badged avatars 2021-11-09 14:25:55 -08:00
Michelle Linington
ff3d21ff0e Minor tweaks to recent badging changes
- Optionals are now SDSSwiftSerializable as long as their wrapped type
  conforms
- Avatar file writes are now performed outside of a write transaction
- Various rebase cleanup
2021-11-09 14:25:53 -08:00
Michelle Linington
ebadb12dad Minor comment tweaks, schema adjustments 2021-11-09 14:25:42 -08:00
Michelle Linington
a6deb98c42 Lint 2021-11-09 14:25:42 -08:00
Michelle Linington
3ed711d670 Add support for serializing Swift Codable database columns 2021-11-09 14:25:42 -08:00
Michelle Linington
d1f53b7151 Fix nullability of new OWSUserProfile property 2021-11-09 14:25:42 -08:00
Michelle Linington
fa0d10f047 Firm up database schema 2021-11-09 14:25:42 -08:00
Michelle Linington
5f6ee31e68 Most of badge fetching and persistence
Saving progress before running database codegen
2021-11-09 14:25:42 -08:00
Matthew Chen
079bb08067 Move MobileCoin SDK to SignalUI. 2021-11-02 14:26:02 -03:00
Matthew Chen
153095a500 Reduce statics. 2021-11-02 10:36:25 -03:00
Matthew Chen
9963df1f23 Reduce statics. 2021-11-02 10:36:25 -03:00
Michelle Linington
7be1f0981f Atomic assignment for logThrottleExpiration 2021-10-26 21:43:37 -07:00
Michelle Linington
30b5acd401 Remove leftover comments 2021-10-26 21:43:36 -07:00
Michelle Linington
d11cbf97da Log additional info on receiving a resend request
If someone requests a resend for a failed group message, we should log
out information about all of the groups the requester is a member of and
when they last were sent an SKDM
2021-10-26 21:43:36 -07:00
Matthew Chen
73594067a0 Reduce GRDB read pool size in NSE. 2021-10-26 15:06:38 -07:00
Matthew Chen
fc19922cb5 Don't cache contacts on contacts manager. 2021-10-22 19:09:29 -03:00
Michelle Linington
77b7ea5c40 Fix a whole bunch of warnings 2021-10-21 21:11:26 -07:00
Matthew Chen
a0efdc2e95 Respond to CR. 2021-10-21 09:21:33 -03:00
Matthew Chen
91ad7d1df7 Respond to CR. 2021-10-21 09:21:31 -03:00
Matthew Chen
5d780d1589 Apply script to normalize includes and imports. 2021-10-21 09:21:10 -03:00
Matthew Chen
1b655d63f5 Reduce async work done on NSE launch. 2021-10-21 08:53:15 -03:00
Matthew Chen
d051fb98bd Minor improvements. 2021-10-08 10:43:50 -03:00
Michelle Linington
2f64ad9f74 Revert "Minor improvements."
This reverts commit ed47125c5f.
2021-10-07 20:16:50 -07:00
Matthew Chen
ed47125c5f Minor improvements. 2021-10-07 22:06:29 -03:00
Matthew Chen
af3020a323 Respond to CR. 2021-10-05 18:20:10 -03:00
Matthew Chen
2b0594596a Refine NSE coordination via darwin notifications. 2021-10-05 16:24:31 -03:00
Matthew Chen
5b2bfbdf15 Fire cross-process write notifications sync even if inactive. 2021-10-05 16:24:30 -03:00
Matthew Chen
a6b7f634a3 Debounce "cross process write" notifications in database change observer. 2021-10-05 16:24:30 -03:00
Michelle Linington
e1241eef76 Fix database path KVO 2021-10-04 09:53:37 -03:00
Michelle Linington
e8d7e7b930 Additional logging 2021-10-04 09:53:37 -03:00
Michelle Linington
6f4d3ea56a Remove debug log messages and lint 2021-10-04 09:53:37 -03:00
Michelle Linington
8446ab4069 Minor changes to folder selection and restoration cleanup 2021-10-04 09:53:36 -03:00
Michelle Linington
417c135fc9 Lint 2021-10-04 09:53:36 -03:00
Michelle Linington
25740a25ed Wait until new database has opened before finalizing 2021-10-04 09:53:36 -03:00
Michelle Linington
85bdc19dea Better handling of KVO unregistration 2021-10-04 09:53:36 -03:00
Michelle Linington
738a4aae44 Remove ability to open database in other directory modes
This is unsafe in a cross-process world
2021-10-04 09:53:36 -03:00
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
Michelle Linington
bcb7eddb63 Fix issue with data migrations after a schema change
We're seeing crashes during this data migration step. We fail to init
the OWSUserProfile from the Row result returned from the SQLite fetch
request. It's likely we're indexing into an out-of-bounds index on Row.
(Row._checkIndex is inlined so we can't be sure)

GRDB caches the sqlite3_column_count during Row.init and uses that to
determine if a subscript access is out-of-bounds. From what I can tell
in an amateur reading of sqlite3.c, that just pulls the nResColumn from
the prepared statement. SQLite will determine the number of result
columns during statement prep, but the column count can change if the
table schema changes:

> If the database schema changes, instead of returning SQLITE_SCHEMA as
  it always used to do, sqlite3_step() will automatically recompile the
  SQL statement and try to run it again. As many as
  SQLITE_MAX_SCHEMA_RETRY retries will occur before sqlite3_step() gives
  up and returns an error.

We're nesting a deferred read transaction inside of our data migration's
immediate transaction. This read is using a different sqlite connection
that the connection performing our migrations. So its understanding of
the schema is stale and because it's in a deferred transaction it won't
figure this out until we call _step().

Once we call _step(), sqlite will realize that the table schema has
changed and recompile the prepared statement while opening the
deferred transaction. After this, the sqlite_column_count is correct.
But Row still has the incorrect value cached from before the schema was
resolved.

So by the time we try and init our OWSUserProfile, Row falsely asserts
that we're indexing beyond the column count by comparing against a stale
version of the column count.

The fix:
Rework the data migration to avoid nesting a deferred read transaction.
This is incorrect behavior. Now that our read is using our already open
write transaction with the same connection handle, it's understanding of
the schema is up-to-date during statement prep. So Row.init grabs the
current column count.
2021-09-30 13:00:26 -07:00
Matthew Chen
e70302ac8f Refine NSE completion blocking, message processing. 2021-09-27 19:04:46 -03:00