Commit Graph

4404 Commits

Author SHA1 Message Date
Evan Hahn
67ea0d0516 Fix some trivial compiler warnings
This fixes 10 of our Xcode warnings:

- `MessageReactionPicker.swift` was declaring a variable and not using
  it, leading to "Immutable value 'emoji' was never used". I simply
  removed it.
- `Stripe.swift` had a bunch of unnecessary `public`s, which caused
  "'public' modifier is redundant for static property declared in a
  public extension".
- `SubscriptionManager.swift` had an unnecessary `try`, causing "No
  calls to throwing functions occur within 'try' expression".
- `CallService.swift:696` was calling a function and not using its
  result, so I annotated that function with `@discardableResult`.
- `MobileCoinAPI+Configuration.swift` declared a variable with `var`
  that should've used `let`.

Nothing major here, but wanted to find ones that were easy to fix.
2022-04-19 09:28:15 -05:00
Evan Hahn
9e59ca31b5 Remove redundant DateFormatter locales
The [`locale` property of `DateFormatter`][0] defaults to `.current`, so
we don't need to specify it.

Tested this in English and Spanish in a simulator. Date formats appeared
localized.

[0]: https://developer.apple.com/documentation/foundation/dateformatter/1411973-locale
2022-04-19 09:27:54 -05:00
Michelle Linington
41f78c5d12 Merge branch 'release/5.35.1' 2022-04-14 18:16:01 -07:00
Michelle Linington
c21b7dc6ee Update min version. Last completed version stores a 3-version 2022-04-14 18:04:16 -07:00
Michelle Linington
460bce289e PR Feedback: Use existing lastLaunchVersion key 2022-04-14 18:04:16 -07:00
Jordan Rose
f58ab2ae07 Separate IdentityStore from IdentityManager
*Most* of the identity store's duties are about the identity keys of
people you talk to, but it also provides the local identity key (and
registration ID), and the local identity key differs by PNI.

This design fetches the local identity key up front in preparation for
supporting Change Number flows better, where you may need to use a
past PNI identity key to decrypt a message. (That's just one possible
implementation strategy, though.)
2022-04-14 16:47:46 -07:00
Michelle Linington
488259d5ef Lint 2022-04-14 16:25:33 -07:00
Michelle Linington
c19fa8b950 Improve log cleanup on launch 2022-04-14 16:23:21 -07:00
Michelle Linington
27727e156f Merge branch 'release/5.35.0' 2022-04-11 20:18:53 -07:00
Michelle Linington
f222c2f3e2 Lint 2022-04-11 16:30:55 -07:00
Michelle Linington
5b7a06b642 Adjust logging behavior 2022-04-11 16:30:55 -07:00
Evan Hahn
8b072620a6 Add "Donation Receipts" view 2022-04-11 16:21:12 -05:00
Michelle Linington
84be44880e PR Feedback 2022-04-08 19:36:27 -07:00
Michelle Linington
a36671c4c2 Lint 2022-04-08 19:01:43 -07:00
Michelle Linington
988e6b8e14 Require transactions for the remainder of BlockingManager's interface 2022-04-08 19:01:43 -07:00
Michelle Linington
dd0a7f6b80 Require transaction to check blocked address state 2022-04-08 19:01:43 -07:00
Jordan Rose
0a982ebc83 Include timestamp in missed call notifications
...if the call was more than five minutes ago. This should help in two
scenarios:

- you've been offline for a while, and you see "missed call" but don't
  know when they tried to call

- you hit that NSE bug where a ring gets processed hours or even days
  later, possibly when a second call arrives
