Commit Graph

32 Commits

Author SHA1 Message Date
Harry
a146e18aaf
Set up account state and exit registration
* Go to chat list view after registration

* sync system contacts during registration

* Use explicit local credentials for storage service operations during registration

* fix tests

* Quick hack to get through double pin confirmation

* Finishing touches

* lint

* fix build

* reload phone number discoverability after storage service sync

* fix tests again

* Take chat auth on account and contact record initializers

* Change around branches for clarity in OWSUserProfile

* pr comments

* Split ChatServiceAuth into the same and AuthedAccount

* fix tests

* merge woes
2023-03-09 21:54:51 -08:00
Max Radermacher
b9a345bd36 Remove contactDiscoveryV2 feature flag
It’s enabled for all users, so we don’t need the flag.
2023-02-22 13:46:13 -08:00
Max Radermacher
37603f1906 Fix build error in username code 2023-02-14 18:07:05 -08:00
Sasha Weiss
44a6fa24ab
Add contacts' usernames to ContactRecord, if nothing better available 2023-02-14 13:42:53 -08:00
Sasha Weiss
18d8a2cccf
Specific error for trying to search for invalid username 2023-02-10 09:44:54 -08:00
Sasha Weiss
e5f1af6c2e
Support lookup-by-username 2023-02-08 10:16:57 -08:00
Harry
003cc19e62
Update SignalCoreKit. Use explicit DispatchQueue instead of relying on the implicit type on promise 'on' params
* Use explicit DispatchQueue instead of relying on the implicit type on promise 'on' params

* Update SignalCoreKit
2023-02-07 16:14:39 -08:00
Max Radermacher
015803297a
Add .notAllowed to editingAuthorization for iPad 2023-02-01 11:33:37 -08:00
Max Radermacher
0c3cec9146
Update SignalCoreKit
* Update filterForDisplay call sites
2023-01-31 12:34:07 -08:00
Max Radermacher
e46d67c027
Fix bugs & consolidate “No Contacts” code
If all your contacts were blocked, we might not show the special “no
contacts” mode even though it should have been enabled.
2023-01-13 18:58:10 -08:00
Max Radermacher
1311d3f665
Refactor contact access code
Split it based on whether the purpose is “editing” or “sharing”. If
we’re editing, it generally means we have full access to contacts, and
that we’ve checked which of the contacts are registered on Signal. If
we’re “sharing”, we don’t care whether or not they’re registered.

If we’re “sharing”, we check whether or not we’ve prompted for the
contacts permission yet. If not, we’ll show the prompt.

If we’re “editing”, we assume we’ve already prompted (which is already
the case today), so `.notDetermined` isn’t a possible state.

Other things to note:

- The `supportsContactEditing` was always true, so it’s been removed.

- The error when contacts access isn’t allowed is now shown more
  consistently. Previously, it was sometimes shown in response to
  initializing a view controller.

- Some RecipientPickerViewController code was moved from Obj-C to Swift.
  This is probably useful on its own, but it’ll also make it easier to
  build some new UI in subsequent commits.
2023-01-12 09:55:30 -08:00
Max Radermacher
46596ef33c Remove nonSignalContacts property 2022-12-21 14:24:38 -08:00
Harry
33e686319c
Use iOS 13+ UINavigationBarAppearance for navbar styling
* Use iOS 13+ UINavigationBarAppearance for navbar styling

* various individual view controller navbar style tweaks and fixes

* Remove unused navigation bar styles

* rename 'default' style blur

* Apply blur style to the UIVisualEffectView generated by UINavigationBarAppearance

* Use iOS 12 navbar blur method on iOS 13 since its bugged

* Fix on iOS 15, use old method on iOS 14

* PR comment nits

* explicitly invalidate KVO observers
2022-12-13 16:17:41 -08:00
Max Radermacher
50e0405276
Add ContactDiscoveryManager
RATE LIMITS & IS CRITICAL PRIORITY

Before this change, there was a notion of “critical” discovery tasks
that had their own rate limit, and that rate limit was used for
UUIDBackfillTask. In this change, that logic has been generalized to
consider a separate rate limit for additional request types.

QUEUE PRIORITIES

All of the discovery operations were updated to use `.userInitiated` as
their priority. Before this change, the `UUIDBackfillTask` and message
sending flow used lower priorities. However, both of those should use
higher priorities -- the former blocks receiving messages and the latter
blocks outgoing messages. This change allows the code to be simplified.

TESTS

This removes most of the existing `UUIDBackfillTaskTest` test cases
(they were commented out) and all of the `ContactDiscoveryTaskTest` test
cases (which were for the rate limiter, which has been moved elsewhere).

It introduces a few new tests. These aren’t meant to be exhausive;
instead, they’re meant to hit most of the code in the new classes and a
few specific edge cases that aren’t likely to be hit in normal use.
2022-11-15 13:37:28 -08:00
Max Radermacher
9439cc5191
Clean up recipient picker contact/group cells
- Move recipient picker code to the correct file.

- Add a helper to fetch typed reusable table view cells.

- Only set shouldUseAsyncSelection in the one place that uses it.

- Remove some code that was duplicated between sync/async selection.

- Fix some strong references in the async preparation flow.

- Allow network errors when preparing recipients -- these may do network
  fetches, and those can fail for non-interesting reasons.

- Move FindByPhoneNumberDelegate to Swift & make some code private.
2022-11-07 13:02:45 -08:00
Max Radermacher
49d7896f8e
Update “Find by Number/Username” to latest designs
Some changes:

- Convert most of the code to Swift.

- Update the search result section headers to “Find by Number”/“Find by
  Username” instead of “Phone number search”/“Username search”.

- Remove “New message to:” from the rows & update the icons.

