Commit Graph

7929 Commits

Author SHA1 Message Date
Jordan Rose
e76f81e934 Watch group membership changes in the group call lobby
...so we can enable and disable the ring button live. And do so
preserving the user's preferences in case they turn off ringing, then
someone joins the group and it goes over the limit, then someone
leaves the group and it's back under.
2022-08-17 17:59:19 -07:00
Jordan Rose
f434ca0419 Add an outgoing group ring button 2022-08-17 17:59:19 -07:00
Jordan Rose
9819c92464 Add groupRings and maxGroupRingSize to RemoteConfig 2022-08-17 17:59:19 -07:00
Jordan Rose
f8829e341a Stop tracking attachments specifically in ObservedDatabaseChanges
MediaGallery and the conversation settings view were the only clients
of this, and both are better served by explicit notifications for the
state transitions they care about.
2022-08-17 14:08:16 -07:00
Jordan Rose
7c78505a5b Add an NSNotification for new downloaded attachments
Both MediaGallery and the conversation settings view care about added
or deleted media attachment streams (that is, attachments that are
downloaded and accessible), but not other updates to the attachments
table. Listening for just those notifications is more efficient than
listening to all database changes (though we still have to handle
background changes coming from other processes, like the share
extension).

Additionally, while here, don't immediately refresh the conversation
settings view if it's not currently showing (say, because it's covered
by the All Media view).
2022-08-17 14:08:16 -07:00
Sasha Weiss
7146a02821
Serialize group updates using OWSOperation 2022-08-17 13:18:31 -07:00
Evan Hahn
e858a0d916
Use subclass of outgoing message for group updates
Currently, group (v2) updates are just instances of `TSOutgoingMessage`.
This works, but is inconsistent with other outgoing messages, which
subclass it.

This refactor changes that to make things consistent.

I think this is a useful change on its own, but it will also make future
changes easier.
2022-08-16 14:45:51 -05:00
Evan Hahn
4dffd80aae
Shorten disappearing countdown description in message details
In adfda71472, we added a disappearing
countdown to the message details screen. It would say something like "6d
23h 58m 6s". Now it just says "6 days 23 hours".

I also reverted some stuff from that commit, because it's no longer
necessary.

Our UI now [matches Android][0].

[0]: 4656cf4bef
2022-08-16 14:35:15 -05:00
Evan Hahn
8c6d2ebe8c Test OWSRequestFactory.submitMessageRequest 2022-08-16 14:12:35 -05:00
Evan Hahn
402b117221 Test OWSRequestFactory.submitMultiRecipientMessageRequest 2022-08-16 14:12:35 -05:00
Nora Trapp
6b48d27bcd PR Feedback 2022-08-15 14:15:11 -07:00
Nora Trapp
66a268f759 Auto-download group stories if the author is from an auto-downloadable context, even if the group isn't 2022-08-15 14:15:11 -07:00
Nora Trapp
9e4faf335e Auto-download stories from people whose stories you have recently viewed 2022-08-15 14:15:11 -07:00
Nora Trapp
0aa84ad80b Ensure stories viewed on other devices are automatically downloaded 2022-08-15 14:15:11 -07:00
Nora Trapp
e2e0585ba8 Record last viewed time on story context 2022-08-15 14:15:11 -07:00
Nora Trapp
1d9a8a8995 Add lastViewedStoryTimestamp to TSThread 2022-08-15 14:15:11 -07:00
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