Commit Graph

7976 Commits

Author SHA1 Message Date
Jordan Rose
5cffe49cd2 CallKitIdStore: traffic in threads rather than addresses
This will be the interface used for storing IDs of group calls in the
future; for now there should be no functionality change, except if
there's an address mentioned with no associated thread. Previously
that thread would be created if needed; now the call action will fail.
This seems reasonable given that threads only go away if the user
explicitly deletes them.

While here, we don't need to save both the UUID and phone number of a
user's address; the UUID always wins anyway. Only worry about phone
numbers if there's no UUID.
2022-09-01 16:07:29 -07:00
Harry
d955e68468
Disable flaky SystemStoryManagerTest case 2022-09-01 13:56:31 -07:00
Evan Hahn
03dd818cdb
"Add to Another Group": show archived groups, order by recency
Previously, archived groups didn't show up in the "Add to Another Group"
view. Now, they do!

This also orders groups entirely by recency.

This view used `ThreadViewHelper`, which (1) omitted archived groups
(2) had a bunch of dormant database observation code. I removed this
class and replaced it with some inline code that fetches groups.
2022-09-01 08:41:42 -05:00
Nora Trapp
09598d2e7a Add remote flag for stories 2022-08-31 13:34:24 -07:00
Nora Trapp
0b86fc3d0a Fix regression that broke syncing of story viewed state 2022-08-31 13:00:54 -07:00
Harry
8206766336
Up timeout for SystemStoryManagerTest for slow CI 2022-08-31 12:27:09 -07:00
Evan Hahn
787a688b08 Rewrite PhoneNumber.tryParsePhoneNumber tests
This change should have no user impact.

This commit:

- Rewrites the tests in Swift
- Removes some redundant tests
- For North American phone numbers, uses `555-01XX` phone numbers
  (because "only 555-0100 through 555-0199 are now specifically reserved
  for fictional use; the other numbers have been reserved for actual
  assignment)
2022-08-31 00:36:06 +00:00
Evan Hahn
a6b395b11f Remove long-skipped phone number tests for Mexico
This change should have no user impact.

This removes a test that's been skipped since 2020 (see
5c976b0acd). I think this is okay given
that (1) we've skipped it for over 2 years (2) [we already have some
tests for Mexican phone numbers][0].

[0]: 895c1b7576/SignalServiceKit/tests/Contacts/PhoneNumberTest.swift (L10-L25)
2022-08-30 16:46:37 -07:00
Harry
b9dd5cb63c
Use final avatar for system author (onboarding story)
* Use final avatar for system author (onboarding story)

* remove onboarding story feature flag
2022-08-30 16:45:37 -07:00
Harry
7ee39eef63
Add SystemStoryManager
* Add OnboardingStoryManager

* mark onboarding story viewed

* Add tests and fix issues that came up from testing

* up test timeout for slower CI

* rename SystemStoryManager and put into dependency injecton container

* Use viewed state on StoryMessage itself. Have SystemStoryManager observe app lifecyle events to automatically manage the onboarding story

* use iOS assets which are now in s3

* todo cleanup

* increment timestamp for uniqueness

* pr comments

* change literal delimiter

* Add ChainedPromise utility, tests, and use in SystemStoryManager

* discretionarily observe app backgrounding in SystemStoryManager

* renaming from PR comments
2022-08-30 14:49:59 -07:00
Jordan Rose
8a83a04866 SenderKeyStore: Handle cross-process updates
Otherwise the main app can fail to find a new chain key even though
the NSE has already processed the appropriate SKDM, or vice versa.
2022-08-30 12:50:05 -07:00
Jordan Rose
73fdd49d9a Use conversation state to decide if the user can ring a group at first
- Refactor the enum RingMode into an option set RingRestrictions
- Keep track of whether the call is empty in RingRestrictions rather
  than by directly inspecting peek info every time
- Set the initial callInProgress restriction by looking for unended
  calls in the database (the same thing used to show the "Join Call"
  button in the conversation view)
- Use the more-reliable callInProgress restriction everywhere we need
  to check if there's a call in progress
- If we think there's a call in progress but don't have peek info,
  wait until we get peek info to show status text in the call lobby

This provides a more orthogonal model for ring restrictions, which is
important for tracking "group too large" and "call in progress"
independently. Either can change but the state of the other still
determines how the UI should be updated.
2022-08-29 13:35:27 -07:00
Max Radermacher
7e8bf3a6d4 Update KBS MrEnclave
TEST CASES:

Restoring from the old enclave:
- Register on the old code.
- Delete the app.
- Register with the new code, restoring with a PIN.

Migrating to the new enclave & restoring:
- Register on the old code.
- Update and run the new code.
- Delete the app.
- Register with the new code, restoring with a PIN.

Registering a new account:
- Register with the new code, setting up a brand new account.

