Commit Graph

101 Commits

Author SHA1 Message Date
Evan Hahn
b7cd791caf Swiftify OWSDisappearingMessagesFinder
This change should have no user impact.
2022-12-13 17:11:50 -06: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
f5556d1857
Use durable job for sending badge gifts
Previously, sending a gift badge was not a durable operation, which
meant that crashes/failures could cause users to have their payment
methods charged without actually sending the badge.

Now, the flow is split up into two steps: non-durable parts before the
charge is attempted, and durable parts afterward.

The high-level flow is:

1. Prepare the payment, which involves a couple of repeatable network
   requests.
2. Enqueue a job with the prepared payment, that:
   1. Charges the payment method (idempotently)
   2. Requests a receipt credential (idempotently)
   3. Enqueues a gift message, and optionally a text message
3. When the job completes, open the conversation in the UI.
2022-07-01 17:10:31 -05:00
Nora Trapp
477f312c1e Send and receive sync transcripts for story messages 2022-06-24 00:35:31 -04: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
Jordan Rose
1301d1fe00 SSK: Collapse OWSMessageUtils into OWSMessageManager
No one is using the unreadCount* APIs anymore *except*
updateApplicationBadgeCount, so we can inline them and then move that
function to an existing class.
2022-04-11 15:17:39 -07:00
Jordan Rose
49608044b7 SSK: Remove obsolete OWSMessageDecryptJob
This hasn't been used since before GRDB.
2022-04-11 14:46:43 -07:00
Nora Trapp
059dd9a542 Convert TSMention to SDSCodableModel 2022-03-16 18:07:38 -07:00
Nora Trapp
80d1fce505 Convert TSGroupMember to SDSCodableModel 2022-03-16 18:06:59 -07:00
Nora Trapp
91777d5b9f Convert OWSReaction to SDSCodableModel 2022-03-16 18:06:24 -07:00
Nora Trapp
41dd7a14d9 Add support for IASv4 enclaves 2022-01-27 15:58:47 -08:00
Jordan Rose
d263372571 SSK: Copy in AFNetworking's multipart form data encoding impl
Matthew previously stripped this down in our fork of AFNetworking; at
this point there's no benefit to it living in a separate repo and
separate target.
2021-12-17 14:40:25 -08:00
Eugene Bistolas
78cb9352c3 [Badging] Durable receiptCredential fetch and redemption 2021-11-15 12:47:35 -10:00
Michelle Linington
f6a26c6344 Track running badge count in NSE 2021-10-29 19:26:59 -07:00
Matthew Chen
dfdc6984b7 Remove TSRequest.customHost in favor of new services vended by OWSSignalService. 2021-10-21 08:51:15 -03:00
Matthew Chen
76ffa1b51b Ensure NSE can safely respond to all sync request messages. 2021-10-15 20:14:13 -03:00
Matthew Chen
b9e9049258 Ensure NSE can safely respond to all sync request messages. 2021-10-15 20:14:13 -03:00
Matthew Chen
6f78f27ecf Tweak phone number util. 2021-10-15 09:56:14 -03:00
Matthew Chen
12e5b2a3fa Port OWSWebSocket to Swift. 2021-09-08 14:59:41 -03:00
Nora Trapp
2814ab7629 Convert to new Promise library 2021-09-03 11:41:34 -07:00
Matthew Chen
647f723610 Add OWSStaticOutgoingMessage. 2021-08-25 22:43:42 -03:00
Matthew Chen
93d9c15073 Revise app versioning scheme. 2021-08-23 18:23:49 -03:00
Matthew Chen
fcdca12cf5 Deprecate REST, Part 1
* Port socket manager to Swift.
* Clean up HTTP request success/failure state & errors.
* Rework network manager.
* Rework HTTP errors.
* Rework errors "properties": isRetryable, etc.
* Fix test breakage.
2021-08-18 14:25:36 -03:00
Matthew Chen
404062ed29 Cache formatting of PersonNameComponents. 2021-08-04 17:08:28 -03:00
Michelle Linington
2dc6a1acb2 Re-lint in preparation of merge 2021-07-21 23:01:12 -07:00
Michelle Linington
2eb60643b7 Sender key decryption failure handling
Most of the work for message resend requests. Includes some rudimentary
failure UI.
2021-07-21 22:58:51 -07:00
Matthew Chen
fad5d66bbb Rework blocking manager. 2021-07-21 16:37:59 -07:00
Nora Trapp
a365b45522 Add support for viewed receipts 2021-04-29 18:01:18 -07:00
Nora Trapp
bf660c85ce Add TSGroupMember table to allow performant querying of group membership 2021-04-08 13:44:00 -07:00
Matthew Chen
87ace3779d Respond to CR and proto schema/reconciliation review. 2021-04-06 13:57:06 -03:00
Matthew Chen
a00d14ddc4 Payments: Models 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
d0cbf8cfd0 Rework dependency access. 2021-03-25 09:24:27 -03: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
16708b9dd7 Batch message decryption and processing 2021-02-23 10:45:50 -08:00
Matthew Chen
584a638993 Create a new GRDB storage adapter after grdb schema migrations. 2021-01-27 09:45:12 -03:00
Matthew Chen
025fc61cd7 Port attachment downloads logic to Swift. 2021-01-21 20:40:24 -03:00
Nora Trapp
b32c5bda4a Add scaffolding for Group Call messages 2020-11-19 16:02:22 -08:00
Matthew Chen
686aee752c Rename OWSMessageSender -> MessageSender. 2020-09-17 21:35:35 -03:00
Matthew Chen
516defef39 Remote deprecation. 2020-09-02 16:51:59 -03:00
Nora Trapp
e8ec5330a0 Add mentions to the database 2020-08-04 14:08:29 -07:00
Matthew Chen
6d09545892 Resumable attachment download. 2020-08-01 12:18:13 -03:00
Matthew Chen
2d3b6f9018 Implement attachment upload v3. 2020-08-01 12:06:58 -03:00
Matthew Chen
28b43544b3 Implement attachment upload v3. 2020-08-01 12:06:57 -03:00
Michelle Linington
b276e8eb02 IOS-445: Do CDS lookup during message send for recipients without UUID
This adds a new async operation in the message send flow. MessageSender
will now verify that the intended recipients of a message all have UUIDs
before proceeding. If any recipients are missing a UUID, it'll kick off
a CDS lookup for the invalid recipients.

