Commit Graph

8089 Commits

Author SHA1 Message Date
Evan Hahn
b5e64e9fce Speed up link preview search code
Previously, we collected all URL matches and then searched through them.
Now, we search lazily, which should improve performance.

I added a perf test that repeats a URL a million times. The new code
finishes in ~0.001 seconds on my machine. The old code does not finish.
2022-10-04 14:09:00 -07:00
Evan Hahn
a066511a62 Remove useless test setup/teardown
We had a lot of functions like this, which are useless:

    override func setUp() {
        super.setUp()
    }

This removes them.
2022-10-04 14:06:34 -07:00
Sasha Weiss
814f6c1bf2
Skip inactive experience IDs, and opportunistically clear unknown ones 2022-10-04 12:22:24 -07:00
Sasha Weiss
7fb1da0cec
Migrate ExperienceUpgrade models to SDSCodableModel 2022-10-04 08:52:03 -07:00
Nora Trapp
49ed068fcd Allow sharing text to stories 2022-10-03 21:35:32 -07:00
Nora Trapp
5f3b5e841c Delete stories sent to a private list when it's deleted 2022-10-03 21:35:32 -07:00
Nora Trapp
6eca0a0ef2 Remotely delete all sent stories when deactivating stories 2022-10-03 21:35:32 -07:00
Harry
4100ee177b
Fix story video flickering due to excessive StoryItemMediaView recreation.
* Fix story video flickering due to excessive StoryItemMediaView recreation.

* remove debug assert if no attacgment found on dismiss, only affects debug builds but can happen if deleting while in the viewer

* fix text color for replies button on iOS 13

* pr feedback

* always set caption even if nil
2022-10-03 21:26:50 -07:00
Harry
74228f424e
Add StoryContextAssociatedData to compute story tab badge count without hidden stories
* Add StoryContextAssociatedData and db migrations

* Remove hideStory from ThreadAssociatedData

* Remove lastViewedStoryTimestamp and lastReceivedStoryTimestamp from TSThread

* drop deprecated columns in db migration

* add indexes

* dump schema.sql

* Update unviewed stories SQL query

* fix thread fetching for incoming story messages

* reload story tab badge when StoryContextAssociatedData changes

* Add test for TSGroupModel backwards-compatible deserialization

* move db migration

* Only use StoryContextAssociatedData for story badge count

* update StoryContextAssociatedData lastReceivedTime when a story message is deleted

* catch group threads for outgoing story messages too

* clean up sql query

* Only update lastReceievedStoryTimestamp for remote deletions

* add latestUnexpiredTimestamp to StoryContextAssociatedData
2022-10-03 21:16:01 -07:00
Evan Hahn
4a0141be41
Omit E164 from outgoing envelopes
[Android][0] and [Desktop][1] have already removed this field. This
follows suit.

The highlights:

- `SignalService.proto` removes some fields by making them `reserved`
- `ProtoWrappers.py` updates our code generation to support addresses
  that only have a UUID (previously, you needed both a UUID and E164
  field)
- Most everything else is removing E164s

[0]: 9c266e7995
[1]: 2b0d3cab40
2022-10-03 23:55:39 +00:00
Harry
e7b8f098dd
Increase story video max length to 30.999 seconds for android compatibility 2022-10-03 11:44:49 -07:00
Nora Trapp
55aea652ee Make sure we create a contact thread for any received private story 2022-09-29 16:48:39 -07:00
Max Radermacher
02ca8e2a99
Include http headers on web socket connections
Once initialized, a URLSession’s configuration can’t be changed. In
order to transfer the headers, assign them to the configuration before
assigning the configuration to the session.
2022-09-29 16:36:42 -07:00
Max Radermacher
0db3fb8106 Remove unsupported localizations
Also, clean up “Known Regions” in Xcode.
2022-09-29 16:13:06 -07:00
Nora Trapp
b962b752cb Don't auto-migrate groups on app launch 2022-09-29 09:35:00 -07:00
Nora Trapp
6930ffe2fa Remove old group capabilities 2022-09-29 09:35:00 -07:00
Nora Trapp
dd37ca526d Allow NSE to manage lifetime of proxy relay server 2022-09-27 17:05:05 -07:00
Sasha Weiss
063acc1419
Batch messageId notification cancellations 2022-09-27 14:26:44 -07:00
Evan Hahn
4de8ffa6af
Remove dead accessor from legacy message type
This change should have no user impact.

`TSInvalidIdentityKeyReceivingErrorMessage` had an unused method,
`theirSignalId`. This removes it.

`git grep -i theirSignalId` returns no results after this change.

I think this is a useful change on its own, but will also be useful in
an upcoming change.
2022-09-27 16:05:59 -05:00
Evan Hahn
e2f7ee47f4
Remove unused methods from message processing test
`MessageProcessingIntegrationTest` has some unused methods. These were
added in ec66f3b21e. According to George,
they're no longer needed and may have been added mistakenly.
2022-09-27 11:49:29 -07:00
Evan Hahn
653cb30a59 Use reserved in protobufs
_This change should have no user impact._ And you can see that the only
changes to generated files are in comments.

Before this change, we used comments to denote reserved or deprecated
fields. This works, but I think we should instead use the `reserved`
keyword, which offers a few advantages. From [the protobuf docs][0]:

> If you update a message type by entirely removing a field, or
> commenting it out, future users can reuse the field number when making
> their own updates to the type. This can cause severe issues if they
> later load old versions of the same .proto, including data corruption,
> privacy bugs, and so on. One way to make sure this doesn't happen is
> to specify that the field numbers (and/or names, which can also cause
> issues for JSON serialization) of your deleted fields are reserved.
> The protocol buffer compiler will complain if any future users try to
> use these field identifiers.

