Commit Graph

8132 Commits

Author SHA1 Message Date
Sasha Weiss
5adae8a0b7
Copy port when constructing a URL 2022-10-12 11:16:35 -07:00
Harry
823e41496a
Fix group story unread count lookup
* Fix group story unread count lookup

* Use IS instead of = and IS NOT instead of !=
2022-10-12 09:58:21 -07:00
Igor Solomennikov
d4d68e266a
Fix crash with empty WHERE in SQL query 2022-10-12 08:57:06 -05:00
Max Radermacher
d1819186f1
Remove unnecessary tryToEnableGroupsV2 call
The only place we call this in production code ensures that all members
already support gv2. As a result, there’s no reason to try and enable
gv2 -- it’s already enabled by the time we reach this code.

There are a few places in the Debug UI that may be relying on these CDS
lookups. I’ve removed one of them since there are existing “clone as v1”
and “clone as v2” options that do nearly the same thing. In another
case, I’ve dropped a reference to a live, non-test account. The other
places in the Debug UI that use this method either construct invalid
phone numbers that will never pass a CDS lookup, or they explicitly
provide UUIDs, which would exclude them from performing a lookup.
2022-10-11 17:46:52 -07:00
Max Radermacher
3ffa2dca2c
Fix nullability for countryNameFromCountryCode 2022-10-11 17:30:58 -07:00
Max Radermacher
815b3c2e1d Simplify CommonGenerator.e164() 2022-10-11 16:25:19 -07:00
Nora Trapp
0db2f93981 Show story send failures on tab badge 2022-10-11 13:09:51 -07:00
Nora Trapp
0dd56d432c Don't index group story replies for search results 2022-10-11 13:09:51 -07:00
Nora Trapp
b42690c2b7 Avoid eroneous log when receiving an SKDM 2022-10-11 13:09:51 -07:00
Sasha Weiss
f49cb92a6a
Upsert the correct ExperienceUpgrade model 2022-10-11 11:36:34 -07:00
Igor Solomennikov
d25a595f55
Media Composer: text styling toolbar now reflects currently selected font. 2022-10-11 10:55:02 -07:00
Harry
1455b3cab0
Don't include own outgoing stories in badge count after deletions 2022-10-07 16:11:41 -07:00
Harry Sanabria
f840f141be Add compated Array extension 2022-10-07 16:11:15 -05:00
Evan Hahn
1b00741b6d
Fix remaining SwiftLint failures, lint more strictly
This fixes our remaining SwiftLint violations, which were small.

It also updates the precommit script to fail if any violations are
found, even warnings. This will cause CI to fail if you include a file
that isn't SwiftLint-compatible.
2022-10-07 12:00:26 -05:00
Max Radermacher
af7c35f48a Make DiscoveredContactInfo fields non-optional 2022-10-07 09:36:43 -07:00
Max Radermacher
974b643234
Reduce likelihood of flaky test failures 2022-10-07 09:36:04 -07:00
Evan Hahn
518d8dfc58
Swiftify fingerprint test
A mechanical change. I updated the code that tests the result to be a
little more thorough.
2022-10-07 09:29:28 -07:00
Evan Hahn
9274b67d86 Swiftify proto parsing test
I also moved it to the `SignalServiceKit` tests because it's part of
that target, not the `Signal` target.
2022-10-07 01:07:31 +00:00
Nora Trapp
fe07005801 Tag story deletions as story sends 2022-10-06 15:35:54 -07:00
Evan Hahn
836a891204
Use #unavailable where possible, fixing SwiftLint violation
This fixes violations of [SwiftLint's `unavailable_condition` rule][0].
We can now do this because we're on Xcode 14.

[0]: https://realm.github.io/SwiftLint/unavailable_condition.html

Co-Authored-By: Sasha Weiss <sasha@signal.org>
2022-10-06 17:14:49 -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
Harry
6aa417a41c
Hide/Delete story tweaks
* sort system stories normally after viewing

* scroll to hidden stories after hiding (or unhiding). Scroll to hidden story section after expanding

* if hiding/unhiding/deleting a story from within a viewer, proceed to the next story or context and remove the previous one from the viewer
2022-10-06 13:01:58 -07:00
Harry
86cdf19167
listen for onboarding story changes and update badge count 2022-10-06 12:58:44 -07:00
Harry Sanabria
039571e440 Fix legacy onboarding story cleanup 2022-10-06 12:10:27 -07:00
Sasha Weiss
2c50cce85a
Clean up some dead code around experience upgrades 2022-10-06 13:28:41 -05:00
Nora Trapp
556abddc64 Update the storiesDisabled flag in the accountRecord 2022-10-06 11:08:58 -07:00
Nora Trapp
d34a9da1e2 Fix stories incorrectly being disabled on upgrade 2022-10-06 11:08:58 -07:00
Nora Trapp
5065e898d4 Rev the storiesDisabled storage service field 2022-10-06 11:08:58 -07:00
Nora Trapp
3438fc0fed Allow delete messages to be tagged as stories 2022-10-06 11:08:58 -07:00
Evan Hahn
760e5c1c97
Add PNI registration ID to account attributes
Like "regular" registration IDs, this attaches a PNI registration ID to
account attributes. It's already synced at the right times (see
[`updateAccountAttributesIfNecessaryAttempt`][0]).

