|
|
|
@ -683,9 +683,10 @@ NSString *const MessageComposeTableViewControllerCellContact = @"ContactTableVie
|
|
|
|
|
[self.tableView reloadData];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (BOOL)isContactBlocked:(Contact *)contact
|
|
|
|
|
- (BOOL)isContactBlockedOrHidden:(Contact *)contact
|
|
|
|
|
{
|
|
|
|
|
if (contact.parsedPhoneNumbers.count < 1) {
|
|
|
|
|
// Hide contacts without any valid phone numbers.
|
|
|
|
|
return YES;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -698,26 +699,15 @@ NSString *const MessageComposeTableViewControllerCellContact = @"ContactTableVie
|
|
|
|
|
return NO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (BOOL)isCurrentUserContact:(Contact *)contact
|
|
|
|
|
{
|
|
|
|
|
for (PhoneNumber *phoneNumber in contact.parsedPhoneNumbers) {
|
|
|
|
|
if ([[phoneNumber toE164] isEqualToString:[TSAccountManager localNumber]]) {
|
|
|
|
|
return YES;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (NSArray<Contact *> *_Nonnull)filteredContacts
|
|
|
|
|
{
|
|
|
|
|
NSMutableArray<Contact *> *result = [NSMutableArray new];
|
|
|
|
|
for (Contact *contact in self.contactsManager.signalContacts) {
|
|
|
|
|
if (![self isContactBlocked:contact] && ![self isCurrentUserContact:contact]) {
|
|
|
|
|
if (![self isContactBlockedOrHidden:contact]) {
|
|
|
|
|
[result addObject:contact];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
return [result copy];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma mark - Navigation
|
|
|
|
|