|
|
|
@ -77,6 +77,8 @@ NSString *const MessageComposeTableViewControllerCellContact = @"ContactTableVie
|
|
|
|
|
_contactsManager = [Environment getCurrent].contactsManager;
|
|
|
|
|
_phoneNumberAccountSet = [NSMutableSet set];
|
|
|
|
|
|
|
|
|
|
[self observeNotifications];
|
|
|
|
|
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -89,9 +91,28 @@ NSString *const MessageComposeTableViewControllerCellContact = @"ContactTableVie
|
|
|
|
|
|
|
|
|
|
_contactsManager = [Environment getCurrent].contactsManager;
|
|
|
|
|
|
|
|
|
|
[self observeNotifications];
|
|
|
|
|
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)observeNotifications
|
|
|
|
|
{
|
|
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
|
|
|
selector:@selector(contactsDidChange:)
|
|
|
|
|
name:OWSContactsManagerContactsDidChangeNotification
|
|
|
|
|
object:nil];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)dealloc
|
|
|
|
|
{
|
|
|
|
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)contactsDidChange:(NSNotification *)notification {
|
|
|
|
|
[self updateContacts];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
|
|
|
[super viewDidLoad];
|
|
|
|
|
[self.navigationController.navigationBar setTranslucent:NO];
|
|
|
|
@ -613,12 +634,7 @@ NSString *const MessageComposeTableViewControllerCellContact = @"ContactTableVie
|
|
|
|
|
- (void)refreshContacts {
|
|
|
|
|
[[ContactsUpdater sharedUpdater] updateSignalContactIntersectionWithABContacts:self.contactsManager.allContacts
|
|
|
|
|
success:^{
|
|
|
|
|
self.contacts = self.contactsManager.signalContacts;
|
|
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
[self updateSearchResultsForSearchController:self.searchController];
|
|
|
|
|
[self.tableView reloadData];
|
|
|
|
|
[self updateAfterRefreshTry];
|
|
|
|
|
});
|
|
|
|
|
[self updateContacts];
|
|
|
|
|
}
|
|
|
|
|
failure:^(NSError *error) {
|
|
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
@ -638,6 +654,15 @@ NSString *const MessageComposeTableViewControllerCellContact = @"ContactTableVie
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)updateContacts {
|
|
|
|
|
self.contacts = self.contactsManager.signalContacts;
|
|
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
[self updateSearchResultsForSearchController:self.searchController];
|
|
|
|
|
[self.tableView reloadData];
|
|
|
|
|
[self updateAfterRefreshTry];
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma mark - Navigation
|
|
|
|
|
|
|
|
|
|
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(nullable id)sender
|
|
|
|
|