Commit Graph

181 Commits

Author SHA1 Message Date
Sasha Weiss
c506a98dd0
Don't crash when deserializing SDS models w/ unrecognized enum-property rawValues 2025-09-09 15:35:27 -07:00
Sasha Weiss
9822fef1e8
Remove anyRemoveAllWithInstantiation 2025-07-30 10:31:31 -07:00
Max Radermacher
cacf5d23db
Don’t consult read caches when updating dbCopy 2025-04-24 14:12:28 -05:00
Max Radermacher
77244d3a37
Fix SDS codegen for the one transaction type… 2025-04-23 14:29:06 -05:00
Sasha Weiss
bb048e8b59
One transaction type to rule them all and in the darkness bind them 2025-03-13 21:43:35 -07:00
Sasha Weiss
96a76065df
Performance improvements to import performance for messages 2025-02-19 11:48:25 -08:00
Ehren Kret
83b37e74a3 remove unused objc compat 2025-02-07 05:30:56 -06:00
Max Radermacher
823d966c2e
Clean up some deepCopy codegen 2025-01-08 11:41:58 -06:00
Max Radermacher
4c3b4e3a83
Remove anyReload methods from codegen 2025-01-07 16:41:42 -06:00
Max Radermacher
92a36aa78c
Fix sds codegen public imports 2025-01-03 17:58:51 -06:00
Sasha Weiss
a81b1bef3d
Allow deprecated_sourceDeviceId to be nil 2024-12-20 12:13:14 -08:00
Pete Walters
e5a5f7c451
Cache the TSInteraction insert statement for backup restore. 2024-10-24 11:54:46 -05:00
Max Radermacher
07baa170f7
Remove “collection” concept from database types 2024-08-20 18:22:00 -05:00
Harry
bb083ca39c
Fold SignalCoreKit into SignalServiceKit
Co-authored-by: Adam Sharp <sharplet@signal.org>
2024-06-26 08:44:41 -07:00
Sasha Weiss
0f4289fc73
Replace interaction anyRemove with InteractionDeleteManager 2024-06-04 14:51:52 -07:00
Adam Sharp
0f41ad1d74
Fix codegen formatting 2024-05-28 10:45:10 -04:00
Sasha Weiss
47c6f80c27
Track which field is missing in SDSError.missingRequiredField 2024-05-16 12:38:13 -07:00
Jordan Rose
b0de59f2e2 Remove required from every init that is not dynamically dispatched
This included:
- Removing unavailable inits wholesale if no longer `required`
- Marking a few classes `final` so they could continue using
  `Self(...)` rather than `OWSWhatever(...)`
2024-04-01 15:27:20 -07:00
Max Radermacher
5d0aaf00b0
Reformat all Python files 2024-03-29 12:53:58 -05:00
Max Radermacher
42c704a4e3
Remove some debug/verbose lines 2024-03-19 19:24:54 -05:00
Max Radermacher
0a24b7b357
Clean up recipient searches 2024-03-07 11:57:45 -06:00
Max Radermacher
d95dd27225
Fix a bunch of syntax errors in the codegen script 2024-02-29 16:38:16 -06: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
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
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
c8dc629351 Show active group stories in the conversation picker 2022-09-22 14:53:29 -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
Phil Larson
00466c7a18 Remove extra commas when running sds_codegen.sh 2022-08-01 15:47:24 -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
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
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
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
Matthew Chen
10778e915c Improve handling of db corruption. 2021-05-03 15:00:33 -03:00