Commit Graph

72 Commits

Author SHA1 Message Date
Sasha Weiss
6ff76dd7e6
Do away with some ObjC test infra 2024-05-06 09:57:21 -07:00
Sasha Weiss
a25868491f
Make defaults in TSIncomingMessageBuilder explicit and complete 2024-05-02 15:56:02 -07:00
Max Radermacher
5482e63c3f
Handle phone number visibility in addresses 2024-02-14 18:51:45 -06:00
Max Radermacher
ded1d2f5b8
Assume everybody is PNI-capable 2024-02-13 14:53:39 -06:00
Max Radermacher
7939dab86b
Drop ignoreCache SignalServiceAddress parameter 2024-02-09 12:08:46 -06:00
Harry
11f7cd0464
Remove unused group update cases 2024-01-12 17:52:24 -08:00
Harry
ebab35b4ba
Put all necessary metadata on PersistableGroupUpdateItem, never rely on separate metadata 2024-01-12 05:46:20 -08:00
Harry
a149e83951
Update group join request approval handling to match other platforms 2024-01-09 10:04:12 -08:00
Sasha Weiss
ffcceff32e
Decouple inviteFriendsToNewlyCreatedGroup from wasJustCreatedByLocalUser 2024-01-08 10:20:37 -08:00
Harry
4ed83814e3
Use millisecond durations, not string values, for group dm updates 2024-01-03 06:31:45 -08:00
Harry
13b8b36377
Add group update case for other user removed by unknown user 2024-01-02 12:53:48 -08:00
Harry
4310f753f4
Use explicit group description in group description update info message 2024-01-02 12:53:11 -08:00
Sasha Weiss
9d713c655c
Add entrypoints to group update items building for various scenarios 2023-12-06 15:52:59 -08:00
Harry
aa0e250cb7
[Death to TSAccountManager, long live TSAccountManager][9] Migrate usages of old TSAccountManager to new 2023-10-05 08:56:08 -07:00
Pete Walters
adecf4a45f
Update delete send time window 2023-09-22 09:20:18 -05:00
Max Radermacher
da3ae3edc2
Don’t put messages sent to PNIs in the MSL 2023-09-08 00:32:51 -05:00
Max Radermacher
d634c65f2e
Swiftify receipt handling code 2023-09-05 15:21:06 -05:00
Max Radermacher
434317cb02
Swiftify & protocolize OWSIdentityManager 2023-08-29 10:28:11 -05:00
Max Radermacher
710f4c0831
[ServiceId] Update everything that's left 2023-08-24 19:18:33 -05:00
Max Radermacher
b103f3d939
[ServiceId] Update outgoing messages 2023-08-17 11:09:00 -05:00
Max Radermacher
ec18653994
[ServiceId] Update the groups code 2023-08-14 14:05:49 -05:00
Max Radermacher
17a2fb4093
Rename ServiceId -> UntypedServiceId 2023-07-26 16:56:19 -05:00
Max Radermacher
b593cba603
Adopt randomForTesting/constantForTesting 2023-07-26 16:29:14 -05:00
Sasha Weiss
3811a7f4de
Tidy up group update types 2023-06-05 15:07:54 -07:00
Sasha Weiss
aae8c95fbd
Represent group updates as an enum 2023-06-05 14:27:09 -07:00
Sasha Weiss
9d16dd49e0
Support PNI invites in groups 2023-05-23 15:40:58 -07:00
Max Radermacher
31f2f3d681
Improve MSL performance 2023-04-25 14:13:59 -07:00
Max Radermacher
ae2b290a07
Use ServiceId in message sending code
Co-authored-by: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com>
2023-03-22 12:25:05 -07:00
Sasha Weiss
82fad84831
Initial implementation of PNI change-number 2023-03-09 17:13:16 -08:00
Evan Hahn
370ff654e7
Change license to AGPL
Change license to AGPL

This commit:

- Updates the `LICENSE` file

- Start every file with something like:

      // Copyright YEAR_FIRST_PUBLISHED Signal Messenger, LLC
      // SPDX-License-Identifier: AGPL-3.0-only

---

First, I removed existing license headers with this Ruby 3.1.2 script:

    require 'set'

    EXTENSIONS_TO_CHECK = Set['.h', '.hpp', '.cpp', '.m', '.mm', '.pch', '.swift']

    same = 0
    different = 0

    all_files = `git ls-files`.lines.map { |line| line.strip }
    all_files.each do |relative_path|
      if relative_path == 'Pods'
        next
      end

      unless EXTENSIONS_TO_CHECK.include? File.extname(relative_path)
        next
      end

      path = File.expand_path(relative_path)

      contents = File.read(path)
      new_contents = contents.sub(/\/\/\n\/\/  Copyright .*\n\/\/\n\n/, '')

      if contents == new_contents
        same += 1
      else
        different += 1
      end

      File.write(path, new_contents)
    end

    puts "updated #{different} file(s), left #{same} untouched"