This updates our proto files to use `reserved` instead of comments. It
also adds support to our wrapper script. (I moved a few things around in
that script, too, for consistency.)

I think this is a useful change on its own, but I think it'll make
things a little better when we deprecate some fields, which we're
planning to do soon.

[0]: https://developers.google.com/protocol-buffers/docs/proto3#reserved
2022-09-27 18:45:38 +00:00
Harry
da06c1357c
Show my story privacy settings the first time you send to my story
* Add first send story privacy field to AccountRecord proto

* Store hasSetMyStoriesPrivacyKey on StoryManager

* sync hasSetMyStoriesPrivacy state

* Reuse MyStorySettingsViewController in a sheet view controller

* Show my story privacy settings from conversation picker if unset when selecting my story destination

* reload my story row to change subtitle

* pr feedback
2022-09-27 10:06:01 -07:00
Sasha Weiss
ac97aeba92
Migrate to using ExpiredProfileKeyCredentials 2022-09-26 14:33:57 -07:00
Nora Trapp
5e277b6eb4 Reduce logging 2022-09-26 13:48:00 -07:00
Nora Trapp
323bbb5a4b Add some doc comments and make restart clearer 2022-09-26 13:48:00 -07:00
Nora Trapp
9d021f50fe Allow specifying a port for a proxy to connect to 2022-09-26 13:48:00 -07:00
Nora Trapp
fb31679cc7 Validate proxy address and that we can connect to it 2022-09-26 13:48:00 -07:00
Evan Hahn
7a357a9cd3 Harden isValidProxyLink against strange URLs 2022-09-26 13:48:00 -07:00
Nora Trapp
e05a19d962 Handle backgrounding in relay server 2022-09-26 13:48:00 -07:00
Nora Trapp
8d1e038611 Fix bug with link previews 2022-09-26 13:48:00 -07:00
Nora Trapp
e5e9e544b3 Add UI for configuring proxy connection 2022-09-26 13:48:00 -07:00
Nora Trapp
286a930a79 Add support the Signal TLS Proxy 2022-09-26 13:48:00 -07:00
Max Radermacher
084a2b2274 Fix crash when toggling censorship circumvention
Changing the setting updates whether or not it’s enabled, which resulted
in a lock being re-entrantly acquired to check the current value.
2022-09-26 11:40:38 -07:00
Max Radermacher
85d8749048 Don’t check isNSE in LocalDevice.memoryUsageString
This can get called asynchronously during tests, and that can lead to
flakiness if we’re between two tests. There doesn’t seem to be a
compelling reason to only distinguish critical errors from warnings in
the NSE, so distinguish the two types everywhere.
2022-09-26 11:39:29 -07:00
Evan Hahn
0d059d1319
Clean up code for a debug flag
_This change should have no user impact._

This flag had a condition that would always evaluate to `false`. This PR
fixes that, and adds a comment about why it's a little verbose.
2022-09-26 10:20:36 -05:00
Evan Hahn
28e988c4a1 Remove unused thread method
This was added in a0df56a68e but never
used.
2022-09-23 15:39:54 -07:00
Sasha Weiss
9c74e8dfcd
Serialize canceling notifications with posting them 2022-09-23 13:48:05 -07:00
Evan Hahn
4da042c1d5
Clean up database corruption storage code
_This change should have no user impact._

The database corruption flag lives on `UserDefaults`. Currently, this
flag is controlled through `SSKPreferences`, but I kinda think that's
the wrong place—database corruption isn't really a user preference.

This moves it into its own file, tests it, and [drops booleans in favor
of an enum][0]. I think this is useful on its own, but also prepares us
for an upcoming change.

[0]: https://www.luu.io/posts/dont-use-booleans
2022-09-23 18:19:02 +00:00
Harry Sanabria
ad65ef501f Add lastReceivedStoryTimestamp to schema.sql 2022-09-22 17:05:06 -07:00
Sasha Weiss
121161e212
Clear StoryMessage instances when clearing all chat history 2022-09-22 15:22:52 -07:00
Nora Trapp
96d8abac67 PR Feedback 2022-09-22 14:53:29 -07:00
Nora Trapp
7553745603 Enable story sending to groups from sync message 2022-09-22 14:53:29 -07:00
Nora Trapp
1d5d14ac65 Record 'lastSentStoryTimestamp' when story sent sync is received 2022-09-22 14:53:29 -07:00
Nora Trapp
c8dc629351 Show active group stories in the conversation picker 2022-09-22 14:53:29 -07:00
Evan Hahn
c5b4f67613 Swiftify contact thread tests
_This change should have no user impact._

A very mechanical change. No surprises.
2022-09-22 14:41:59 -07:00
Evan Hahn
11c2cf0813
Add basic test for database migration
_This change should have no user impact._

This adds a basic test for database migration, and makes the necessary
changes to make that possible.
2022-09-22 17:24:40 +00:00
Evan Hahn
3cf796e55c
Add utility for remaining disk space 2022-09-22 09:28:42 -07:00
Igor Solomennikov
094fa0f30d
Allow attaching links to text stories with "Generate Link Previews" setting being OFF. 2022-09-21 14:55:49 -07:00
Max Radermacher
88bc6e43d8 Refactor encodeE164s
- Remove duplicate check for a `+` at the beginning of each value.

- Don’t return a big-endian UInt64 from a method. The type information
  (unfortunately) doesn’t include endianness, which makes that approach
  somewhat more error-prone.

- Add a type that tracks validated input/output pairs. Future changes
  will want to perform the validation and then use both input & output.
2022-09-21 12:47:29 -07:00
Max Radermacher
3fdaf367e1
Consolidate Int <-> Data logic 2022-09-21 12:08:45 -07:00