mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			87 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			C
		
	
		
		
			
		
	
	
			87 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			C
		
	
| 
											9 years ago
										 | //
 | ||
|  | //  Copyright (c) 2017 Open Whisper Systems. All rights reserved.
 | ||
|  | //
 | ||
|  | 
 | ||
|  | NS_ASSUME_NONNULL_BEGIN | ||
|  | 
 | ||
|  | @class ContactsViewHelper; | ||
|  | @class Contact; | ||
| 
											9 years ago
										 | @class SignalAccount; | ||
| 
											9 years ago
										 | @protocol CNContactViewControllerDelegate; | ||
| 
											9 years ago
										 | 
 | ||
|  | @protocol ContactsViewHelperDelegate <NSObject> | ||
|  | 
 | ||
|  | - (void)contactsViewHelperDidUpdateContacts; | ||
|  | 
 | ||
| 
											9 years ago
										 | @optional | ||
|  | 
 | ||
| 
											9 years ago
										 | - (BOOL)shouldHideLocalNumber; | ||
|  | 
 | ||
|  | @end | ||
|  | 
 | ||
| 
											9 years ago
										 | @protocol ContactEditingDelegate <CNContactViewControllerDelegate> | ||
|  | 
 | ||
|  | - (void)didFinishEditingContact; | ||
|  | 
 | ||
|  | @end | ||
|  | 
 | ||
| 
											9 years ago
										 | #pragma mark -
 | ||
|  | 
 | ||
|  | @class OWSContactsManager; | ||
|  | @class OWSBlockingManager; | ||
| 
											8 years ago
										 | @class CNContact; | ||
| 
											9 years ago
										 | 
 | ||
|  | @interface ContactsViewHelper : NSObject | ||
|  | 
 | ||
| 
											9 years ago
										 | @property (nonatomic, readonly, weak) id<ContactsViewHelperDelegate> delegate; | ||
| 
											9 years ago
										 | 
 | ||
|  | @property (nonatomic, readonly) OWSContactsManager *contactsManager; | ||
|  | @property (nonatomic, readonly) OWSBlockingManager *blockingManager; | ||
|  | 
 | ||
| 
											9 years ago
										 | @property (nonatomic, readonly) NSDictionary<NSString *, SignalAccount *> *signalAccountMap; | ||
|  | @property (nonatomic, readonly) NSArray<SignalAccount *> *signalAccounts; | ||
| 
											9 years ago
										 | 
 | ||
| 
											9 years ago
										 | // Useful to differentiate between having no signal accounts vs. haven't checked yet
 | ||
|  | @property (nonatomic, readonly) BOOL hasUpdatedContactsAtLeastOnce; | ||
|  | 
 | ||
| 
											9 years ago
										 | @property (nonatomic, readonly) NSArray<NSString *> *blockedPhoneNumbers; | ||
| 
											9 years ago
										 | 
 | ||
| 
											8 years ago
										 | // Suitable when the user tries to perform an action which is not possible due to the user having
 | ||
| 
											8 years ago
										 | // previously denied contact access.
 | ||
| 
											8 years ago
										 | - (void)presentMissingContactAccessAlertControllerFromViewController:(UIViewController *)viewController; | ||
| 
											8 years ago
										 | 
 | ||
| 
											9 years ago
										 | - (instancetype)init NS_UNAVAILABLE; | ||
|  | 
 | ||
|  | - (instancetype)initWithDelegate:(id<ContactsViewHelperDelegate>)delegate; | ||
|  | 
 | ||
| 
											9 years ago
										 | - (nullable SignalAccount *)signalAccountForRecipientId:(NSString *)recipientId; | ||
| 
											9 years ago
										 | 
 | ||
|  | // This method is faster than OWSBlockingManager but
 | ||
|  | // is only safe to be called on the main thread.
 | ||
|  | - (BOOL)isRecipientIdBlocked:(NSString *)recipientId; | ||
|  | 
 | ||
| 
											9 years ago
										 | // NOTE: This method uses a transaction.
 | ||
| 
											9 years ago
										 | - (NSString *)localNumber; | ||
|  | 
 | ||
| 
											9 years ago
										 | - (NSArray<SignalAccount *> *)signalAccountsMatchingSearchString:(NSString *)searchText; | ||
| 
											9 years ago
										 | 
 | ||
| 
											9 years ago
										 | - (NSArray<Contact *> *)nonSignalContactsMatchingSearchString:(NSString *)searchText; | ||
|  | 
 | ||
| 
											9 years ago
										 | /**
 | ||
|  |  * NOTE: This method calls `[UIUtil applyDefaultSystemAppearence]`. | ||
| 
											8 years ago
										 |  * When using this method, you must call `[UIUtil applySignalAppearence]` once contact editing is finished; | ||
| 
											9 years ago
										 |  */ | ||
| 
											9 years ago
										 | - (void)presentContactViewControllerForRecipientId:(NSString *)recipientId | ||
|  |                                 fromViewController:(UIViewController<ContactEditingDelegate> *)fromViewController | ||
|  |                                    editImmediately:(BOOL)shouldEditImmediately; | ||
|  | 
 | ||
| 
											8 years ago
										 | // This method can be used to edit existing contacts.
 | ||
|  | - (void)presentContactViewControllerForRecipientId:(NSString *)recipientId | ||
|  |                                 fromViewController:(UIViewController<ContactEditingDelegate> *)fromViewController | ||
|  |                                    editImmediately:(BOOL)shouldEditImmediately | ||
|  |                             addToExistingCnContact:(CNContact *_Nullable)cnContact; | ||
|  | 
 | ||
| 
											9 years ago
										 | @end | ||
|  | 
 | ||
|  | NS_ASSUME_NONNULL_END |