Commit Graph

8106 Commits

Author SHA1 Message Date
Max Radermacher
08a7774fc6
Fix web socket normalClosure on iOS 13 2023-01-10 17:26:18 -08:00
Max Radermacher
907b6cb02d Require transaction when updating address mappings 2023-01-10 16:31:31 -08:00
Max Radermacher
07a7478d57 Remove redundant cache removal operation
We do the same operation 1.5 times. We only need to do it once.
2023-01-10 16:31:31 -08:00
Max Radermacher
fb7b6d80f2 Fix SignalServiceAddress hashValue debug check 2023-01-10 16:31:31 -08:00
Max Radermacher
3c6d3e8adb
Fix web socket error reporting after handshake
If we hit an HTTP error during the handshake, we’ll get back a
badServerResponse error, and the `response` will indicate the error.

If we run into some other error later in the process, we’ll get back a
non-badServerResponse error, but the `response` will still be set based
on the most recent HTTP response (ie HTTP 101 Switching Protocols),
which isn’t actually the error that occurred.
2023-01-10 16:27:25 -08:00
Evan Hahn
f4530c0438
Use new copy for donation receipt titles
"Gift" is now "Donation for a Friend".
2023-01-10 15:41:32 -06:00
Harry
b3136fb42c
Call Disposition
* Add CallEvent sync message proto

* Add CallRecord class and db table

* Renames and comments for clarity

* create and update CallRecord from local device call events

* Handle incoming call event sync messages

* Add outgoing call sync event piping

* Send call event sync messages

* Handle call record sync messages before the app is launched

* Mark TSCall interactions as read and update their status when getting call event sync messages

* Prevent CallKit race conditions by checking state before creating TSCall interactions

* Update chat call event text for unanswered and declined calls

* Remove incorrect debug assert which fires every time a call is missed in the background

* PR comments, mostly nits

* convert old debug assert into a log + task comment

* nit

* Update copy for in chat call logs

* Smaller PR comments

* Add foreign key to CallRecord's interactionUniqueId

* Update write transaction ordering comment

* run genstrings

* fix strings
2023-01-10 11:48:46 -08:00
Max Radermacher
9528ac2c8e Don’t send pre key fetches via web socket
This was added in ab6c4a4c36, but the
server deosn’t support "v2/keys" via web socket, so the web socket
requests always fail and fall back to the REST endpoint.
2023-01-10 11:37:52 -08:00
Max Radermacher
566d39d215 Remove hasWebsocketSendFailed
This was added Oct 5, 2018 (a697072271).
As of Oct 19, 2018 (2894db0d6e), it’s no
longer read, so the assignments aren’t necessary.
2023-01-10 11:37:52 -08:00
Sasha Weiss
f4af994294
Move boost payment requests to extension in own file 2023-01-10 11:32:15 -08:00
Max Radermacher
751f551e79 Don’t use serviceIdentifier for Contacts 2023-01-09 12:01:34 -08:00
Max Radermacher
fd3457b9a5 Update sending flow to use UUIDs 2023-01-09 12:00:51 -08:00
Max Radermacher
6c2eabaacb
Only use ACI when fetching pre keys 2023-01-09 12:00:07 -08:00
george-signal
955680d635
All media optimizations. 2023-01-06 16:42:37 -08:00
Max Radermacher
318e59a54b
Only use ACI when authenticating 2023-01-04 10:35:41 -08:00
Sasha Weiss
b875482cde
Always unarchive a chat when you send a message in it 2023-01-03 13:26:48 -08:00
Max Radermacher
d7c52b6ad0
Fix bugs marking SignalRecipients as registered
Previously, low-trust SignalRecipients wouldn’t be marked as registered
unless they were newly-created. Now, they are marked as registered in
places where they should be (eg, successfully sending a message or
fetching a pre key means that the device exists).

As part of this change, SignalRecipients are unregistered by default,
though most call sites still mark them as registered immediately, so the
behavior in practice will be identical. There are a few places (such as
ensureAccountId) which will no longer mark new values as registered.

