Commit Graph

352 Commits

Author SHA1 Message Date
Max Radermacher
d95dd27225
Fix a bunch of syntax errors in the codegen script 2024-02-29 16:38:16 -06:00
Max Radermacher
d24c370cb1
Convert OWSUserProfile to SDSCodableModel 2024-01-24 17:14:10 -06:00
Max Radermacher
b0ee1e0091
Remove some unused sds config values 2024-01-09 13:20:42 -06:00
Harry
5da3a3a498
Stop using TSIncomingMessage.sourceDeviceId 2023-12-19 11:16:26 -08:00
Harry
0c53ff88fa
Rename TSOutgoingMessage.isFromLinkedDevice->wasNotCreatedLocally 2023-12-15 09:36:46 -08:00
Harry
ecbb1057c9
[MOB] Payments activation request in chat 2023-08-24 15:38:13 -07:00
Harry
2ac759408a
[MOB] Payment messages in chat 2023-08-24 13:55:39 -07:00
Pete Walters
82e51fe9cd
Add support for saving edit message drafts. 2023-07-07 15:38:35 -05:00
Max Radermacher
7e66ad45dd
Remove unused fragment files
They appear to be unused since 7927bc1afe.
2023-06-30 14:50:35 -05:00
Max Radermacher
3b1ad7f781 Remove unused SDS codegen property order values 2023-06-30 11:45:51 -05:00
Max Radermacher
5acabbe61f
Prepare interactions for modern recipient merging 2023-06-28 11:58:44 -05:00
Pete Walters
f58b6947ce
Funnel read crashes into the recovery flow 2023-06-02 11:48:51 -05:00
Max Radermacher
62965f6781
Convert TSThread.anyRemove to ThreadRemover 2023-05-10 14:03:08 -07:00
Max Radermacher
2a06e06f1a Remove TODOs from generated SDS files 2023-05-05 14:52:48 -07:00
Max Radermacher
2437083a68 Don’t mark SDS enumerate blocks as escaping 2023-05-05 14:52:48 -07:00
Max Radermacher
fcb5b60ec3 Remove anyRemoveAllWithoutInstantation 2023-05-05 14:52:48 -07:00
Max Radermacher
f575d64378 Simplify batching when removing all db objects 2023-05-05 14:52:48 -07:00
Max Radermacher
78224f3d31 Clean up sds_codegen script output 2023-05-05 14:52:48 -07:00
Pete Walters
cf37a8b1f9
Edit Message DB changes & conversation edit filtering 2023-05-03 17:22:10 -05:00
Sasha Weiss
5d7241d038
Add parsing support for the pni capability 2023-03-24 10:07:39 -07:00
george-signal
5fe81c0ad3
Show video duratioin in All Media. 2023-02-03 16:00:46 -08:00
Evan Hahn
6e97ff3c8f
Gifting: add PayPal support 2023-01-18 16:38:57 -06:00
Sasha Weiss
ee4799b506 One-time donations via PayPal 2022-12-01 14:39:03 -08:00
Evan Hahn
a941c82c14
Prefer isEmpty with strings
This change may improve performance slightly but should have no other
user impact.

`myString.isEmpty` is faster than `myString.count == 0` or equivalent,
because computing `count` may require iterating over the string.

I tried to fix all occurrences of this.