Registration lock via the old enclave:
- Register on the old code (#1) & enable registration lock.
- Delete the app.
- Register on the new code (#2).
- Run change number (#2 -> #1) on the new code.
- Confirm both enclaves were checked.

Registration lock via the new enclave:
- Register on the new code (#1) & enable registration lock.
- Delete the app.
- Register on the new code (#2).
- Run change number (#2 -> #1) on the new code.
- Confirm only the new enclave was checked.
2022-08-29 09:12:35 -07:00
Evan Hahn
4fc5d75793 Update libPhoneNumber-iOS
This updates our libPhoneNumber dependency. See [the libPhoneNumber-iOS
commit][0].

According to [the upstream libphonenumber release notes][1], they
updated the formatting for +49 numbers. That caused a test to break, so
I updated it (and tested a few additional dialing codes).

[0]: 8b6f552682
[1]: 90503ecef3/release_notes.txt (L21)
2022-08-28 15:31:06 +00:00
Igor Solomennikov
981382ab65
Add explicit public initializer for TextAttachment.Background.Gradient struct.
This would allow initializing TextAttachment.Background.Gradient outside
of SignalServiceKit module.
2022-08-26 20:58:30 -07:00
Max Radermacher
74c0bd93a7 Properly specify isComplete on contact syncs 2022-08-26 14:42:57 -07:00
Max Radermacher
fdc8633ab0 Remove ConversationConfigurationSyncOperation
It’s unused (except in debug code) since 8c0196077f.
2022-08-26 14:42:57 -07:00
Sasha Weiss
569cdb2aad
Durable jobs for leaving groups 2022-08-26 13:13:23 -07:00
Evan Hahn
5a0f836f0d Use "timestamp" instead of "timeStamp"
This change should have no user impact.

We use "timestamp", all lowercase, in most of the codebase. This makes
it consistent.
2022-08-26 14:17:12 -05:00
Harry
41211e0102
Add system author for Story messages
* make StoryMessage author an enum and handle at all usage sites

* add system story case to story context; don't show replies for system stories

* [tentative] add system avatar image

* clean up context creation and other odds and ends

* fix merge conflicts

* pre-PR cleanup

* add avatar asset TODO

* pr comments

* remove StoryAuthor enum, pass around author UUID instead with extension for checking if it is the signal system author uuid

* pr comments
2022-08-26 11:46:48 -07:00
Max Radermacher
6955b6f53a Revert tapping names in group system messages
- Revert "More flexible selection styling in CVTextLabel"
  (commit e1317d814c)

- Revert "Show the MemberActionSheet for tapped names in group system messages"
  (commit 48bc3c07d0)
2022-08-26 11:43:58 -07:00
Sasha Weiss
11e2729c49
Auto-leave groups when added by a blocked contact 2022-08-25 16:20:15 -07:00
Sasha Weiss
48bc3c07d0
Show the MemberActionSheet for tapped names in group system messages 2022-08-25 13:03:38 -07:00
Sasha Weiss
24d3d0e68d
Remove requiredRevision arg from updateExistingGroupOnService, and make it private 2022-08-25 12:41:55 -07:00
Sasha Weiss
56b9b2c139
Wait for group updates before doing profile key updates 2022-08-25 11:54:01 -07:00
Max Radermacher
5449a4de9b Remove unused code from MockSSKEnvironment
As of 86b8eb08b8, the database initialization no longer has
asychronous components. The current code returns an already-resolved
promise in all situations, so remove the asynchronous infra entirely.
2022-08-25 09:53:08 -07:00
Evan Hahn
92ef1610fc Actually run OutgoingGroupUpdateMessageTest
I added these tests in da322d3bf9 but
didn't actually add them to the project! This adds them and runs them.
2022-08-25 11:14:49 -05:00
Evan Hahn
f997e5c7a4 Remove some tests that were never run
I added these tests in da322d3bf9, but we
decided that they're not worth it.

Also, it seems I forgot to add them to the project! So they were never
run anyway, outside of the times I ran them while developing.
2022-08-25 11:14:43 -05:00
sashaweiss-signal
efc697af23 Re-order lines in test harness to avoid a race condition 2022-08-24 16:21:13 -07:00
Harry
63661ba4c8
Add feature flag for system onboarding story
* Add feature flag for system onboarding story

* switch to dev
2022-08-24 14:51:06 -07:00
Harry
33e26b6c4c
Migrate OWSSignalService from objc to swift, and split it into a protocol and implementation
* Split OWSSignalService into a swift protocol and implementation, migrated from objc

* Put OWSSignalService under SSKEnvironment and use mock in mock environment

* Rename from basename + impl to protocol + basename

* extend mock functionality a bit

* pr feedback
2022-08-24 14:36:52 -07:00
Max Radermacher
0f749fdb06 Update CDS MrEnclave
Tested lookups with a contact that exists and one that doesn’t.
2022-08-24 13:58:21 -07:00
Harry
2950667ac9
Split OWSURLSession into a protocol and implementation
* Split OWSURLSession into a protocol and implementation

* Add OWSURLSessionMock

* Rename from basename + impl to protocol + basename

* add simple init for mock session

* nits from pr comments

* pr comments 2
2022-08-24 13:33:27 -07:00
Max Radermacher
91008dd29e Fix indentation in SDSKeyValueStore 2022-08-24 12:17:05 -07:00
Jordan Rose
50e8ef7ed8 Extract TSGroupThread.sortedGroupMembers(...) from FullTextSearcher
This will be used for deterministically listing group members in the
group call lobby, hence some customization that FullTextSearcher
doesn't need.
2022-08-24 12:15:48 -07:00
george-signal
87533d2b67
Improve phone number parsing.
* Improve phone number parsing.

Previously, if you entered a phone number
including a country code during registration you'd
have a duplicate country code. Signal on Android
did not have this bug because it uses a different
API inlibphonenumber. This diff changes iPhone to
use the same API, which is smart enough to remove
the country code from the phone number the user
entered if needed.

Co-authored-by: Evan Hahn <evanhahn@signal.org>
2022-08-23 11:56:06 -07:00
Jordan Rose
11cf13a255 Avoid intermediate copies when using dictionary keys as collections
The non-lazy map and filter always make a new array or dictionary,
which is often consumed immediately into a Set. Using `lazy` avoids
that intermediate allocation, as well as the need to loop over the
array or dictionary a second time.

This is a micro-optimization, but several of these accessors are
accessed fairly frequently, so we might as well make them faster.
2022-08-23 10:42:11 -07:00
Max Radermacher
4e4b9ec9fd Remove unused code for creating a new group
All call sites use the `avatarData` parameter, not `avatarImage`.
2022-08-22 17:19:50 -07:00
Adam Mork
aac2f37150
[Payments] Update the MobileCoin dependency to the latest 1.2.2 release
* update MobileCoin to release v1.2.x, add new 1.2.x testNet enclave
values, migrate deprecated function calls to new alternatives.

* Add new top-level error to convertMCError

use staging for now

* Add mainnet enclave values, revert production/staging environment change from testing. Add comment about libmobilecoin static libraries needing to be built on signal build machine.

* add 2.x series enclave measurements

* Add intel hardening advisory for the new 2.x series of enclaves. This hardening advisory being added has no effect on the 1.2.x enclaves, but is required for the 2.x enclaves.

* Remove commented enclave measurements, change Logger.error to Logger.warn (some failed requests is expected for long-living connections), Add in new testNet enclave measurements

* Update to LibMobileCoin v1.2.2

Co-authored-by: Nora Trapp <nora@signal.org>
2022-08-22 13:08:40 -07:00
Max Radermacher
686f99f039 Fix ContactDiscoveryOperationTest
Make `encodeE164s` a static method since it doesn’t need to access any
details from the operation instance.

Also move the test to SignalServiceKitTests.
2022-08-22 09:11:42 -07:00
Nora Trapp
89076ed822 Fix stories tab badging 2022-08-20 15:01:03 -07:00
Nora Trapp
b4c9aa8e64 Fix linting 2022-08-19 14:25:28 -07:00
Nora Trapp
43b010d9be Allow TSOutgoingMessage to build its own transcript, that subclasses can override 2022-08-19 14:23:59 -07:00
Nora Trapp
73e5d939bd future proof story receivedState storage 2022-08-19 14:23:59 -07:00
Nora Trapp
f340250194 Support remote delete of stories 2022-08-19 14:23:59 -07:00
Evan Hahn
48c3c08c10 Fix vertical_parameter_alignment SwiftLint violations
This fixes violations of [SwiftLint's `vertical_parameter_alignment`
rule][0]. This should have no user impact.

[0]: https://realm.github.io/SwiftLint/vertical_parameter_alignment.html
2022-08-18 10:37:09 -05:00
Evan Hahn
da322d3bf9 Add "urgent" boolean to outgoing messages
To improve message reliability, we're adding an urgency flag to outgoing
messages. For example, outgoing calls are urgent, but delivery receipts
are not. [Android][] and [Desktop][] have already done this work.

At a high level, I added an `isUrgent` property to `TSOutgoingMessage`s.
It defaults to `true`. Some subclasses, like
`OWSReceiptsForSenderMessage`, override it to return `false`.

Builds off of a few other commits (not necessary to understand this
commit, but might be useful for posterity):

- e858a0d916
- 8c6d2ebe8c
- 402b117221
- 2ba0cd764d
- 266a4663e9
- 8e5009bbf7

[Android]: dc04c8ed98
[Desktop]: 06190b1434
2022-08-18 07:35:41 -05:00
Jordan Rose
e76f81e934 Watch group membership changes in the group call lobby
...so we can enable and disable the ring button live. And do so
preserving the user's preferences in case they turn off ringing, then
someone joins the group and it goes over the limit, then someone
leaves the group and it's back under.
2022-08-17 17:59:19 -07:00
Jordan Rose
f434ca0419 Add an outgoing group ring button 2022-08-17 17:59:19 -07:00
Jordan Rose
9819c92464 Add groupRings and maxGroupRingSize to RemoteConfig 2022-08-17 17:59:19 -07:00