Commit Graph

79 Commits

Author SHA1 Message Date
Matthew Chen
02fbe33779 Payments: SSK Business Logic 2021-04-06 13:57:06 -03:00
Matthew Chen
86b8eb08b8 Remove YapDatabase.
Apply asset from design.

Fix rebase breakage.
2021-03-25 11:41:16 -03:00
Matthew Chen
af1e1d0eb3 Rework dependency access. 2021-03-25 09:24:27 -03:00
Nora Trapp
ec1a1bb9ae Simplify MessageProcessing promises 2021-02-23 10:45:50 -08:00
Nora Trapp
3669066e42 Begone OWSBatchMessageProcessor 2021-02-23 10:45:50 -08:00
Nora Trapp
91d2953843 Begone OWSMessageReceiver 2021-02-23 10:45:50 -08:00
Nora Trapp
4b2be0b8fa Get rid of obsolte SSKMessageDecryptJobQueue 2021-02-23 10:45:50 -08:00
Nora Trapp
3991802fa8 Add appropriate restrictions to when message processing can run. 2021-02-23 10:45:50 -08:00
Matthew Chen
686aee752c Rename OWSMessageSender -> MessageSender. 2020-09-17 21:35:35 -03:00
Nora Trapp
1307d7bfd9 Merge branch 'release/3.16.0' 2020-09-02 17:00:36 -07:00
Nora Trapp
5187738c3d Conversation Pinning 2020-09-02 14:13:05 -07:00
Matthew Chen
9aa17e833b Remote deprecation. 2020-09-02 16:51:58 -03:00
Nora Trapp
3d4efccbf3 Fix caches that weren't re-warmed after transfer 2020-09-02 11:30:49 -07:00
Michelle Linington
a660a81d0f IOS-668: Reorganize how ContactsUpdater interacts with CDS operations
- Removes ContactsUpdater singleton. It wasn't really tracking much
  state anyway
- Introduces ContactDiscoveryTask. This creates a
  ContactDiscoveryOperation (modern or legacy) and updates the
  SignalRecipients database on completion. Returns a promise.
- Begin migrating away from operation queues

PromiseKit is weird about priority propogation, so this shouldn't be
used yet. Since all then closures are asynced, priorities don't
propogate down to underlying queues. This means the a
ContactDiscoveryTask on the main queue will not boost the priority on
the ModernContactDiscoverOperation's owned operation queue
2020-08-06 12:55:32 -07:00
Nora Trapp
222a0308de Warm the SingalServiceAddressCache earlier 2020-08-04 19:56:42 -07:00
Michelle Linington
e3e903a8ad IOS-631: Suppress message processing pipeline while we have a pending backfill operation
Creates a new root singleton: OWSMessagePipelineSupervisor

As of right now, this singleton has two responsibilities:
- Track all message processing pipeline stages that have registered
  themselves
- Post processing suspension updates to interested stages

Four classes will now register themselves as pipeline stages:
- OWSMessageContentQueue
- YAPDBMessageDecryptQueue
- IncomingGroupsV2MessageQueue
- SSKMessageDecryptJobQueue

At initialization, OWSMessagePipelineSupervisor will take out a pipeline
suspension while it waits for a UUIDBackfillTask to complete. Other
interested objects are also able to suspend the message processing
pipeline by invoking suspendMessageProcessing(for:) on the supervisor
(though, currently this is not used by anything except tests)

This also adds some supporting improvements to UnfairLock. Now,
UnfairLock closures will return the value returned from its critical
section closure.
2020-07-22 21:10:27 -07:00
Michelle Linington
16583ceafa Additional review feedback:
- Removed static UUIDBackfillTask initializer and removed the
  registration from AppDelegate. Kicking off the task will be handled
  with IOS-631.
- Moved the async perform work to its own function
- Some minor syntactic changes
- Updated database fetch to retrieve empty string UUIDs
- Handles non-e164 numbers fetched from database
- Leverages the MockSSKEnvironment to deal with the shared
  SignalServiceAddressCache. Removes added test support.
- Add tests to exercise new functionality
2020-07-13 18:20:47 -07:00
Matthew Chen
42d9439d7c Add remote config flags around versioned profiles. 2020-06-25 19:07:39 -03:00
Matthew Chen
c49a977d3e Merge branch 'release/3.10.3' into release/3.11.0 2020-06-07 15:01:54 -03:00
Nora Trapp
ad64727ecc Evacuate early message cache after memory warning 2020-06-07 10:05:07 -07:00
Matthew Chen
28ff9ac453 Rework model read caches. 2020-06-06 17:37:30 -03:00
Matthew Chen
a0eb61535a Bulk UUID lookup. 2020-04-15 17:11:29 -03:00
Matthew Chen
c38929dae5 Avoid rate limits while doing profile fetches. 2020-04-15 17:03:33 -03:00
Matthew Chen
a4d802a2a2 Avoid rate limits while doing profile fetches. 2020-04-15 17:03:33 -03:00
Michael Kirk
f198d9037d Merge tag '3.5.0.5' 2020-02-19 19:26:05 -07:00
Michael Kirk
2bed5d0cc3 persist pending read receipts 2020-02-16 13:13:12 -07:00
Michael Kirk
17a807093c remote config 2020-01-30 20:10:35 -08:00
Nora Trapp
88ac10de05 Notification Service Extension
The NSE should only run on iOS 13.3 or later where the "filtering" entitlement
is available since our notifications don't contain any content and will often
not trigger any user visible content. We control this by setting the deployment
target to iOS 13.3.

