Signal-iOS/SignalMessaging/Views/ContactsViewHelper.h
Michael Kirk eadb04efcc WIP: ContactViewHelper incorporates group blocking
-[ ] UI
  -[ ] Conversation Settings
    -[x] Show switch for group
    -[ ] localize
    -[ ] migrate existing localizations? (nice to have)
    -[ ] can view conversation settings (but not edit them) in left group
    -[ ] special block copy for groups
    -[ ] special unblock copy for groups
  -[ ] ConversationViewHelper
   -[x] Track blocked groups
   -[ ] HomeView
   -[ ] ConversationView
   -[ ] Any others?
   -[ ] Rename? Extract BlockList cache?
  -[ ] Block List
    -[ ] Group Section
    -[ ] Unblock group
  -[ ] Interstitial interacting with blocked threads (e.g. thread picker)
    -[ ] BlockListUIUtils w/ thread
        -[x] Block
        -[x] Unblock
        -[ ] Replace usages where possible
        -[x] block manager
-[ ] Sync
  -[x] tentative protos
  -[ ] confirm protos w/ team
  -[x] send new protos
-[ ] Message Processing
  -[ ] Drop messages from blocked groups
2018-09-12 19:16:14 -05:00

94 lines
3.1 KiB
Objective-C

//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
NS_ASSUME_NONNULL_BEGIN
@class Contact;
@class ContactsViewHelper;
@class SignalAccount;
@class TSThread;
@protocol CNContactViewControllerDelegate;
@protocol ContactsViewHelperDelegate <NSObject>
- (void)contactsViewHelperDidUpdateContacts;
@optional
- (BOOL)shouldHideLocalNumber;
@end
@protocol ContactEditingDelegate <CNContactViewControllerDelegate>
- (void)didFinishEditingContact;
@end
#pragma mark -
@class CNContact;
@class OWSBlockingManager;
@class OWSContactsManager;
@interface ContactsViewHelper : NSObject
@property (nonatomic, readonly, weak) id<ContactsViewHelperDelegate> delegate;
@property (nonatomic, readonly) OWSContactsManager *contactsManager;
@property (nonatomic, readonly) OWSBlockingManager *blockingManager;
@property (nonatomic, readonly) NSDictionary<NSString *, SignalAccount *> *signalAccountMap;
@property (nonatomic, readonly) NSArray<SignalAccount *> *signalAccounts;
// Useful to differentiate between having no signal accounts vs. haven't checked yet
@property (nonatomic, readonly) BOOL hasUpdatedContactsAtLeastOnce;
// MJK TODO Can we remove? Do we need blockedGroupList?
@property (nonatomic, readonly) NSArray<NSString *> *blockedPhoneNumbers;
// Suitable when the user tries to perform an action which is not possible due to the user having
// previously denied contact access.
- (void)presentMissingContactAccessAlertControllerFromViewController:(UIViewController *)viewController;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithDelegate:(id<ContactsViewHelperDelegate>)delegate;
- (nullable SignalAccount *)fetchSignalAccountForRecipientId:(NSString *)recipientId;
- (SignalAccount *)fetchOrBuildSignalAccountForRecipientId:(NSString *)recipientId;
// MJK TODO Can we remove?
// This method is faster than OWSBlockingManager but
// is only safe to be called on the main thread.
- (BOOL)isRecipientIdBlocked:(NSString *)recipientId;
// This method is faster than OWSBlockingManager but
// is only safe to be called on the main thread.
- (BOOL)isThreadBlocked:(TSThread *)thread;
// NOTE: This method uses a transaction.
- (NSString *)localNumber;
- (NSArray<SignalAccount *> *)signalAccountsMatchingSearchString:(NSString *)searchText;
- (NSArray<Contact *> *)nonSignalContactsMatchingSearchString:(NSString *)searchText;
- (void)presentContactViewControllerForRecipientId:(NSString *)recipientId
fromViewController:(UIViewController<ContactEditingDelegate> *)fromViewController
editImmediately:(BOOL)shouldEditImmediately;
// This method can be used to edit existing contacts.
- (void)presentContactViewControllerForRecipientId:(NSString *)recipientId
fromViewController:(UIViewController<ContactEditingDelegate> *)fromViewController
editImmediately:(BOOL)shouldEditImmediately
addToExistingCnContact:(CNContact *_Nullable)cnContact;
+ (void)presentMissingContactAccessAlertControllerFromViewController:(UIViewController *)viewController;
@end
NS_ASSUME_NONNULL_END