While this code appears to work, this is a first pass. Looking to get
some inital feedback in a pull request. It's unclear to me whether or
not this pattern fits in with the existing error propogation flow in
MessagSender promises. It's also unclear whether or not the error I'm
using is correct.

Some other changes that come along for the ride:
- Add a -perform() method to ContactDiscoveryService to automatically
  submit itself and its dependencies to its static operation queue
2020-07-22 21:27:22 -07:00
Michelle Linington
5c7e82bbe3 Adopt changes from precommit linting scripts 2020-07-06 13:48:59 -07:00
Michelle Linington
5b0656060e IOS-641: Introduce various synchronization utilities
This commit adds two new synchronization utilities:

- Unfair locks: This adds an Objective-C wrapper around os_unfair_lock
  to help bridge it to Swift. (Swift's handling of the underlying C
  struct can lead to surprising TSan failures). This will be useful as a
  simple, performant lock in cases where fairness is not a concern.

- Shared serial queues: Private serial queues that are untargeted will
  target the global concurrent queues. Sometimes this is what we want,
  especially for potentially long-running work items. But for cases
  where work items are brief private serial queues risk spinning up a
  new thread.

  For private queues where the individual work items are brief and there
  isn't a more appropriate queue to target, the shared serial queues
  are a potential candidate.

This change also introduces tests for these new utilities and some QoS
management helper methods.
2020-07-06 13:48:59 -07:00
Nora Trapp
fc63f37329 New safety number sheet 2020-06-25 19:04:12 -03:00
Nora Trapp
aab95db806 Strip out message request special casing 2020-06-16 12:28:21 -07:00