2022-04-05 10:48:05 -07:00
Jordan Rose
849d6ee60a Generate PNI identity key and pre-keys for existing accounts
At launch time, if a primary device doesn't have a PNI identity key,
it should generate one immediately, as well as pre-keys. If a linked
device doesn't have a PNI identity key, it messages the primary to ask
for one; when it gets a response it generates its own pre-keys.
2022-04-04 15:19:10 -07:00
Nora Trapp
30dae7fb15 Format all times for stories relatively 2022-03-31 00:40:47 -07:00
Nora Trapp
e662b099dd Check if a user is stories capable when sending group replies 2022-03-31 00:37:56 -07:00
Nora Trapp
9494498d70 Add support for sending group replies to stories 2022-03-31 00:34:32 -07:00
Nora Trapp
6085b8e579 Initial rendering of group replies 2022-03-31 00:34:32 -07:00
Nora Trapp
b88b3ce396 Process incoming story context 2022-03-31 00:34:32 -07:00
Martin Böttcher
462177a0ce
improve cold start app start times (#4079)
deferred some initial load for faster app start
2022-03-29 08:24:55 +02:00
Nora Trapp
05313c3725 Update to LibSignalClient v0.15.0 2022-03-24 11:55:45 -07:00
Jordan Rose
a43f005d8d Add initial support for the PniIdentity sync message
This communicates the PNI identity key to existing linked devices,
which is important for linked devices to initially learn about a PNI,
or for the change of identity that comes with changing your number
(and therefore your PNI). The exact contents of this message will
probably change going forward, but here's a baseline to work off of.
2022-03-23 11:48:08 -07:00
Evan Hahn
de105468a4 Assume everyone is GV2-capable 2022-03-22 17:11:57 -05:00
Nora Trapp
bc3e22a199 Merge branch 'release/5.33.0' 2022-03-19 11:43:27 -07:00
Nora Trapp
00dedae3e0 Fix 1:1 sharing suggestions 2022-03-19 11:41:36 -07:00
Nora Trapp
1be27bbc10 Merge branch 'release/5.33.0' 2022-03-18 12:10:01 -07:00
Dimitris Apostolou
62724cf0be Fix typos 2022-03-18 11:31:06 -07:00
George Nachman
01dcfef87e Remove unneeded todo
Bulk profile fetching is pretty complicated. It
already limits its impact by throttling the rate
at which it makes requests. I don't think it's
worth trying to make it do batch operations at
this time, so I'm removing this TODO.

This stacks on top of PR #4068
2022-03-17 15:12:36 -07:00
George Nachman
1db0a3576a Batch fetch of user names.
This stacks on top of PR #4065.

This is a simple change that uses the existing
batch profile fetching to get user names.

It adds a test for OWSProfileManager.
2022-03-17 15:12:16 -07:00
George Nachman
931fe954f7 Remove unneeded todo
Bulk profile fetching is pretty complicated. It
already limits its impact by throttling the rate
at which it makes requests. I don't think it's
worth trying to make it do batch operations at
this time, so I'm removing this TODO.

This stacks on top of PR #4068
2022-03-17 15:07:14 -07:00
George Nachman
b66b1ab866 Batch fetch of user names.
This stacks on top of PR #4065.

This is a simple change that uses the existing
batch profile fetching to get user names.

It adds a test for OWSProfileManager.
2022-03-17 15:05:39 -07:00
Nora Trapp
ab52acd75b Merge branch 'release/5.33.0' 2022-03-17 14:36:37 -07:00
George Nachman
4886049d57 Batch fetch of user profiles.
Updates `UserProfileFinder` to have
`userProfiles(for:,transaction:)` that looks up
many profiles by either UUID or phone number.

Refactors the existing
`userProfile(for:,transaction:)` to use the batch
implementation.

Also adds Refinery.refineNonnilKeys to simplify a
repeating pattern where we need to fetch values
from a database where keys are nonnil. This
provides better type safety versus using
`refine(condition:,then:,otherwise:)` because the
closure can get non-optional keys as input.

Adds tests for the new user profile lookup code.
2022-03-17 14:32:17 -07:00
Nora Trapp
3ce037b57b Prevent story attachments from getting inadvertently pruned by orphan data cleaner 2022-03-17 14:30:21 -07:00
Nora Trapp
d87fa8c16c Add new fonts for text stories 2022-03-17 14:30:19 -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
Martin Böttcher
000c4c282b Merge branch 'master' into martin/IOS-2234 2022-03-17 09:09:37 +01:00
Nora Trapp
059dd9a542 Convert TSMention to SDSCodableModel 2022-03-16 18:07:38 -07:00
Nora Trapp
91777d5b9f Convert OWSReaction to SDSCodableModel 2022-03-16 18:06:24 -07:00
Nora Trapp
99350fb38c Rename HomeViewController to ChatListViewController 2022-03-16 17:51:51 -07:00
Nora Trapp
376471587f Backend support for stories receipt 2022-03-16 17:51:48 -07:00
Jordan Rose
7448b377fb Parameterize the 1:1 stores by identity (ACI or PNI)
This allows two stores to coexist in the database. Note that
everything *using* the stores will still always use the ACI stores at
this point.
2022-03-16 14:31:06 -07:00
Jordan Rose
2e39dab9b2 Support two SignalProtocolStores in SSKEnvironment
'sessionStore', 'preKeyStore', and 'signedPreKeyStore' are no longer
directly accessible; you have to go through
'signalProtocolStore(for:)' instead. This commit mechanically changes
all use sites to use `signalProtocolStore(for: .aci)`, with the
understanding that they will need cleanup in the future.

This is not enough to actually support multiple stores; they still
store in the database under the same keys. That's coming in the next
commit.
2022-03-16 14:31:06 -07:00
Michelle Linington
27a8664815 Merge branch 'release/5.32.0' 2022-03-16 07:52:03 -07:00
Michelle Linington
d6600fff40 IOS-2262: Fixes an issue where profile avatars may be lost 2022-03-15 20:53:36 -07:00