Commit Graph

356 Commits

Author SHA1 Message Date
Sasha Weiss (Signal)
86d9b8ea0a
Remove args always passed as nil that were later unused anyway 2022-06-29 09:19:02 -07:00
Nora Trapp
7bd167f815
Initial story sending support
* Little fix for context menu

* Add 'My Stories' section to stories tab

* Add new story thread types

* Show stories in conversation picker

* Support for sending stories

* Update story list when sending stories

* Add basic 'My Stories' view controller

* Initial stories settings screens

* Consolidate TSPrivateStoryThread and TSMyStoryThread into one class

* Require an explicit read transaction to initialize an outgoing message

* Fix linting

* Allow enabling group story from internal settings

* Fix tests

* PR Feedback
2022-06-10 22:28:03 -04:00
Evan Hahn
5dbc030359 Fix violations of SwiftLint's closure_parameter_position rule
This commit should just change whitespace.

See [the docs for this rule][0].

[0]: https://realm.github.io/SwiftLint/closure_parameter_position.html
2022-06-06 13:58:23 +00:00
Evan Hahn
24ca5abf9c Remove unneeded breaks
This fixes our violations of [the SwiftLint `unneeded_break_in_switch`
rule][0].

[0]: https://realm.github.io/SwiftLint/unneeded_break_in_switch.html
2022-06-03 17:52:28 +00:00
Max Radermacher
2589f1e217
Remove GV2 rollout properties
* Remove manual groups v2 migration banner
* Remove “No UUID” subtitle when creating group
* Remove `areMigrationsBlocking`
* Remove `canManuallyMigrate`
* Remove `areManualMigrationsAggressive`
* Remove `canAutoMigrate`
* Remove `areAutoMigrationsAggressive`
2022-05-20 11:07:15 -07:00
Jordan Rose
4c8d7662a6 Add OWSIdentityManager.shouldSharePhoneNumber(with:transaction:)
When someone sends a message to your PNI, your responses (from your
ACI) must include a PNI signature, and the sealed sender certificate
you use during this period should include your phone number. This
confirms to the other user that your ACI is associated with your PNI.

This commit adds the state tracking that and ensures that both
TSOutgoingMessage and OWSUDManager check that state when building 1:1
messages and choosing certificates, respectively. Later commits will
set and clear this flag as needed.
2022-05-19 14:20:53 -07:00
Evan Hahn
29c0ddf60e Fix violations of SwiftLint's attributes rule
_I recommend reviewing this with whitespace changes disabled._

Most of these were `@objc` being on the same line, which I fixed with [a
silly script][1]—probably could've used `sed` if I were wiser. The rest
were manual fixes.

See [the SwiftLint documentation for this rule][0].

[0]: https://realm.github.io/SwiftLint/attributes.html
[1]: https://gist.github.com/EvanHahn-Signal/d353c93fa269c82b96baca0a1086521f
2022-05-14 09:07:42 -05:00
Max Radermacher
d4adfaff91
Fix protocol conformance warnings
There are some Swift-only features that are part of these protocols, so
they were split into Obj-C and Swift variants. However, the class itself
only reports conformance to the Swift variant, which leads to warnings
when using the class in Objective-C.
2022-05-09 11:44:05 -05:00
Michelle Linington
30cb1d5609 PR Feedback: Fix incorrect error case 2022-04-29 14:47:48 -07:00
Michelle Linington
b5c17b6c1c Improved handling of group bans 2022-04-29 14:47:48 -07:00
Igor Solomennikov
dc19eb835f Fix "the the" in comments. 2022-04-27 20:16:45 -07:00
Jordan Rose
bc222fdc86 Check all groups for an up-to-date profile key (at most once per week)
This is an expensive check, since it fetches the latest state of every
group we're in, but the cost of an out-of-date profile key is high.
2022-04-21 11:37:38 -07:00
Michelle Linington
84be44880e PR Feedback 2022-04-08 19:36:27 -07:00
Michelle Linington
988e6b8e14 Require transactions for the remainder of BlockingManager's interface 2022-04-08 19:01:43 -07:00
Nora Trapp
05313c3725 Update to LibSignalClient v0.15.0 2022-03-24 11:55:45 -07:00
Evan Hahn
de105468a4 Assume everyone is GV2-capable 2022-03-22 17:11:57 -05:00
Dimitris Apostolou
62724cf0be Fix typos 2022-03-18 11:31:06 -07:00
Michelle Linington
bd8e6ffedb Fixes an issue where group join requests aren't cancelled
Requesters are able to request to join a group by using data in the URL.
In order to cancel their request they need to use that data again. This
data wasn't being plumbed through.
2022-03-10 13:44:04 -08:00
Michelle Linington
b5264502b8 Present alert, avoid repeated fetching of expired links 2022-03-09 22:00:18 -08:00
Michelle Linington
c28e8b09b0 First pass at Group Link rejection
Several TODOs remain pending final server API and design
2022-03-09 22:00:18 -08:00
Jordan Rose
3742e5c329 Group updates: use an autoreleasepool for each group change processed
Helps avoid sawtooth-shaped memory usage when there are a lot of
changes to process, especially in a large group.
2022-02-10 10:35:29 -08:00
Nora Trapp
b2c0e975b6 Store group avatars on disk 2022-02-09 11:56:03 -08:00
Jordan Rose
bb0593fd62 Groups updates: adopt maxSupportedChangeEpoch and includeFirstState
The scaffolding for this has been there for a long time, but the
server side has only just been hooked up. This should save a lot of
traffic when processing a long group backlog, or a backlog for a large
group.
2022-02-08 15:06:24 -08:00
Jordan Rose
3873741dad Handle a group "change" that has only a snapshot (no actions)
The server will include this if the backlog of group updates *should*
have brought the group up to date, but the actual change action for
the latest revision is missing. This should never happen under normal
operation, but it's best to be defensive against data loss. (Or in
this case, new server features tested in upcoming commits.)
2022-02-08 14:24:05 -08:00
Jordan Rose
56701f7c11 Prefer recover to catch and explicit future.reject(error)
Collapses a nested promise structure to a top-level one without
changing functionality.
2022-02-04 09:32:01 -08:00
Jordan Rose
8a90831e04 GV2: Don't stringify the cache key for GV2 updates
The cache key is the group secret params data; stringifying it just
makes the cache slower.
2022-01-28 15:56:20 -08:00
Jordan Rose
fe5788a089 Process one page of group updates at a time
...instead of parsing them all from the server and *then* processing
them (85200228cf). This should keep from blowing out an arbitrary
amount of RAM in pathological cases.
2022-01-28 15:27:34 -08:00
Jordan Rose
85200228cf Handle paged group updates from storage service
Storage service won't serve more than a certain number of updates for
group logs at a time, returning 206 Partial Content if there are more
to process. Recursively process pages until we get a 200, then combine
all the parsed data into a single array for higher-level handling.
2022-01-27 14:56:04 -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
Jordan Rose
076a976961 Remove now-unnecessary 'version' parameters from HKDF calls
SignalClient used to support a non-standard version of HKDF as
"version 2" (numbered for an old version of the Signal protocol), and
the standard one as "version 3". Now only the standard version is
supported, so the parameter is unnecessary.
2022-01-25 17:00:17 -08:00
Jordan Rose
fc2d02ef99 Improve logging 2022-01-24 17:10:37 -08:00
Jordan Rose
904bb36d7f Turn group data caches back on in the NSE
Without the GroupV2Params caches, processing multiple large group
updates is extremely wasteful, decrypting the same profile keys and
UUIDs over and over again. The size of these caches has also been
*increased* to match the group size limit, or else there's no benefit
for large groups.

