Signal-iOS/SignalUI/ViewControllers/Recipient Picker/RecipientPickerViewController.h
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

56 lines
1.7 KiB
Objective-C

//
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
//
#import <SignalUI/OWSViewController.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_CLOSED_ENUM(NSUInteger, RecipientPickerViewControllerGroupsToShow) {
RecipientPickerViewControllerGroupsToShow_ShowNoGroups = 0,
RecipientPickerViewControllerGroupsToShow_ShowGroupsThatUserIsMemberOfWhenSearching,
RecipientPickerViewControllerGroupsToShow_ShowAllGroupsWhenSearching,
};
@protocol RecipientPickerDelegate;
@class PickedRecipient;
@interface RecipientPickerViewController : OWSViewController
@property (nonatomic, weak) id<RecipientPickerDelegate> delegate;
/// Defaults to `YES`
@property (nonatomic) BOOL allowsAddByPhoneNumber;
/// Defaults to `YES`
@property (nonatomic) BOOL shouldHideLocalRecipient;
/// Defaults to `YES`
@property (nonatomic) BOOL allowsSelectingUnregisteredPhoneNumbers;
/// Defaults to `RecipientPickerViewControllerGroupsToShow_ShowGroupsThatUserIsMemberOfWhenSearching`
@property (nonatomic) RecipientPickerViewControllerGroupsToShow groupsToShow;
/// Defaults to `NO`
@property (nonatomic) BOOL shouldShowInvites;
/// Defaults to `YES`
@property (nonatomic) BOOL shouldShowAlphabetSlider;
/// Defaults to `NO`
@property (nonatomic) BOOL shouldShowNewGroup;
/// Defaults to `NO`
@property (nonatomic) BOOL showUseAsyncSelection;
@property (nonatomic, nullable) NSString *findByPhoneNumberButtonTitle;
@property (nonatomic, nullable) NSArray<PickedRecipient *> *pickedRecipients;
@property (nonatomic) UITableView *tableView;
- (void)reloadContent;
- (void)clearSearchText;
- (void)applyThemeToViewController:(UIViewController *)viewController;
- (void)removeThemeFromViewController:(UIViewController *)viewController;
@end
NS_ASSUME_NONNULL_END