diff --git a/Classes/ContactsListTableView.m b/Classes/ContactsListTableView.m index a05139847..00e73040e 100644 --- a/Classes/ContactsListTableView.m +++ b/Classes/ContactsListTableView.m @@ -254,16 +254,17 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info if (editingStyle == UITableViewCellEditingStyleDelete) { ABAddressBookUnregisterExternalChangeCallback(addressBook, sync_address_book, (__bridge void *)(self)); [tableView beginUpdates]; - OrderedDictionary *subDic = [addressBookMap objectForKey:[addressBookMap keyAtIndex:[indexPath section]]]; + NSString *firstChar = [addressBookMap keyAtIndex:[indexPath section]]; + OrderedDictionary *subDic = [addressBookMap objectForKey:firstChar]; NSString *key = [[subDic allKeys] objectAtIndex:[indexPath row]]; ABRecordRef contact = (__bridge ABRecordRef)([subDic objectForKey:key]); - NSString *firstChar = [[self displayNameForContact:contact] substringToIndex:1].uppercaseString; [[addressBookMap objectForKey:firstChar] removeObjectForKey:[self displayNameForContact:contact]]; if ([tableView numberOfRowsInSection:indexPath.section] == 1) { [addressBookMap removeObjectForKey:firstChar]; [tableView deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationFade]; } + [[LinphoneManager.instance fastAddressBook] removeContact:contact]; [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; @@ -275,10 +276,10 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info - (void)removeSelectionUsing:(void (^)(NSIndexPath *))remover { [super removeSelectionUsing:^(NSIndexPath *indexPath) { ABAddressBookUnregisterExternalChangeCallback(addressBook, sync_address_book, (__bridge void *)(self)); - OrderedDictionary *subDic = [addressBookMap objectForKey:[addressBookMap keyAtIndex:[indexPath section]]]; + NSString *firstChar = [addressBookMap keyAtIndex:[indexPath section]]; + OrderedDictionary *subDic = [addressBookMap objectForKey:firstChar]; NSString *key = [[subDic allKeys] objectAtIndex:[indexPath row]]; ABRecordRef contact = (__bridge ABRecordRef)([subDic objectForKey:key]); - NSString *firstChar = [[self displayNameForContact:contact] substringToIndex:1].uppercaseString; [[addressBookMap objectForKey:firstChar] removeObjectForKey:[self displayNameForContact:contact]]; if ([self.tableView numberOfRowsInSection:indexPath.section] == 1) { [addressBookMap removeObjectForKey:firstChar]; diff --git a/TestsUI/ChatTester.m b/TestsUI/ChatTester.m index 366433894..2ce33ade4 100644 --- a/TestsUI/ChatTester.m +++ b/TestsUI/ChatTester.m @@ -120,7 +120,7 @@ - (void)testChatFromContactPhoneNumber { [tester tapViewWithAccessibilityLabel:@"Contacts"]; [tester tapViewWithAccessibilityLabel:@"Anna Haro"]; - [tester tapViewWithAccessibilityLabel:@"Chat with 555-522-8243"]; + [tester tapViewWithAccessibilityLabel:@"Chat with 5555228243"]; [self goBackFromChat]; UITableView *tv = [self findTableView:@"Chat list"]; ASSERT_EQ([tv numberOfRowsInSection:0], 1);