Signal-iOS/Signal/src/ViewControllers/ContactsViewHelper.h
Matthew Chen 61f59067b6 Improve contact-related views.
* Add support for contacts with more than one Signal account using ContactAccount class.
* Use OWSTableViewController in contact-related views.
* Let users add non-contacts to groups.
* Improve the "new group" and "edit group" views.
* Add utility methods for displaying alerts.
* Warn users before discarding unsaved changes in "edit group" view.
* Pull out "contact view helper" to de-duplicate common logic among contact-related views.
* Pull out "group view helper" to de-duplicate common logic among group-related views.
* Pull out new base class for view used to add accounts to groups or the block list.

// FREEBIE
2017-05-02 09:28:02 -04:00

62 lines
1.6 KiB
Objective-C

//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
NS_ASSUME_NONNULL_BEGIN
@class ContactsViewHelper;
@class Contact;
@class ContactAccount;
@protocol ContactsViewHelperDelegate <NSObject>
- (void)contactsViewHelperDidUpdateContacts;
- (BOOL)shouldHideLocalNumber;
@end
#pragma mark -
@class OWSContactsManager;
@class OWSBlockingManager;
@interface ContactsViewHelper : NSObject
@property (nonatomic, weak) id<ContactsViewHelperDelegate> delegate;
@property (nonatomic, readonly) OWSContactsManager *contactsManager;
@property (nonatomic, readonly) OWSBlockingManager *blockingManager;
// A list of all of the current user's contacts which have
// at least one signal account.
- (nullable NSArray<Contact *> *)allRecipientContacts;
// A list of all of the current user's ContactAccounts.
// See the comments on the ContactAccount class.
//
// The list is ordered by contact sorting (by OWSContactsManager)
// and within contacts by phone number, alphabetically.
- (nullable NSArray<ContactAccount *> *)allRecipientContactAccounts;
- (nullable ContactAccount *)contactAccountForRecipientId:(NSString *)recipientId;
- (nullable NSArray<NSString *> *)blockedPhoneNumbers;
// This method is faster than OWSBlockingManager but
// is only safe to be called on the main thread.
//
// Returns true if _any_ number associated with this contact
// is blocked.
- (BOOL)isContactBlocked:(Contact *)contact;
// This method is faster than OWSBlockingManager but
// is only safe to be called on the main thread.
- (BOOL)isRecipientIdBlocked:(NSString *)recipientId;
- (NSString *)localNumber;
@end
NS_ASSUME_NONNULL_END