- Don’t look up phone numbers until the user taps the row. As a result,
  there’s no “No user found. Invite via SMS?” row.

- Restore the invite via SMS feature if the user can’t be found. If a
  number appears unregistered, we’ll offer to send an SMS.

- Start showing search results after 3 digits (approximately).

- Show potentially-invalid phone numbers to avoid results that disappear
  if you happen to type a digit incorrectly.
2022-11-04 13:40:13 -07:00
Harry
520faa95df
Refactor OWSNavigationController
* make shouldCancelNavigationBack a var

* rename OWSNavigationView->OWSNavigationChildController

* forward delegate calls to OWSNavigationController

* apply theme and style to OWSNavigationBar consistently

fix themeing on gif picker controller

* Use topPinned navbar position. Size the blur effect view using the background view

* Use fade animation when hiding the navigation bar

* fix issues with reduced transparency setting

* pr feedback
2022-11-03 16:40:47 -07:00
Harry
c745f9a6ae
Refactor OWSViewController
* Remove the useless shouldUseTheme

* Remove the useless shouldBottomViewReserveSpaceForKeyboard

* Add ViewControllerLifecycle

* Use more sensible constraints for keyboard layouts

* Consistent theme updates. themeDidChange is what you subclass, applyTheme is each class' internal application of theme changes, if needed

* Add app lifecycle hooks

* pr feedback

* pass through touches on the keyboard layout view(s)

* fix lint
2022-11-03 13:12:13 -07:00
Harry
5865a0a478
Translate OWSViewController to swift 2022-10-28 10:24:55 -07:00
Max Radermacher
f7b18c5ea9 Remove unused BaseMemberViewController code 2022-10-25 00:41:24 -07:00
Max Radermacher
09e3c7e3d4 Only show non-empty “Contacts” search results
If the only result is blocked, we’ll show an empty “Contacts” section.
2022-10-24 09:18:28 -05:00
Max Radermacher
1ea74d9266 Fix recipient picker nav bar when theme changes
On iOS 16, the nav bar itself is transparent, so the container view
controller’s background is visible. The color of that view wasn’t being
updated, which resulted in the nav bar appearing the wrong color.

A few view controllers worked around this by manually updating just the
background color to the same value used by the table view. It seems
cleaner to re-apply the overall styling when the theme changes.
2022-10-19 13:20:00 -07:00
Max Radermacher
3b11c52177
Move all ContactDiscoveryTask callers to Swift
* Move `intersectContacts:…` to Swift
* Move RecipientPickerVC contact discovery to Swift
* Remove ObjC support from ContactDiscoveryTask
2022-10-19 08:34:50 -07: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
ef91c13909 Remove unused RecipientPickerDelegate method
It appears unused since 8e4fd443cc.
2022-10-11 10:13:56 -07:00
Max Radermacher
db2677b0a7 Fix typo in shouldUseAsyncSelection 2022-10-11 10:13:56 -07:00
Nora Trapp
6930ffe2fa Remove old group capabilities 2022-09-29 09:35:00 -07:00
Evan Hahn
02494b048a
Hide left groups from various pickers
If you've left a group, we shouldn't show it in any pickers except the
blocking manager (`AddToBlockListViewController`). Before this commit,
we were showing it in a few places. That might let you sorta-send a
message to a group you'd left.

I enumerated all the places where we have pickers, and what their
behavior should be.

| Description                                                           | Code                                        | Show groups?             | Show left groups?        |
| --------------------------------------------------------------------- | ------------------------------------------- | ------------------------ | ------------------------ |
| Various group member pickers (adding members, group story recipients) | `BaseMemberViewController`                  | No                       | N/A                      |
| Send payment screen                                                   | `PaymentsSendRecipientViewController`       | No                       | N/A                      |
| Gift badging “choose recipient” screen                                | `BadgeGiftingChooseRecipientViewController` | No                       | N/A                      |
| Composer                                                              | `ComposeViewController`                     | Yes, only when searching | No                       |
| Add to block list (in Settings → Privacy)                             | `AddToBlockListViewController`              | Yes, only when searching | Yes, only when searching |
| Share sheet                                                           | `SharingThreadPickerViewController`         | Yes                      | No                       |
| Message forwarding                                                    | `ForwardMessageViewController`              | Yes                      | No                       |
| In-app camera                                                         | `CameraFirstCaptureSendFlow`                | Yes                      | No                       |
| Share group link via Signal                                           | `GroupLinkViewController`                   | Yes                      | No                       |
| Share sticker pack, from in a chat                                    | `StickerPackViewController`                 | Yes                      | No                       |
| Share sticker pack, from sticker management screen                    | `ManageStickersViewController`              | Yes                      | No                       |
| “New Group Story” screen                                              | `NewGroupStoryViewController`               | Yes (exclusively)        | No                       |

This doesn't intend to change the behavior of *deleted* groups. Those
will show up when searching if groups are shown at all. For example, a
deleted group will show in the composer if you search for it just like
any other group. A deleted group will *not* show in the "send payment"
screen because groups are never shown there. Again, the behavior around
deleted groups should remain unchanged.

Co-authored-by: Max Radermacher <max@signal.org>
2022-09-20 14:36:36 +00:00
Nora Trapp
de0ef9444b Fix some usage of NSLocalizedString 2022-09-11 10:36:23 -07:00
Evan Hahn
c77a8022ed Hide blocked contacts from recipient pickers
Because we don't show blocked contacts in the recipient picker, we can
also remove some code that checks for blocked contacts.
2022-08-30 22:36:59 +00: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
Nora Trapp
d9c0a92ed4 Move dependencies needed for private story creation to SignalUI 2022-07-15 15:05:03 -07:00