Finally, creating a new SignalRecipient would also update Storage
Service, even if that recipient was created in response to a storage
service update. Now, recipients updated as part of storage service
operations won’t immediately trigger another storage service update.
2023-01-03 13:23:33 -08:00
Sasha Weiss
dd046e8126
Expose 'keep muted chats archived' option for all users 2023-01-03 10:33:30 -08:00
Max Radermacher
19a5143b3f Remove deprecated endpoint for acking messages 2023-01-02 15:30:20 -08:00
Max Radermacher
47bea9635a Fix deprecation warning while enumerating messages 2023-01-02 10:47:15 -08:00
Max Radermacher
aa30bc9e0b
Clean up contact merging & Swiftify some logic
* Clean up recipient merging code

A number of properties were being fetched & validated repeatedly. It’s a
bit easier to follow if we validate them once at the beginning.

* Swiftify contact merging code

No material changes to the behavior.
2022-12-19 14:54:06 -08:00
Max Radermacher
da3fe53397
Don’t send contact sync messages in the NSE
Instead, mark that one is required and have the main app handle it at
the next opportunity.
2022-12-19 13:32:43 -08:00
Evan Hahn
3892b9ead6 Handle SQLite corruption during database migration
If we fail to migrate the database due to corruption, we should bump the
user into the database recovery tool.

Tested this manually by corrupting the database and hitting this error.
2022-12-19 15:11:29 -06:00
Evan Hahn
2a226d80f8
Remove deprecated, unused file
*This change should have no user impact.*

`SDSKeyValueStore+Deprecated.swift` was completely unused, so we can
remove it.
2022-12-19 13:09:56 -08:00
Evan Hahn
dc9637b127 Handle SQLite corruption during database initialization
GRDB executes some simple statements when initializing a `DatabasePool`
object (see [1][], [2][], [3][], [4][]). If any of those fail with a
corruption error, we should flag the database as corrupted. This will
let the user attempt recovery.

[1]: 23f4254ae3/GRDB/Core/Database.swift (L365)
[2]: 23f4254ae3/GRDB/Core/DatabasePool.swift (L75)
[3]: 23f4254ae3/GRDB/Core/DatabasePool.swift (L82)
[4]: 23f4254ae3/GRDB/Core/DatabasePool.swift (L91-L94)
2022-12-19 14:35:33 -06:00
Evan Hahn
fb8f390733 Remove unnecessary swiftlint:disables
In a48049f44f, we disabled some Swiftlint
rules due to a Swiftlint bug. This reverts that commit because it
[appears the bug has been fixed][0].

[0]: 7bd8362dae/CHANGELOG.md (0503-bundle-of-towels)
2022-12-19 14:35:21 -06:00
Max Radermacher
2a72010bef Add missing table for contact merge migrations 2022-12-19 11:45:23 -08:00
Max Radermacher
763c362084 Clean up SignalServiceAddress initializer 2022-12-19 11:41:59 -08:00
Harry
6556f389c7
Rotate APNS tokens automatically when the NSE fails to receive notifications
* Allow using a transaction for checking APNS token

* Add APNSRotationStore

* add APNSRotationStoreTest

* Rotate APNS tokens in SyncPushTokensJob

* Mark NSE as having processed messages for token rotation

* Check for APNS token rotations after flushing incoming message queue

* pr comments

* Simplify APNS rotation conditions: we mark APNS as working when getting a push in either the NSE or the main app, and rotate if we missed a message since then.

* Mark APNS tokens as working if we ever get a push. Don't rotate known-good tokens.

* Added logging

* add remote flags to control behavior

* pr comments

* fix bad merge

* invert kill switch

* PR nit comments

* Avoid write transactions on the SyncPushTokensJob hot path

* Initial PR feedback, more to come

* Change of strategy: rotate if we have new messages to process on app startup

* PR comments