This does not handle calls as it's currently impossible to wake the main app or
launch CallKit from within the NSE. Should we reach a point where we need to use
this extension in production the service will need to be able to differentiate
between call and non-call messages and deliver them as VOIP or Vanilla pushes as
appropriate. Alternatively, Apple may introduce some way for us to signal the
main app that a call message has been received.

This does not currently address the potential for the NSE and the main app to be
running and trying to process messages at the same time. As long as the
websocket is connected and the main app is processing messages in a timely
fashion the NSE will never be called since the service will not send pushes for
these messages, but censorship circumvention users and users where the websocket
is disconnected for some reason will legitimately receive pushes and we will
want to process those messages. How we will handle these cases requires further
thought since just terminating the NSE when the app launches is not sufficient.
We could potentially do something like terminate the NSE everytime the main app
runs the message fetcher job which should only happen if either the user
pulls-to-refresh on the conversation list or the websocket is actively connected
and receiving messsages. I plan to address this in a follow-up pull request.

Currently this code will not ever be run since the service never sends vanilla
push notifications. Eventually we will need to add logic into the main app to:
a) detect we're on iOS 13.3 or later and b) update a flag on the service telling
it to stop using VOIP pushes for non-call messages. The API for requesting this
from the service does not yet exist.
2020-01-30 11:44:41 -08:00
Matthew Chen
8abc3219c0 Rework v2 group updates. 2020-01-29 13:42:27 -03:00
Matthew Chen
91ee0832f5 Rework v2 group updates. 2020-01-29 13:42:27 -03:00
Matthew Chen
bcfba85356 Add message processing class.
* Modify message processing to allow observation of websocket queue being drained.
* Extend MessageProcessing to allow observation of REST message fetching and "all message fetching and processing".
2020-01-27 10:42:03 -03:00
Michael Kirk
25a3635f2d remote config 2020-01-23 11:40:04 -07:00
Matthew Chen
892ce5c135 Rework message processing to handle groups v2. 2020-01-17 17:34:37 -03:00
Matthew Chen
72f912dce3 Versioned profile changes, etc. 2020-01-08 13:54:54 -03:00
Matthew Chen
29150102cb Revert group and profile changes. 2019-12-11 20:41:54 -08:00
Matthew Chen
3d88f68cfb Rework new group new creation & group updates. 2019-12-04 15:40:54 -03:00
Nora Trapp
35cd3a4d64 Allow conforming to sync manager stuff in Swift 2019-11-19 18:07:51 -08:00
Nora Trapp
fbdafc6bd5 Store KBS keys in the database instead of the keychain 2019-11-13 10:48:36 -03:00
Matthew Chen
68f7b13cb8 Cache frequently-used prefs. 2019-11-04 14:26:31 -03:00
Michael Kirk
75aa02cef9 Fix assumption that DB always exists with initial schema
It won't exist until we run the first migration.
2019-10-11 10:50:21 -07:00
Matthew Chen
79b1d31f20 Don't load YDB unless necessary.
Don't load YDB unless necessary.

Don't load YDB unless necessary.

Don't load YDB unless necessary.
2019-08-26 13:18:30 -03:00
Matthew Chen
964fbeed0b Only register YDB extensions if we're using YDB. 2019-08-21 10:41:54 -03:00
Michael Kirk
b322d1a119 Merge tag '2.42.0.5' 2019-08-13 19:56:57 -06:00
Michael Kirk
bee54d1aea fixup compiler warnings 2019-08-13 16:58:06 -03:00
Matthew Chen
2a5683b843 Introduce storage coordinator. 2019-08-13 16:52:38 -03:00
Nora Trapp
fd8a330c81 Create a new manifest when our encryption keys change 2019-08-01 10:40:17 -07:00
Nora Trapp
dae0cdef7f Add StorageServiceManager 2019-07-31 23:34:04 -07:00
Nora Trapp
1fab5c7560 Fix tests 2019-07-16 13:02:27 -07:00
Nora Trapp
3c33f276f7 Maintain a SignalServiceAddress cache to allow for isEqual implementation 2019-07-10 13:27:36 -07:00
Michael Kirk
e370848f08 Integration test for message processing.
Tests from `receivedEnvelopeData`, which is called by e.g. the websocket or the
messageFetcherJob through the message processing pipeline until the UIDatabase
is notified with the new message and thread.

Includes some test helpers to initialize sessions and encrypt/decrypt messages.
2019-06-24 10:19:46 -06:00