diff --git a/Classes/ChatConversationCreateTableView.m b/Classes/ChatConversationCreateTableView.m index 349cb4832..84c334061 100644 --- a/Classes/ChatConversationCreateTableView.m +++ b/Classes/ChatConversationCreateTableView.m @@ -44,7 +44,8 @@ NSString *address = (NSString *)key; NSString *name = [FastAddressBook displayNameForContact:value]; Contact *contact = [LinphoneManager.instance.fastAddressBook.addressBookMap objectForKey:address]; - Boolean linphoneContact = (contact.friend && linphone_presence_model_get_basic_status(linphone_friend_get_presence_model(contact.friend)) == LinphonePresenceBasicStatusOpen); + Boolean linphoneContact = [FastAddressBook contactHasValidSipDomain:contact] + || (contact.friend && linphone_presence_model_get_basic_status(linphone_friend_get_presence_model(contact.friend)) == LinphonePresenceBasicStatusOpen); BOOL add = _allFilter || linphoneContact; if (((filter.length == 0) @@ -87,7 +88,8 @@ cell.displayNameLabel.text = [_contacts.allValues objectAtIndex:indexPath.row]; LinphoneAddress *addr = [LinphoneUtils normalizeSipOrPhoneAddress:[_contacts.allKeys objectAtIndex:indexPath.row]]; Contact *contact = [LinphoneManager.instance.fastAddressBook.addressBookMap objectForKey:[_contacts.allKeys objectAtIndex:indexPath.row]]; - Boolean linphoneContact = (contact.friend && linphone_presence_model_get_basic_status(linphone_friend_get_presence_model(contact.friend)) == LinphonePresenceBasicStatusOpen); + Boolean linphoneContact = [FastAddressBook contactHasValidSipDomain:contact] + || (contact.friend && linphone_presence_model_get_basic_status(linphone_friend_get_presence_model(contact.friend)) == LinphonePresenceBasicStatusOpen); cell.linphoneImage.hidden = !linphoneContact; if (addr) { cell.addressLabel.text = [NSString stringWithUTF8String:linphone_address_as_string_uri_only(addr)]; @@ -116,6 +118,43 @@ [_contactsDict removeObjectForKey:cell.addressLabel.text]; } cell.selectedImage.hidden = !cell.selectedImage.hidden; + _controllerNextButton.enabled = (_contactsGroup.count > 0); + if (_contactsGroup.count > 1 || (_contactsGroup.count == 1 && cell.selectedImage.hidden)) { + [UIView animateWithDuration:0.2 + delay:0 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + [tableView setFrame:CGRectMake(tableView.frame.origin.x, + _collectionView.frame.origin.y + _collectionView.frame.size.height, + tableView.frame.size.width, + tableView.frame.size.height)]; + + } + completion:nil]; + } else if (_contactsGroup.count == 1 && !cell.selectedImage.hidden) { + [UIView animateWithDuration:0.2 + delay:0 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + [tableView setFrame:CGRectMake(tableView.frame.origin.x, + _collectionView.frame.origin.y + _collectionView.frame.size.height, + tableView.frame.size.width, + tableView.frame.size.height - _collectionView.frame.size.height)]; + + } + completion:nil]; + } else { + [UIView animateWithDuration:0.2 + delay:0 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + [tableView setFrame:CGRectMake(tableView.frame.origin.x, + _searchBar.frame.origin.y + _searchBar.frame.size.height, + tableView.frame.size.width, + tableView.frame.size.height + _collectionView.frame.size.height)]; + } + completion:nil]; + } [_collectionView reloadData]; if(!cell.selectedImage.hidden) { index = _contactsGroup.count-1; @@ -129,7 +168,6 @@ animated:YES]; } }); - _controllerNextButton.enabled = (_contactsGroup.count > 0); } - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { diff --git a/Classes/ChatConversationCreateView.m b/Classes/ChatConversationCreateView.m index da24de20c..ae54d8e5d 100644 --- a/Classes/ChatConversationCreateView.m +++ b/Classes/ChatConversationCreateView.m @@ -53,11 +53,15 @@ static UICompositeViewDescription *compositeDescription = nil; [_collectionView setCollectionViewLayout:layout]; _tableController.collectionView = _collectionView; _tableController.controllerNextButton = _nextButton; - _nextButton.enabled = FALSE; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; + _nextButton.enabled = FALSE; + _tableController.tableView.frame = CGRectMake(_tableController.tableView.frame.origin.x, + _tableController.searchBar.frame.origin.y + _tableController.searchBar.frame.size.height, + _tableController.tableView.frame.size.width, + _tableController.tableView.frame.size.height + _collectionView.frame.size.height); [_collectionView reloadData]; [self changeView:ContactsAll]; } @@ -65,6 +69,8 @@ static UICompositeViewDescription *compositeDescription = nil; #pragma mark - searchBar delegate - (IBAction)onBackClick:(id)sender { + [_tableController.contactsDict removeAllObjects]; + [_tableController.contactsGroup removeAllObjects]; [PhoneMainView.instance popCurrentView]; } diff --git a/Classes/LinphoneUI/UIChatCreateCollectionViewCell.m b/Classes/LinphoneUI/UIChatCreateCollectionViewCell.m index 3b832cfb5..49b53cfc2 100644 --- a/Classes/LinphoneUI/UIChatCreateCollectionViewCell.m +++ b/Classes/LinphoneUI/UIChatCreateCollectionViewCell.m @@ -33,6 +33,18 @@ - (void) onDelete { [_controller.tableController.contactsGroup removeObject:_uri]; [_controller.tableController.contactsDict removeObjectForKey:_uri]; + if (_controller.tableController.contactsGroup.count == 0) { + [UIView animateWithDuration:0.2 + delay:0 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + [_controller.tableController.tableView setFrame:CGRectMake(_controller.tableController.tableView.frame.origin.x, + _controller.tableController.searchBar.frame.origin.y + _controller.tableController.searchBar.frame.size.height, + _controller.tableController.tableView.frame.size.width, + _controller.tableController.tableView.frame.size.height + _controller.collectionView.frame.size.height)]; + } + completion:nil]; + } [_controller.collectionView reloadData]; [_controller.tableController.tableView reloadData]; _controller.tableController.controllerNextButton.enabled = (_controller.tableController.contactsGroup.count > 0); diff --git a/Resources/images/next_disabled.png b/Resources/images/next_disabled.png new file mode 100644 index 000000000..48df90f00 Binary files /dev/null and b/Resources/images/next_disabled.png differ diff --git a/Resources/images/next_disabled@2x.png b/Resources/images/next_disabled@2x.png new file mode 100644 index 000000000..e81e4c1c0 Binary files /dev/null and b/Resources/images/next_disabled@2x.png differ diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 1164ee3c3..c58719a3c 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -685,12 +685,13 @@ 8C9C5E111F83BD97006987FA /* UIChatCreateCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9C5E0F1F83BD97006987FA /* UIChatCreateCollectionViewCell.m */; }; 8C9C5E121F83BD97006987FA /* UIChatCreateCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8C9C5E101F83BD97006987FA /* UIChatCreateCollectionViewCell.xib */; }; 8CA2004C1D8158440095F859 /* PushKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8CA2004B1D8158440095F859 /* PushKit.framework */; }; + 8CB2B8F91F86229E0015CEE2 /* chat_secure.png in Resources */ = {isa = PBXBuildFile; fileRef = 8CB2B8F61F86229B0015CEE2 /* chat_secure.png */; }; + 8CB2B8FA1F86229E0015CEE2 /* next_disabled.png in Resources */ = {isa = PBXBuildFile; fileRef = 8CB2B8F71F86229C0015CEE2 /* next_disabled.png */; }; + 8CB2B8FB1F86229E0015CEE2 /* next_disabled@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8CB2B8F81F86229D0015CEE2 /* next_disabled@2x.png */; }; 8CDC61951F84D89B0087CF7F /* check_selected.png in Resources */ = {isa = PBXBuildFile; fileRef = 8CDC618C1F84D89B0087CF7F /* check_selected.png */; }; 8CDC61971F84D9270087CF7F /* check_selected@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8CDC61961F84D9270087CF7F /* check_selected@2x.png */; }; 8CDC619A1F84EAC10087CF7F /* ChatConversationCreateConfirmView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CDC61991F84EAC10087CF7F /* ChatConversationCreateConfirmView.m */; }; 8CDC619C1F84EAFD0087CF7F /* ChatConversationCreateConfirmView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8CDC619B1F84EAFD0087CF7F /* ChatConversationCreateConfirmView.xib */; }; - 8CDC619F1F8500B90087CF7F /* next_disabled@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8CDC619D1F8500B70087CF7F /* next_disabled@2x.png */; }; - 8CDC61A01F8500B90087CF7F /* next_disabled.png in Resources */ = {isa = PBXBuildFile; fileRef = 8CDC619E1F8500B80087CF7F /* next_disabled.png */; }; 8CE24F4B1F8234A30077AC0A /* next_default.png in Resources */ = {isa = PBXBuildFile; fileRef = 8CE24F491F8234A20077AC0A /* next_default.png */; }; 8CE24F4C1F8234A30077AC0A /* next_default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8CE24F4A1F8234A30077AC0A /* next_default@2x.png */; }; 8CE24F571F8268850077AC0A /* conference_delete.png in Resources */ = {isa = PBXBuildFile; fileRef = 8CE24F551F8268840077AC0A /* conference_delete.png */; }; @@ -1694,13 +1695,14 @@ 8C9C5E0F1F83BD97006987FA /* UIChatCreateCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UIChatCreateCollectionViewCell.m; sourceTree = ""; }; 8C9C5E101F83BD97006987FA /* UIChatCreateCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = UIChatCreateCollectionViewCell.xib; sourceTree = ""; }; 8CA2004B1D8158440095F859 /* PushKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PushKit.framework; path = System/Library/Frameworks/PushKit.framework; sourceTree = SDKROOT; }; + 8CB2B8F61F86229B0015CEE2 /* chat_secure.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chat_secure.png; sourceTree = ""; }; + 8CB2B8F71F86229C0015CEE2 /* next_disabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = next_disabled.png; sourceTree = ""; }; + 8CB2B8F81F86229D0015CEE2 /* next_disabled@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "next_disabled@2x.png"; sourceTree = ""; }; 8CDC618C1F84D89B0087CF7F /* check_selected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = check_selected.png; path = "../../../ressources 27.07.17/check_selected.png"; sourceTree = ""; }; 8CDC61961F84D9270087CF7F /* check_selected@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "check_selected@2x.png"; path = "../../../ressources 27.07.17/check_selected@2x.png"; sourceTree = ""; }; 8CDC61981F84EAC10087CF7F /* ChatConversationCreateConfirmView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ChatConversationCreateConfirmView.h; sourceTree = ""; }; 8CDC61991F84EAC10087CF7F /* ChatConversationCreateConfirmView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ChatConversationCreateConfirmView.m; sourceTree = ""; }; 8CDC619B1F84EAFD0087CF7F /* ChatConversationCreateConfirmView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ChatConversationCreateConfirmView.xib; sourceTree = ""; }; - 8CDC619D1F8500B70087CF7F /* next_disabled@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "next_disabled@2x.png"; path = "../../../next_disabled@2x.png"; sourceTree = ""; }; - 8CDC619E1F8500B80087CF7F /* next_disabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = next_disabled.png; path = ../../../next_disabled.png; sourceTree = ""; }; 8CE24F491F8234A20077AC0A /* next_default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = next_default.png; sourceTree = ""; }; 8CE24F4A1F8234A30077AC0A /* next_default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "next_default@2x.png"; sourceTree = ""; }; 8CE24F551F8268840077AC0A /* conference_delete.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = conference_delete.png; sourceTree = ""; }; @@ -2424,8 +2426,9 @@ 633FEBE11D3CD5570014B822 /* images */ = { isa = PBXGroup; children = ( - 8CDC619E1F8500B80087CF7F /* next_disabled.png */, - 8CDC619D1F8500B70087CF7F /* next_disabled@2x.png */, + 8CB2B8F61F86229B0015CEE2 /* chat_secure.png */, + 8CB2B8F71F86229C0015CEE2 /* next_disabled.png */, + 8CB2B8F81F86229D0015CEE2 /* next_disabled@2x.png */, 8CDC61961F84D9270087CF7F /* check_selected@2x.png */, 8CDC618C1F84D89B0087CF7F /* check_selected.png */, 8CE24F551F8268840077AC0A /* conference_delete.png */, @@ -3320,7 +3323,7 @@ 633FEEC61D3CD55A0014B822 /* numpad_5_over@2x.png in Resources */, 633FEF021D3CD55A0014B822 /* options_disabled.png in Resources */, 633FEDC81D3CD5590014B822 /* call_missed.png in Resources */, - 8CDC61A01F8500B90087CF7F /* next_disabled.png in Resources */, + 8CB2B8FA1F86229E0015CEE2 /* next_disabled.png in Resources */, 633FEF4B1D3CD55A0014B822 /* splashscreen@2x.png in Resources */, 8C300D9A1E40E0CC00728EF3 /* lime_ko.png in Resources */, 633FEE311D3CD5590014B822 /* color_I.png in Resources */, @@ -3620,7 +3623,6 @@ 633FEF4F1D3CD55A0014B822 /* valid_default@2x.png in Resources */, 633FEE241D3CD5590014B822 /* chat_start_body_over~ipad.png in Resources */, 633FEE091D3CD5590014B822 /* chat_add_disabled@2x.png in Resources */, - 8CDC619F1F8500B90087CF7F /* next_disabled@2x.png in Resources */, 633FEE191D3CD5590014B822 /* chat_send_over@2x.png in Resources */, 633FEF181D3CD55A0014B822 /* pause_small_over_selected.png in Resources */, 633FEE001D3CD5590014B822 /* camera_switch_over.png in Resources */, @@ -3634,6 +3636,7 @@ 633FEE5C1D3CD5590014B822 /* edit_disabled.png in Resources */, 633FEDCA1D3CD5590014B822 /* call_outgoing.png in Resources */, 633FEDF81D3CD5590014B822 /* camera_disabled.png in Resources */, + 8CB2B8FB1F86229E0015CEE2 /* next_disabled@2x.png in Resources */, 633FEEE91D3CD55A0014B822 /* numpad_9~ipad.png in Resources */, 633FEE331D3CD5590014B822 /* color_M.png in Resources */, 633FEE811D3CD5590014B822 /* led_connected@2x.png in Resources */, @@ -3806,6 +3809,7 @@ 633FEE911D3CD55A0014B822 /* list_details_over@2x.png in Resources */, 633FEE121D3CD5590014B822 /* chat_message_not_delivered.png in Resources */, 633FEDCE1D3CD5590014B822 /* call_quality_indicator_1.png in Resources */, + 8CB2B8F91F86229E0015CEE2 /* chat_secure.png in Resources */, 633FEF4E1D3CD55A0014B822 /* valid_default.png in Resources */, 570742581D5A0691004B9C84 /* ShopView.xib in Resources */, 633FEE361D3CD5590014B822 /* conference_exit_over.png in Resources */,