diff --git a/Classes/ChatConversationCreateTableView.h b/Classes/ChatConversationCreateTableView.h index 568f15cd1..e83829751 100644 --- a/Classes/ChatConversationCreateTableView.h +++ b/Classes/ChatConversationCreateTableView.h @@ -17,6 +17,7 @@ @property (weak, nonatomic) IBOutlet UICollectionView *collectionView; @property (weak, nonatomic) IBOutlet UIIconButton *controllerNextButton; +@property(nonatomic) Boolean isForEditing; - (void) loadData; @end diff --git a/Classes/ChatConversationCreateTableView.m b/Classes/ChatConversationCreateTableView.m index ca3c3e160..cfc76c256 100644 --- a/Classes/ChatConversationCreateTableView.m +++ b/Classes/ChatConversationCreateTableView.m @@ -38,6 +38,30 @@ [_searchBar setText:@""]; [self searchBar:_searchBar textDidChange:_searchBar.text]; self.tableView.accessibilityIdentifier = @"Suggested addresses"; + if (_contactsGroup.count > 0) { + [UIView animateWithDuration:0 + delay:0 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + [self.tableView setFrame:CGRectMake(self.tableView.frame.origin.x, + _collectionView.frame.origin.y + _collectionView.frame.size.height, + self.tableView.frame.size.width, + self.tableView.frame.size.height - _collectionView.frame.size.height)]; + + } + completion:nil]; + } else { + [UIView animateWithDuration:0 + delay:0 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + [self.tableView setFrame:CGRectMake(self.tableView.frame.origin.x, + _searchBar.frame.origin.y + _searchBar.frame.size.height, + self.tableView.frame.size.width, + self.tableView.frame.size.height + _collectionView.frame.size.height)]; + } + completion:nil]; + } } - (void) viewWillDisappear:(BOOL)animated { @@ -82,6 +106,8 @@ [self.tableView reloadData]; } +#pragma mark - TableView methods + - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } @@ -129,7 +155,7 @@ [_contactsDict removeObjectForKey:cell.addressLabel.text]; } cell.selectedImage.hidden = !cell.selectedImage.hidden; - _controllerNextButton.enabled = (_contactsGroup.count > 0); + _controllerNextButton.enabled = (_contactsGroup.count > 0) || _isForEditing; if (_contactsGroup.count > 1 || (_contactsGroup.count == 1 && cell.selectedImage.hidden)) { [UIView animateWithDuration:0.2 delay:0 diff --git a/Classes/ChatConversationCreateView.h b/Classes/ChatConversationCreateView.h index 1a5faad5c..d74e865b3 100644 --- a/Classes/ChatConversationCreateView.h +++ b/Classes/ChatConversationCreateView.h @@ -27,6 +27,8 @@ @property (weak, nonatomic) IBOutlet UIIconButton *linphoneButton; @property (weak, nonatomic) IBOutlet UIImageView *selectedButtonImage; +@property(nonatomic) Boolean isForEditing; + - (IBAction)onBackClick:(id)sender; - (IBAction)onNextClick:(id)sender; diff --git a/Classes/ChatConversationCreateView.m b/Classes/ChatConversationCreateView.m index a1afc3c4a..599971afd 100644 --- a/Classes/ChatConversationCreateView.m +++ b/Classes/ChatConversationCreateView.m @@ -53,12 +53,15 @@ static UICompositeViewDescription *compositeDescription = nil; [_collectionView setCollectionViewLayout:layout]; _tableController.collectionView = _collectionView; _tableController.controllerNextButton = _nextButton; + _isForEditing = FALSE; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; if(_tableController.contactsGroup.count == 0) { - _nextButton.enabled = FALSE; + if (!_isForEditing) + _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, @@ -67,6 +70,7 @@ static UICompositeViewDescription *compositeDescription = nil; [_collectionView reloadData]; [self changeView:ContactsAll]; [_tableController loadData]; + _tableController.isForEditing = _isForEditing; } #pragma mark - searchBar delegate @@ -119,8 +123,15 @@ void create_chat_room_state_changed(LinphoneChatRoom *cr, LinphoneChatRoomState return; } ChatConversationInfoView *view = VIEW(ChatConversationInfoView); - view.contacts = _tableController.contactsDict; - view.create = TRUE; + if (!_isForEditing) + view.contacts = _tableController.contactsDict; + else { + for (NSString *uri in _tableController.contactsDict) { + [view.contacts setObject:[_tableController.contactsDict objectForKey:uri] forKey:uri]; + } + } + + view.create = !_isForEditing; [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; } diff --git a/Classes/ChatConversationInfoView.m b/Classes/ChatConversationInfoView.m index 13bbd03d5..c71f1c10f 100644 --- a/Classes/ChatConversationInfoView.m +++ b/Classes/ChatConversationInfoView.m @@ -107,6 +107,7 @@ static UICompositeViewDescription *compositeDescription = nil; view.tableController.contactsDict = _contacts; view.tableController.contactsGroup = [[_contacts allKeys] mutableCopy]; view.tableController.notFirstTime = TRUE; + view.isForEditing = FALSE; [PhoneMainView.instance popToView:view.compositeViewDescription]; } else { ChatConversationView *view = VIEW(ChatConversationView); @@ -117,6 +118,15 @@ static UICompositeViewDescription *compositeDescription = nil; - (IBAction)onQuitClick:(id)sender { } +- (IBAction)onAddClick:(id)sender { + ChatConversationCreateView *view = VIEW(ChatConversationCreateView); + view.tableController.notFirstTime = TRUE; + view.isForEditing = !_create; + [view.tableController.contactsDict removeAllObjects]; + [view.tableController.contactsGroup removeAllObjects]; + [PhoneMainView.instance popToView:view.compositeViewDescription]; +} + #pragma mark - TableView - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { diff --git a/Classes/ChatConversationInfoView.xib b/Classes/ChatConversationInfoView.xib index 191aba537..e99868848 100644 --- a/Classes/ChatConversationInfoView.xib +++ b/Classes/ChatConversationInfoView.xib @@ -123,7 +123,7 @@ - + diff --git a/Classes/LinphoneUI/UIChatCreateCollectionViewCell.m b/Classes/LinphoneUI/UIChatCreateCollectionViewCell.m index 49b53cfc2..40d720162 100644 --- a/Classes/LinphoneUI/UIChatCreateCollectionViewCell.m +++ b/Classes/LinphoneUI/UIChatCreateCollectionViewCell.m @@ -47,6 +47,6 @@ } [_controller.collectionView reloadData]; [_controller.tableController.tableView reloadData]; - _controller.tableController.controllerNextButton.enabled = (_controller.tableController.contactsGroup.count > 0); + _controller.nextButton.enabled = (_controller.tableController.contactsGroup.count > 0) || _controller.isForEditing; } @end diff --git a/submodules/linphone b/submodules/linphone index 94c08dce7..8e05e6a21 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 94c08dce7f21f9ce03361282cad8ca12b1258d1a +Subproject commit 8e05e6a21f0770e4e00fbf316568645bebaf41c0