Tested this by sending a message in a group and doing a full
re-registration, just in case I broke something there.
2022-11-01 17:53:46 -05:00
Max Radermacher
9db9d94085
Handle isComplete during incoming contact syncs 2022-10-19 09:29:52 -07: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
349681ff85
Attempt to recover corrupted databases
If a user's database is corrupted, we now try to fix it. I recommend
reviewing `DatabaseRecovery` to see how this works, and
`DatabaseRecoveryViewController` for the bulk of the UI.
2022-10-06 16:42:19 -05:00
Nora Trapp
96d8abac67 PR Feedback 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
Nora Trapp
9776699137 Sync when contacts become unregistered 2022-09-15 14:09:03 -07:00
Sasha Weiss
569cdb2aad
Durable jobs for leaving groups 2022-08-26 13:13:23 -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
Nora Trapp
1d9a8a8995 Add lastViewedStoryTimestamp to TSThread 2022-08-15 14:15:11 -07:00
Nora Trapp
eddba94f51 Allow 4k video playback 2022-08-07 09:19:45 -07:00
Phil Larson
0c27a837bf
Fix path to SignalServiceKit-prefix.pch (#4717) 2022-08-06 13:41:58 -07:00
Phil Larson
00466c7a18 Remove extra commas when running sds_codegen.sh 2022-08-01 15:47:24 -05:00
Evan Hahn
10254f8486 Remove "intermediates" flag from SDS codegen scripts
A couple of codegen scripts had an `--intermediates` flag. While I was
playing around with this (fixing something else), I noticed that these
flags don't work and cause a crash.

Instead of fixing those bugs, I thought it'd be better to just delete
this flag because I don't think anybody uses it.

Tested this by running `make` in the `sds_codegen/` directory, with
success.
2022-07-05 11:52:00 -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
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
8009206c18 Respect recipient capabilities when sending gift badges
This respects the `giftBadges` capability when trying to send gift
badges. In other words, it prevents you from sending gift badges to
someone who lacks the capability.

The bulk of this change involves fetching and saving of this new
capability. The rest of the code involves showing it on the "choose
recipient" screen (and some debug screens).
2022-06-10 22:37:22 +00:00
Evan Hahn
e679707038 Fix SwiftLint shorthand_operator violations
The gist is:

```diff
-foo = foo + 1
+foo += 1
```

Most of the violations were in generated files, so I changed and re-ran the generator.

A few of these violations required implementing some new methods, which I added tests for.

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

[0]: https://realm.github.io/SwiftLint/shorthand_operator.html
2022-06-07 14:51:57 +00:00
Max Radermacher
724ea55aa7 Add giftBadge property to messages
Also run `Scripts/sds_codegen/sds_codegen.sh`
2022-05-27 12:31:24 -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
Evan Hahn
8b072620a6 Add "Donation Receipts" view 2022-04-11 16:21:12 -05:00
Nora Trapp
378cc730d1 codegen 2022-03-31 00:37:56 -07:00
Nora Trapp
014fe25b16 sds codegen 2022-03-31 00:34:33 -07:00
Nora Trapp
536c7170df sds codegen 2022-03-31 00:34:32 -07:00
Nora Trapp
e95e392494 Add story context to TSInteraction 2022-03-31 00:34:32 -07:00
Evan Hahn
16aa421d3e More Python 3 script fixes 2022-03-24 10:28:27 -05:00
Evan Hahn
c254811765 Remove unnecessary coding: utf-8 heading from Python scripts
Python 3 uses UTF-8 for source files by default. This removes the
unnecessary `coding: utf-8` declaration comment from all files.
2022-03-21 14:43:45 -05:00
Evan Hahn
1101db6a29 Upgrade scripts to Python 3
Python 2 was [removed from macOS in 12.3][0]. This change:

- Automatically converts many files with [2to3][1]
- Manually updates all [shebangs][2] to use `python3` instead of
  versionless `python` or `python2.7`
- Manually applies a few fixes, many of which were noted by 2to3
- Manually undoes a few fixes that were automatically done by 2to3

[0]: https://www.macrumors.com/2022/01/28/apple-removing-python-2-in-macos-12-3/
[1]: https://docs.python.org/3/library/2to3.html
[2]: https://en.wikipedia.org/wiki/Shebang_(Unix)
2022-03-21 12:58:33 -05:00
Dimitris Apostolou
62724cf0be Fix typos 2022-03-18 11:31:06 -07:00
Jordan Rose
15d13517fa Add SDSCursor protocol, for common functionality across cursors 2022-03-07 15:01:39 -08:00
Jordan Rose
61232780ee Don't reindex conversations on every model change
Every single message updates a TSThread model, but only a change in a
member's profile name or phone number, or a change to a group's model,
can update the indexing information. Turn 'shouldBeIndexedForFTS' into
a tri-state 'FTSIndexMode' with options 'never', 'manualUpdates', and
'always', and use 'manualUpdates' for TSThreads. Then explicitly
reindex on any of the changes listed above.
2022-02-01 15:05:34 -08:00
Michelle Linington
e3d18733da Bump copyright 2022-01-28 13:23:47 -08:00
Nora Trapp
edc89c3db1 Store badge receipt credential presentation on the durable job 2021-11-17 15:14:03 -08:00
Eugene Bistolas
78cb9352c3 [Badging] Durable receiptCredential fetch and redemption 2021-11-15 12:47:35 -10:00
Michelle Linington
0b698fbd69 Run codegen 2021-11-09 14:25:42 -08:00
Matthew Chen
153095a500 Reduce statics. 2021-11-02 10:36:25 -03:00
Matthew Chen
9963df1f23 Reduce statics. 2021-11-02 10:36:25 -03:00
Michelle Linington
77b7ea5c40 Fix a whole bunch of warnings 2021-10-21 21:11:26 -07:00
Ehren Kret
3d768ffe3d Update copyright dates in SDS codegen 2021-09-24 10:30:09 -03:00
Michelle Linington
c7444cb01d Remove isHidden column, use recordType instead 2021-08-26 20:57:06 -07:00
Michelle Linington
5b1b0d3bd0 Make hiddenUntilTimestamp a boolean column 2021-08-26 20:57:06 -07:00
Michelle Linington
ba89d93ee4 Add new database column 2021-08-26 20:29:21 -07:00
Matthew Chen
647f723610 Add OWSStaticOutgoingMessage. 2021-08-25 22:43:42 -03:00
Nora Trapp
1cbe9c3ee7 PR Feedback 2021-08-16 13:28:08 -07:00
Nora Trapp
42b2575775 Add isHighPriority field and promise support to message sender job queue 2021-08-16 13:27:43 -07:00
Nora Trapp
fee1bbddad Add exclusiveProcessIdentifier to SSKJobRecord 2021-08-16 13:27:00 -07:00
Michelle Linington
023b080dc3 PR Feedback: Remove leftover SDS definitions 2021-07-21 22:58:51 -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
Michelle Linington
59f2015fba Add OWSOutgoingSenderKeyDistributionMessage
When preparing to send a SenderKey message, we'll need to send out an
SKDM to participants. Although these can be tacked on to any message,
we'll need an outgoing message builder for these dedicated messages.
2021-07-21 22:58:50 -07:00
Matthew Chen
e911639154 Remove contact avatar data from SignalAccount. 2021-06-30 15:23:49 -03:00
Matthew Chen
58e27fe782 Ignore avatar in incoming contact syncs. Use batching when processing incoming/outgoing contact syncs. 2021-06-30 15:23:49 -03:00
Nora Trapp
ba4ba30177 Codegen 2021-06-30 09:54:26 -07:00
Matthew Chen
f004267e7f Fix thread record property mapping. 2021-05-25 16:22:33 -03:00
Matthew Chen
2c7c7b3d1c Replace ConversationColors with "avatar colors". 2021-05-25 16:22:31 -03:00
Matthew Chen
7a4ad637f0 Replace ConversationColors with "avatar colors". 2021-05-25 16:22:31 -03:00
Nora Trapp
e439bb619e Move isArchived, isMarkedUnread, and mutedUntilDate off of TSThread 2021-05-13 12:54:33 -07:00
Matthew Chen
34d3aeb1c8 Merge branch 'release/5.11.1' 2021-05-03 15:36:47 -03:00
Matthew Chen
10778e915c Improve handling of db corruption. 2021-05-03 15:00:33 -03:00
Nora Trapp
db3e441727 Send viewed receipts for audio messages 2021-04-29 18:01:19 -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
46c3408726 Update SDS to reflect payment columns. 2021-04-08 09:27:05 -03:00
Nora Trapp
73f4044ebf Fix db schema 2021-04-07 18:56:01 -07:00
Matthew Chen
cbfc7be372 Revisions to payments in SSK. 2021-04-06 13:57:07 -03: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
Nora Trapp
63da30f617 Store mute as millisecond timestamp 2021-03-27 12:13:20 -07:00
Matthew Chen
86b8eb08b8 Remove YapDatabase.
Apply asset from design.

Fix rebase breakage.
2021-03-25 11:41:16 -03:00
Matthew Chen
d3eb77d6d3 Refine handling of unverified safety number changes. 2021-01-21 22:31:08 -03:00
Matthew Chen
3bb5f0777b Add profile bio fields to database schema. 2021-01-14 22:25:45 -03:00
Matthew Chen
111338b59d Rewrite conversation view. 2020-12-10 12:44:13 -03:00
Michelle Linington
f6a252d274 Send a group call update message when joining and leaving a group call 2020-11-19 16:02:22 -08:00
Nora Trapp
d8ca084b65 Tweak database fields and update RingRTC 2020-11-19 16:02:22 -08:00
Nora Trapp
b32c5bda4a Add scaffolding for Group Call messages 2020-11-19 16:02:22 -08:00
Matthew Chen
ce1dcbade5 Animated sticker support. 2020-09-02 13:44:15 -03:00
Nora Trapp
fc2d80335f codegen 2020-08-20 16:48:54 -07:00
Nora Trapp
b035d35510 Add dedicated video call button 2020-08-14 20:44:03 -07:00
Nora Trapp
6f963c7ba5 Add mention notification settings 2020-08-04 14:09:06 -07:00