Other LRUCache instances are still off by default in the NSE by virtue
of the "NSE max" defaulting to 0.
2022-01-20 16:49:37 -08:00
Jordan Rose
0edd86f3f7 Improve cache keys for group member profiles, UUIDs, and blobs
When Data is put into an NSCache it gets converted to an NSData, which
is a CFData underneath. CFData's hash function only looks at a prefix
of the data, and the secret params were taking up a good chunk of that
prefix, leading to hash collisions. By putting more variable data
first, we get better hashes *and* exit memcmp faster in the case of a
collision.
2022-01-20 16:08:34 -08:00
Jordan Rose
58a688ad61 Lazily deserialize individual group changes
If there are several group changes being returned at once,
deserializing all of them up front can lead to excessive memory use,
especially for very large groups. This commit switches to
deserializing each change as it is used, which doubles the amount of
CPU work (because we loop through the changes twice) in exchange for
only ever having one Change object graph in memory at a time. It does
also mean we can get a protobuf deserialization error a bit later in
the process if the data is ever corrupted, but that shouldn't cause
additional issues at these particular call sites.
2022-01-20 12:00:50 -08:00
Nora Trapp
db115606e3 Remove ZKGroup 2022-01-03 12:00:19 -08:00
Matthew Chen
cfb5db5812 Discard profile key credentials and temporal credentials when we re-register. 2021-11-19 14:28:27 -03:00
Matthew Chen
6009408e83 Improve profile handling. 2021-11-17 14:49:47 -03:00
Eugene Bistolas
64f126ae3f [Badging] Badge receipt credential fetch and redemption 2021-11-09 14:26:05 -08:00
Michelle Linington
77b7ea5c40 Fix a whole bunch of warnings 2021-10-21 21:11:26 -07:00
Matthew Chen
1b655d63f5 Reduce async work done on NSE launch. 2021-10-21 08:53:15 -03:00
Matthew Chen
f9b0b32720 Clean up HTTP error metadata accessors. 2021-10-15 11:52:31 -03:00
Matthew Chen
d402636225 Simplify AFNetworking usage. 2021-10-15 10:50:35 -03:00
Nora Trapp
2814ab7629 Convert to new Promise library 2021-09-03 11:41:34 -07:00
Matthew Chen
6c30515c00 Fix over-zealous asserts. 2021-08-26 14:53:24 -03:00
Matthew Chen
647f723610 Add OWSStaticOutgoingMessage. 2021-08-25 22:43:42 -03:00
Matthew Chen
c184139478 Clean up remote config and feature flags. 2021-08-24 20:39:26 -03:00
Matthew Chen
4682248117 Clean up ahead of PR. 2021-08-18 14:26:18 -03:00
Matthew Chen
67d9eeab5b Clean up ahead of PR. 2021-08-18 14:26:18 -03:00
Matthew Chen
89d8f92fbb Clean up ahead of PR. 2021-08-18 14:25:39 -03:00
Matthew Chen
6b7aafd6fd Clean up ahead of PR. 2021-08-18 14:25:39 -03:00