Commit Graph

58 Commits

Author SHA1 Message Date
Elaine
659e897dc9
Allow nicknames to be saved and displayed 2024-04-05 09:35:57 -06:00
Max Radermacher
4cdae7175f
Stop using NSKeyedArchiver in SignalAccounts 2024-04-02 13:48:57 -05:00
Max Radermacher
ee490fbdf4
Standardize Contact nullability for primary/linked 2024-04-02 13:38:55 -05:00
Max Radermacher
c06d92f163
Split Contact & SystemContact 2024-04-02 13:37:36 -05:00
Max Radermacher
638e4f9421
Simplify & stabilize system contact parsing 2024-04-02 12:54:03 -05:00
Ehren Kret
d4e17730f3 remove import SignalMessaging statements 2024-03-12 03:35:34 -05:00
Max Radermacher
03288e8be0
Introduce DisplayName for rendering names 2024-02-27 18:21:30 -06:00
Max Radermacher
3601f82bb9
Swiftprotocolify OWSContactsManager 2024-02-27 16:52:27 -06:00
Max Radermacher
ec72de5663
Use phone numbers in SignalAccountReadCache 2024-02-07 17:31:14 -06:00
Max Radermacher
4c6aa8d573
Simplify ContactsManagerProtocol 2024-02-06 12:22:02 -06:00
Max Radermacher
0cf9c659aa
Protocolize markAsRegistered/markAsUnregistered 2024-02-01 11:14:45 -06:00
Max Radermacher
f94337ac03
Rip out FeatureFlags.phoneNumberIdentifiers 2023-10-24 18:18:51 -05: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
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
Sasha Weiss
38077135df
[ServiceId] SignalAccount and friends 2023-08-16 16:33:14 -07:00
Max Radermacher
d2b38e472f
[ServiceId] Update usernames 2023-08-03 11:29:40 -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
Max Radermacher
391afbcebe
Clean up OWSContactsManager.phoneNumbers(for:…) 2023-06-09 13:54:55 -05:00
Igor Solomennikov
8f6fbdf827
Convert SignalBaseTest to Swift. 2023-06-02 21:24:50 -07:00
Max Radermacher
94f96fcd8e
Migrate SignalRecipient to SDSCodableModel 2023-05-24 15:50:17 -07:00
Sasha Weiss
97167eed7a
Use ServiceId in username lookup 2023-05-16 10:02:36 -07:00
Max Radermacher
7d0d59f451
Support contact merges for yourself 2023-04-20 14:11:51 -07:00
Max Radermacher
22ef2d8e55
Swiftify AppSetup 2023-04-12 17:54:48 -07:00
Max Radermacher
aaf1d0e0b6
Clean up SignalRecipient create & fetch APIs 2023-03-29 18:40:05 -07:00
Sasha Weiss
e5f1af6c2e
Support lookup-by-username 2023-02-08 10:16:57 -08:00
Max Radermacher
3417fe2e20
Handle system contacts on linked devices
* Remove old migration code
* Rename some files
2023-02-01 16:18:59 -08:00
Max Radermacher
a283045058 Improve collation methods in ContactsPicker 2023-01-10 14:43:09 -08:00
Max Radermacher
d7c52b6ad0
Fix bugs marking SignalRecipients as registered
Previously, low-trust SignalRecipients wouldn’t be marked as registered
unless they were newly-created. Now, they are marked as registered in
places where they should be (eg, successfully sending a message or
fetching a pre key means that the device exists).

As part of this change, SignalRecipients are unregistered by default,
though most call sites still mark them as registered immediately, so the
behavior in practice will be identical. There are a few places (such as
ensureAccountId) which will no longer mark new values as registered.

Finally, creating a new SignalRecipient would also update Storage
Service, even if that recipient was created in response to a storage
service update. Now, recipients updated as part of storage service
operations won’t immediately trigger another storage service update.
2023-01-03 13:23:33 -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
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
George Nachman
cf19dcd5b2 Add cachedContactNames(for:, transaction:)
This stacks on top of PR #4054.

The purpose of this PR is to fetch cached contact
names in a batch. We can fetch their accounts in a
single SQL statement and in the case where many
contacts don't have SignalAccounts, this allows us
to fetch their phone numbers in on SQL statement
as well. There are three cases to consider:

1. There is a signal account: then we just use the
   full name on the account.
2. There is a contact we can find by phone number.
   Then use the contact's full name.
3. Fail. Other steps will be needed to determine
   the full name, such as fetching profiles.
2022-03-17 12:52:45 -07:00
George Nachman
22c1cb8a22 Fetch phone numbers in a batch.
This is the first meaty part of optimizing
fetching display names.

Some contacts fall back to phone numbers as their
display names. This PR fetches them in a single
SQL query via
`OWSContactsManager.phoneNumbers(for:, transaction)`.

To achieve this, this PR introduces
`GRDBSignalAccountFinder.signalAccounts(for:,transaction:)`
to fetch many accounts at once.

In order to fetch many accounts at once, we need
to be able to fetch many values from a
ModelReadCache at once. So this PR introduces
`ModelReadCache.readValues(for:,transaction:)` and
`ModelReadCache.getValues(for:,transaction:,returnNilOnCacheMiss:)`.

Existing methods that operate on a single value
were refactored to use the batch methods.

This PR adds tests for this functionality, which
necessitated changing the visibility of various
private symbols and also improving the fake
profile manager to make it more configurable.

There's also a tiny optimization for Refinery to
avoid calling a closure that has no work to do.
This helps elide do-nothing SQL queries that would
otherwise have been introduced.
2022-03-17 12:46:33 -07:00
Michelle Linington
9b2980fd8a Lint 2022-02-22 12:41:27 -08:00
Michelle Linington
35575c8659 Factor out common parsing behavior 2022-02-22 12:41:04 -08:00
Nora Trapp
18e19088a5 Fix broken tests 2020-08-28 13:10:47 -07:00
Michael Kirk
414bcbab95 New CDS endpoint 2020-03-04 10:08:55 -07:00
Michael Kirk
796b1ebb73 modern CDS vs. UUID 2019-07-25 14:06:06 -06:00
Michael Kirk
996bf1944e no change in functionality, test cleanup, replace deprecated method usage 2019-07-25 11:01:21 -06:00
Michael Kirk
30266bf65e autoformatted 2019-04-04 13:44:42 -06:00
Michael Kirk
64a0c4bfaa auto-migrate to Swift5 2019-04-04 13:44:42 -06:00
Matthew Chen
98630cca50 Respond to CR; add db utility methods to test base classes. 2018-09-21 09:21:34 -04:00
Matthew Chen
3935b019f4 Add base class for tests. 2018-09-10 17:30:18 -05:00
Michael Kirk
b42f528713 Integrate with new contact discovery endpoint
Also:
* use system cookie parsing
* add AESGCM additional authenticated data parameter

// FREEBIE
2018-07-23 12:21:54 -06:00
Matthew Chen
6b39f73e65 Fix tests. 2018-05-30 15:05:02 -04:00
Matthew Chen
99aedca45f Strip out special casing for pre-iOS 9 users. 2018-02-26 14:13:38 -05:00
Matthew Chen
9258b0883e Clean up TSStorageManager usage. 2017-12-19 11:41:31 -05:00
Matthew Chen
1e67bb52e3 Respond to CR.
// FREEBIE
2017-07-12 13:18:03 -04:00
Matthew Chen
0b28285deb Fix broken tests.
// FREEBIE
2017-07-12 12:14:15 -04:00