* use null for calltype column on incoming message rows
2022-12-19 11:10:15 -08:00
Harry
47f42f3a44
Increment GRDB schema version for added CDSV2 migration 2022-12-15 18:16:06 -08:00
Max Radermacher
921301cdb0
Add CDSv2 2022-12-14 16:30:35 -08:00
Evan Hahn
b7cd791caf Swiftify OWSDisappearingMessagesFinder
This change should have no user impact.
2022-12-13 17:11:50 -06:00
Max Radermacher
20d46d1e59
Clean up Giphy search 2022-12-13 12:20:19 -08:00
Evan Hahn
491daa3e7d
"qa" → "internal"
This change should have no user impact. It renames "qa" to "internal"
for clarity.
2022-12-12 15:54:08 -06:00
Max Radermacher
75e377b164
Fix NSE build expiration
The NSE’s Info.plist didn’t contain a BuildTimestamp, so it wouldn’t
have a default expiration.

The new approach reads the main app’s expiration from all of the
extensions, which helps ensure they all expire at the same time.
2022-12-09 15:11:39 -08:00
Evan Hahn
935dbd8274 Finish Swiftifying StickerPackInfo
Notable changes:

- `asKey` became a computed property instead of a function.
- Had to jump through some hoops for `MTLModel`.
2022-12-07 09:37:07 -06:00
Evan Hahn
f0440b96ad Swiftify "parse sticker pack URL" function
This makes two significant changes:

- Hard fail if called with an invalid sticker pack URL. (All callers
  check this already, so this should have no user impact.)
- Uses `URLComponents` to parse the fragment instead of a custom decoder
2022-12-07 09:37:07 -06:00
Evan Hahn
60e6303efd Swiftify "is this a sticker pack URL?" function 2022-12-07 09:37:07 -06:00
Evan Hahn
2ad0b7324c Swiftify method to parse sticker pack info from bytes 2022-12-07 09:37:07 -06:00
Evan Hahn
52ca2cd106 Swiftify method to parse sticker pack info from hex strings
This also renames it from `parsePackIdHex(_:packKeyHex:)` to
`parse(packId:packKeyHex:)`.
2022-12-07 09:37:07 -06:00
Evan Hahn
9e7a2c4228 Swiftify StickerPackInfo's shareUrl method 2022-12-07 09:37:07 -06:00
Evan Hahn
878d2c14d0 Warn (don't debug-fail) when parsing invalid sticker pack data
We should debug-fail when someone at Signal has made a mistake. If a
user clicks a bogus sticker pack link, nobody at Signal has made a
mistake, so we should warn instead.

This change should have no user impact, but makes it possible to write
tests for invalid cases.
2022-12-07 09:37:07 -06:00
Evan Hahn
127958a8fa
Swiftify a few phone number utility methods
This converts `PhoneNumberUtil.countryNameFromCountryCode`,
`PhoneNumberUtil.countryCodesForSearchTerm`, and `PhoneNumberUtil.name`
to Swift. I renamed `PhoneNumberUtil.name` to `does` for clarity, and
made it private.

This also lets us remove several utility methods.
2022-12-07 08:32:24 -06:00
Evan Hahn
c1da120d2a
Fully remove "gv1-migration" capability code
This was partly done in 6e6327b007. The
server now [hard-codes this capability to `true`][0] so it's completely
useless for us to set it.

[0]: fb4ed20ff5
2022-12-06 12:56:59 -08:00
Evan Hahn
ad71c9661d Remove unused orderOfMagnitudeOf method
`OWSAnalytics.orderOfMagnitudeOf` is no longer used as of
f973af5a83. This removes it and its
associated tests.
2022-12-06 14:27:59 -06:00
Jordan Rose
5a2e15039b Enable outbound group rings for non-beta users as well 2022-12-06 11:09:22 -08:00
Evan Hahn
fa828db444 Prefer CUnsignedLong type to uLong 2022-12-06 11:55:46 -06:00
Evan Hahn
3c9d0c14ad Document CRC32 2022-12-06 11:55:46 -06:00
Evan Hahn
8dfa4bbc27 Move CRC32 to its own file
This mechanical change should have no user impact. It prepares us for
future changes.
2022-12-06 11:55:46 -06:00
Sasha Weiss
67143d376d Add remote-config kill switch for all donation types and methods 2022-12-01 14:39:03 -08:00