Tested this by registering and seeing the payload correctly sent to the
server.

See also: [Android's implementation][1].

[0]: 487405ef08/SignalServiceKit/src/Account/TSAccountManager.swift (L137)
[1]: 6e5f28339d/libsignal/service/src/main/java/org/whispersystems/signalservice/internal/push/PushServiceSocket.java (L378)
2022-10-05 16:13:33 -05:00
Nora Trapp
208d863739 Enable stories for beta users 2022-10-05 12:29:39 -07:00
Nora Trapp
9eb1c52dca Fix test 2022-10-05 12:29:39 -07:00
Nora Trapp
5b7b0ba390 Flag story SKDMs as story sends 2022-10-05 12:24:13 -07:00
Nora Trapp
437f98c2d3 Don't use UD for story prekey requests 2022-10-05 12:24:13 -07:00
Nora Trapp
433d63f003 Flag on websocket and REST message requests that stories are enabled 2022-10-05 12:24:13 -07:00
Nora Trapp
2d341189dd Drop invalid messages with the story flag on the envelope 2022-10-05 12:24:13 -07:00
Nora Trapp
1e613fe438 Use unrestricted sealed sender for story sends 2022-10-05 12:24:13 -07:00
Harry
de564afcaf
remove dataMigration_populateLastReceivedStoryTimestamp 2022-10-05 11:56:02 -07:00
Harry
6160765bf8
Mark onboarding story viewed for users who downloaded and viewed it before view state tracking code changes 2022-10-05 11:15:30 -07:00
Sasha Weiss
a057bde7e8
Reuse NSAttributedString formatting for MessageRequestView 2022-10-05 08:54:50 -07:00
Evan Hahn
160d46ef77
Fix debug assert when proto message has no addresses
This restores the behavior prior to
4a0141be41, where I made a mistake that
affect development builds.

Previously, the generated code looked like this, to prevent
instantiation of `SignalServiceAddress`es with no identifiers:

    // This is a sketch!
    let address: SignalServiceAddress? = {
      guard hasUuid || hasE164 else { return nil }
      let address = SignalServiceAddress(uuid: uuid, e164: e164)
      guard address.isValid else {
        owsFailDebug("address was unexpectedly invalid")
        return nil
      }
      return address
    }()

It makes sense (to me) to do this, because all proto fields are
optional. That means you can have a valid message that lacks both of
these fields, which is allowed. It shouldn't error.

However, I changed it to the equivalent of this, which caused an error
in `SignalServiceAddress`'s initializer:

    let address: SignalServiceAddress? = {
      let address = SignalServiceAddress(uuid: uuid, e164: e164)
      guard address.isValid else {
        return nil
      }
      return address
    }()

This reverts that to avoid the debug assertion failure. I don't think
this ever affected "real" builds beyond some extra logging.
2022-10-05 07:31:59 -07:00
Evan Hahn
56589799cb
Clean up registration ID generation
_This change should have no user impact._

This cleans up the way we generate registration IDs. It:

- Rewrites the generation code in Swift
- Removes the "sneaky transaction" method. I did this for clarity, and
  because we won't use it for much longer
- Turns a log warning into a regular log—generating a registration ID is
  not a problem
- Adds tests

I think this is a useful change on its own, but will be handy for an
upcoming change, too.
2022-10-05 14:09:07 +00:00
Evan Hahn
09a279e55d Swiftify fake message sender
This should only affect tests.

This was a pretty mechanical conversion. I removed some unused variables
while I was here, too.
2022-10-05 10:50:53 +00:00
Evan Hahn
b5e64e9fce Speed up link preview search code
Previously, we collected all URL matches and then searched through them.
Now, we search lazily, which should improve performance.

I added a perf test that repeats a URL a million times. The new code
finishes in ~0.001 seconds on my machine. The old code does not finish.
2022-10-04 14:09:00 -07:00
Evan Hahn
a066511a62 Remove useless test setup/teardown
We had a lot of functions like this, which are useless:

    override func setUp() {
        super.setUp()
    }

This removes them.
2022-10-04 14:06:34 -07:00
Sasha Weiss
814f6c1bf2
Skip inactive experience IDs, and opportunistically clear unknown ones 2022-10-04 12:22:24 -07:00
Sasha Weiss
7fb1da0cec
Migrate ExperienceUpgrade models to SDSCodableModel 2022-10-04 08:52:03 -07:00
Nora Trapp
49ed068fcd Allow sharing text to stories 2022-10-03 21:35:32 -07:00
Nora Trapp
5f3b5e841c Delete stories sent to a private list when it's deleted 2022-10-03 21:35:32 -07:00
Nora Trapp
6eca0a0ef2 Remotely delete all sent stories when deactivating stories 2022-10-03 21:35:32 -07:00