Commit Graph

7913 Commits

Author SHA1 Message Date
Jordan Rose
e5e4e4b2bf Fix message for an ongoing group call with three people
There's no reason to special-case "three" vs "four or more" in our
current format (rather than using "three or more"), and in fact the
"three" case wasn't using correct English (it was correct in the
PluralAware table, though). Update both the in-call title text and the
conversation item to use the PluralAware "many" version for "three or
more" people in a call.
2022-08-15 13:42:05 -07:00
Evan Hahn
2ba0cd764d Update comments that reference server code
This change should have no user impact because it only changes
comments.

We had some comments that referenced the Signal server repo. They
referenced a commit that was a little out of date (from March 2022).
This updates the links.
2022-08-15 11:54:48 -05:00
Evan Hahn
9c4412ef18
Remove nested compiler conditionals
This change should have no user impact.

We effectively had code like this:

    #if TESTABLE_BUILD

    foo()

    #if TESTABLE_BUILD
    bar()
    #endif

    #endif

The inner ones are unnecessary, so I removed them.
2022-08-15 09:13:51 -05:00
george-signal
bb33925499
Persist quoted replies
When you compose reply to a message but do not
send it, we would persist the text you entered but
would lose the quoted message to which you were
replying.

This commit adds support for persisting that
information.

ThreadReplyInfo is a new class that uses the
key-value store to associate a single optional
reference to a message with each thread.

The following behaviors are nw:
* When you enter the CVC the input toolbar is
  updated to have the quoted message.
* When you exit the CVC the quoted message is
  saved.
* When a thread is deleted, the quoted message is
  deleted.
2022-08-11 13:44:50 -07:00
Nora Trapp
0448e9e06a Fix sender-key retry behavior for stories 2022-08-11 13:21:38 -07:00
Nora Trapp
97f1483c03 Implement auto-download logic for stories 2022-08-11 13:08:50 -07:00
Sasha Weiss
43943ca621
Organize GroupV2UpdatesImpl.swift 2022-08-10 16:50:23 -07:00
harry-signal
2a23f61a3f
Video Story muting/unmuting
* Start muted, unmute when pressing volume buttons

* move ringer switch observation into its own class

* observe ringer switch in stories

* add foreground time to AppContext; use to drive mute foregrounding behavior

* dont double observe

* mix story volume with others, show volume controls
2022-08-10 16:25:49 -07:00
harry-signal
4561f0afb8
make threadassociateddata audioPlaybackRate column non-null 2022-08-09 09:55:38 -07:00
Nora Trapp
edc5c7beae Fix schema.sql for 2022-08-08 14:34:51 -07:00
Evan Hahn
e670730637 Update server params for LibSignalClient upgrade
We updated LibSignalClient in 9a5ffcb821.
We also needed to update these server public params.
2022-08-08 11:23:29 -05:00
Nora Trapp
eddba94f51 Allow 4k video playback 2022-08-07 09:19:45 -07:00
Evan Hahn
266a4663e9 Add basic test for outgoing reaction message
This change should have no direct user impact.

`OWSOutgoingReactionMessage` was untested. This adds a basic test for
its `shouldBeSaved` method.

I think this is a useful change on its own, but may make future changes
easier, too.
2022-08-07 08:57:54 -05:00
Evan Hahn
6305cdc0e6
SignalServiceKit: no longer a separate pod
SignalServiceKit is currently a separate pod. This makes merges tedious
and error-prone. Ultimately, it slows us down. It might've made sense as
a standalone library before, but it's so tightly integrated now that it
isn't useful to have it be separate.

This changes that, and makes SignalServiceKit a "normal" target.

IMO, most of this change isn't that exciting—just a bunch of changes to
scaffolding. There's one slightly spicier change: our generated
`Acknowledgements.plist` is now a little more clever.

Co-authored-by: Max Radermacher <max@signal.org>
2022-08-05 16:14:15 -05:00
harry-signal
202c137ced
Propagate ThreadAssociatedData audioPlaybackRate down to CVComponentAudioAttachment
* Propagate ThreadAssociatedData audioPlaybackRate down to CVComponentAudioAttachment

* remove audioplaybackrate from component state; keep only on view state
2022-08-04 15:53:11 -07:00
Sasha Weiss
d1a455b1a2
Collapse join/cancel request events in the chat 2022-08-04 13:07:27 -07:00
Evan Hahn
adfda71472
Add remaining disappearing message time in detail view
This commit adds something new to the message detail view: the remaining
disappearing message time, if relevant.

For example, "Disappears: 6d 23h 58m 6s" (or something similar) will be
shown.