I'm sure this script could be improved, but it worked well enough.

Then, I created `Scripts/lint/lint-license-headers` and ran it to auto-
fix a lot of files. This changed the mode of some files, but I think
that's actually desirable. For example,
`SignalServiceKit/src/Util/AppContext.m` previously had a mode of
`0755/-rwxr-xr-x`, and it's now `0644/-rw-r--r--`.

Then I fixed some stragglers and updated the precommit script.

See [a similar change in the Desktop app][0].

[0]: 8bfaf598af
2022-10-13 08:25:37 -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
Max Radermacher
11d08f101f
Fix crash when deleting messages from the future
The subtraction operation produces a negative value and causes a crash
in Swift. Allow deleting these messages to match Android’s behavior.
2022-06-27 09:02:04 -07:00
Max Radermacher
e303428216 Don’t allow “Delete for Everyone” for Gift Badges 2022-06-23 10:17:53 -07:00
Max Radermacher
da16b7c392 Convert TSMessageTest to Swift 2022-06-23 10:17:53 -07:00
george-signal
010eb64e9d
Record early receipts for server-generated DRs 2022-06-20 13:25:24 -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
george-signal
ec66f3b21e
Break envelope processing into two parts (#4340)
The purpose of this change is to alleviate the
main source of CPU-grinding after sending a
message to a large group: about 20% of the total
time is spent decoding and re-encoding messages as
they are fetched from the DB and then updated with
info about which recipients have acknowledged
delivery.

Prior to this commit, we decrypted the payload and
then processed the message in a single rather deep
call tree that began in `processNextBatch`. There
are two completely different paths through this
tree that lead to handling a delivery receipt
because server-generated delivery receipts have
the necessary info in plaintext in the envelope
and client-generated delivery receipts have it in
the ciphertext.

The idea here is to break incoming envelope
handling into two parts.

In the first part, each envelope is decrypted and
other common activities (like handling sender key
distribution messages) are performed. A processing
request is created for each. Next, processing
requests are handled. It's easy to examine a
processing request to determine if it is a
delivery receipt, and if so, for what outgoing
message. Doing so allows the new
DeliveryReceiptContext class to cache message
fetches and combine updates to the same message.

Processing requests are grouped together so that
sequential delivery receipt requests enjoy caching
of messages and coalescing of updates into a
single fetch/decode/encode/commit. Other kinds of
envelopes are handled immediately to avoid
increasing memory pressure that caching multiple
messages could cause.
2022-06-09 16:40:34 -07:00
Jordan Rose
16c1249b24 PNP: Clear phone number sharing flag after getting a delivery receipt
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.

However, as soon as they have processed a PniSignature, there's no
need to keep wasting space in messages. Detect this using the
following conditions:
- You received a delivery receipt from them.
- The original message was sent via sealed sender (so the server
  can't synthesize a delivery receipt).
- All their other devices have already sent delivery receipts for this
  message.
- The original message actually had a PniSignature in it.
- The original message's PniSignature matches your current PNI
  (relevant if you change your number and then get an incoming message
  from the same person at your new PNI).

Additionally, reset phone number sharing for *everyone* when you
change your number; they've contacted you at your old PNI,
representing your old number, and even if you reply you can no longer
claim that PNI as yours.
2022-05-20 10:48:22 -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
Jordan Rose
36426db3e7 Port TSOutgoingMessageTests to Swift
Take the opportunity to combine related tests and ensure we're testing
the right things.
2022-05-19 13:44:21 -07:00
Matthew Chen
a0efdc2e95 Respond to CR. 2021-10-21 09:21:33 -03:00
Matthew Chen
5d780d1589 Apply script to normalize includes and imports. 2021-10-21 09:21:10 -03:00
Matthew Chen
718120f725 Fix test imports. 2021-06-07 11:41:43 -04:00
Matthew Chen
37052a302a Fix build warnings around imports. 2021-06-07 11:11:30 -04:00
Matthew Chen
c2cb189e16 Add TSIncomingMessageBuilder. 2020-05-11 09:28:13 -03:00
Matthew Chen
fad9510dbe Add TSIncomingMessageBuilder. 2020-05-11 09:28:13 -03:00
Matthew Chen
bc0359268e Rework outgoing messages; embed change protos in outgoing change messages for groups v2. 2020-01-27 11:47:44 -03:00
Matthew Chen
879946ed74 Respond to CR. 2019-10-01 13:42:36 -03:00
Matthew Chen
dcf9502d01 Fix TSOutgoingMessageTest. 2019-10-01 13:35:54 -03:00
Matthew Chen
28fbf98fea Respond to CR. 2019-10-01 13:08:59 -03:00