Builds off of 70eca7b99b and
846e802784.
2022-08-04 11:58:39 -05:00
Jordan Rose
1fae99b7ff "Missed call while using Focus" / "while on Do Not Disturb"
If a ring is silenced because of Do Not Disturb, call that out
specifically.
2022-08-03 15:21:29 -07:00
Sasha Weiss
7cf14333ad
Prevent empty group updates from clobbering that a member joined via invite link
Group snapshots fetched from the service do not store the
`didJoinFromInviteLink` field on their members, and when we parse a
snapshot into a group model we hardcode this value to `false` for all
members. However, we store that field locally on a `GroupMembership`'s
`MemberStateMap` when processing an "add members" change action, as the
field is provided in the `AddMember` change action proto.

This becomes an issue, since when we refresh the group's state from the
service (which we do periodically, e.g. when opening a group for the
first time after launch) the `GroupMembership` from the group's snapshot
on the service will not match the `GroupMembership` we have locally,
even though they are from the same revision, due to mismatched
`didJoinFromInviteLink` values (hardcoded in the snapshot).
Consequently, we believed we were "updating the group model in a user-
facing way", but the only change therein was clobbering a
`didJoinFromInviteLink: true` to `...: false`, which was 1) wrong and
2) did not have a description to show.

This commit changes `GroupMembership` to ignore values for
`didJoinFromInviteLink` when comparing equality. This means that when we
parse a snapshot into a `TSGroupModel` with all those values hardcoded
to false, but otherwise identical to our local, we will no longer see it
as different from our local (and subsequently clobber our local and
generate an empty update).
2022-08-03 15:04:31 -05:00
Evan Hahn
70eca7b99b Use built-in date formatter when formatting lossless durations
Previously, `String#formatDurationLossless` rolled a custom formatter.
Now, it uses `DateComponentsFormatter`.

See also: the tests in `Signal/test/util/StringAdditionsTest.swift`,
which were untouched as part of this change.

I think this is a useful refactor anyway, but it should also fix rare
RTL bugs where duration components would be backwards. (I don't think
this ever happened under normal conditions, but it could happen if a
disappearing messages timer was set to something unusual like "1 day, 3
hours".)

I also plan to build off of this for an upcoming change, which is why
I did this now.
2022-08-03 14:51:39 -05:00
Evan Hahn
846e802784 Prefer String over NSString in Swift
This is a trivial change that should have no user impact.

`String.formatDurationLossless` calls `NSString.formatDurationLossless`,
so this is a no-op. I think it's slightly better to call a `String`
method from Swift than an `NSString` one.

I did this because it makes an upcoming change easier, but I think it's
useful on its own.
2022-08-03 12:54:12 -05:00
Jordan Rose
094c8290ce Remove unnecessary NotificationCenter.removeObserver calls
As of iOS 9, selector-based observers in NotificationCenter do not
need to be explicitly unregistered.
2022-08-02 17:43:52 -07:00
Jordan Rose
4f06a6d8a5 Fix incorrect uses of NotificationCenter block-based API
The block-based API returns a token that needs to be explicitly
unregistered, *and* the block should not capture 'self' strongly.
The fixes in this PR come in three flavors:

1. Switch to the selector-based API, sometimes taking advantage of
   the fact that extra arguments to an Objective-C method can be
   safely discarded (because they are passed at +0).

2. Save the observer token and unregister in deinit.

3. Comment why it's safe to leave the observer registered forever
   in this particular case.
2022-08-02 17:43:52 -07:00
Sasha Weiss
698180fbb3
Index name components if available 2022-08-02 11:52:20 -07:00
harry-signal
741c3961bd
Add audioPlaybackRate thread-level metadata to ThreadAssociatedData table 2022-08-01 15:34:40 -07:00
Evan Hahn
bd2b3c928e Move script out of SignalServiceKit
This change should have no direct user impact.

This is just a file move.

I think this is a useful change on its own, but it may be useful in
upcoming changes too (e.g., making SignalServiceKit not a pod).
2022-08-01 16:29:43 -05:00
Nora Trapp
7a84d7605b Allow viewing your own sent stories 2022-08-01 12:44:31 -07:00
Evan Hahn
8e5009bbf7
Add simple test for TypingIndicatorMessage
This change should have no direct user impact.

This tests `TypingIndicatorMessage`'s `isOnline` getter.

I plan to add additional tests to this file in a future commit, but I
think this is a useful change on its own.
2022-08-01 11:44:16 -05:00
Max Radermacher
64fa5e5652 Add env var to connect to staging server 2022-08-01 08:09:47 -05:00
Nora Trapp
7d1d133940 Dedupe when sending to multiple private story threads 2022-07-29 12:39:14 -07:00
Evan Hahn
088c3e5d85 Remove unused relay field from envelope proto 2022-07-29 11:35:55 -05:00
Max Radermacher
f0f52ec0b0 Ignore packKey in isDefaultStickerPack
Sticker packs are uniquely identified by packId.
2022-07-29 08:37:55 -05:00
Max Radermacher
6aee89fab1 Fix indentation in DefaultStickers 2022-07-28 13:29:03 -07:00
Evan Hahn
c988fdfee6 Convert OWSAnalyticsTests to Swift
This is a test-only change that shouldn't affect users.
2022-07-28 13:03:09 -05:00
Max Radermacher
a787b5596b Enable support for receiving gift badges 2022-07-27 15:32:10 -07:00
Evan Hahn
460f1d38c5 Log extended result code when db corruption happens
If we detect database corruption, we should log the [SQLite extended
result code][0], as it may offer insights.

This change also funnels the error handling through a single code path.

[0]: https://www.sqlite.org/rescode.html#extended_result_code_list
2022-07-27 13:44:11 -05:00
Evan Hahn
9d8e6b78ea Remove generic from flagDatabaseCorruptionIfNecessary
It is unnecessary, as far as I can tell.
2022-07-27 13:44:11 -05:00
Evan Hahn
8a13595143 Prompt for diagnostics if db corruption happens
Previously, users who experienced database corruption would be asked to
submit debug logs. (Special builds had additional options which were not
generally available, so some of this code was already written.)

Now, if they choose to submit debug logs, they will also be asked to
submit a "database diagnostic" before the logs are submitted. This runs
and logs the results of `PRAGMA cipher_provider`, `PRAGMA
cipher_integrity_check`, and whether `PRAGMA quick_check` succeeds. If
they choose to skip the diagnostic, we still submit debug logs.

Other launch failures, such as "out of disk space", do not run these
diagnostics, as they're irrelevant.
2022-07-27 11:57:16 -05:00
Max Radermacher
cc0cd24f88 Improve validation for incoming gift messages
- Drop gift messages sent to groups.
- Drop gift messages if the receipt credential presentation isn’t valid.

- Allow any level in a gift message, for future compatibility.
2022-07-26 09:28:48 -07:00
Max Radermacher
bde3f174f3
Fix crash when disabling PIN
This broke in 7bef47f356.

The old code cared that is was running on a **specific** background
queue, whereas the intent of the code appears to be “this is slow—don’t
run it on the main thread”.

I believe this new approach is also better for certain pathological edge
cases (though those edge cases would almost certainly never happen with
the global concurrent queues). In the following example, the first check
(old logic) passes, but the second check (new logic) fails.

```
DispatchQueue.main.async {
    DispatchQueue.global().sync {
        dispatchPrecondition(condition: .onQueue(DispatchQueue.global()))
        dispatchPrecondition(condition: .notOnQueue(DispatchQueue.main))
    }
}
```
2022-07-26 09:16:19 -07:00
Evan Hahn
4bf9ee4ace
Fix check for sticker pack URL
This commit:

- Adds unit tests
- Checks for auth and port in the URL
2022-07-26 10:38:34 -05:00
Max Radermacher
da3042efe9 Remove old KBS enclaves 2022-07-22 10:21:28 -07:00
Sasha Weiss
33cfe52529
Fix violations of nsobject_prefer_isequal 2022-07-21 16:00:42 -05:00
Max Radermacher
8cd4cb07e0 Temporarily disable gift receiving in beta 2022-07-21 13:54:34 -07:00
Evan Hahn
00c8a5dfc4
Remove unused group invite link remote config flag
_I recommend reviewing this with whitespace changes disabled._

`RemoteConfig.groupsV2InviteLinks` has been fully enabled for awhile
now. This removes it, and everything that depended on it. Even let us
remove a couple of strings!
2022-07-20 08:59:53 -05:00
Evan Hahn
028d97c2cb
Use remote config for gift badges
This removes `FeatureFlags.giftBadgeReceiving` and
`FeatureFlags.giftBadgeSending`, replacing them with
`RemoteConfig.canReceiveGiftBadges` and
`RemoteConfig.canSendGiftBadges`.
2022-07-20 08:50:58 -05:00
Evan Hahn
f3c5ad92b1 Remove unused isGroupInviteLink method 2022-07-19 16:48:45 -05:00
Max Radermacher
e4e21cab8c Fix outage detector error when there’s no network
If DNS resolution fails, then it’s expected that there won’t be any
addresses. Fail gracefully in this case.

If DNS resolution succeeds and provides a non-nil but empty list of
addresses, report an error. This shouldn’t happen.
2022-07-19 11:48:58 -07:00
Sasha Weiss
543d29a13b
Include banned members in comparing and rendering group memberships 2022-07-18 16:00:39 -07:00
Sasha Weiss
8ad360e71d
DRY out GroupUpdateCopy construction 2022-07-18 15:03:21 -07:00