diff --git a/Classes/ChatConversationCreateConfirmView.h b/Classes/ChatConversationCreateConfirmView.h index e3f2ebbda..95c316048 100644 --- a/Classes/ChatConversationCreateConfirmView.h +++ b/Classes/ChatConversationCreateConfirmView.h @@ -18,5 +18,6 @@ @property(strong, nonatomic) IBOutlet ChatConversationCreateConfirmCollectionViewController *collectionController; - (IBAction)onBackClick:(id)sender; - (IBAction)onValidateClick:(id)sender; +- (void)deleteContact:(NSString *)uri; @end diff --git a/Classes/ChatConversationCreateConfirmView.m b/Classes/ChatConversationCreateConfirmView.m index 0db723fb0..653fadc6d 100644 --- a/Classes/ChatConversationCreateConfirmView.m +++ b/Classes/ChatConversationCreateConfirmView.m @@ -50,9 +50,9 @@ static UICompositeViewDescription *compositeDescription = nil; - (void) viewWillAppear:(BOOL)animated { for(id uri in _contacts.allKeys) { - [_collectionController.collectionView registerClass:UIChatCreateConfirmCollectionViewCell.class forCellWithReuseIdentifier:uri]; - if(![_contactsGroup containsObject:_contacts[uri]]) - [_contactsGroup addObject:_contacts[uri]]; + [_collectionView registerClass:UIChatCreateConfirmCollectionViewCell.class forCellWithReuseIdentifier:uri]; + if(![_contactsGroup containsObject:uri]) + [_contactsGroup addObject:uri]; } [_collectionView reloadData]; } @@ -73,6 +73,21 @@ static UICompositeViewDescription *compositeDescription = nil; } - (IBAction)onValidateClick:(id)sender { + LinphoneChatRoom *room = linphone_core_create_client_group_chat_room(LC, _nameField.text.UTF8String); + bctbx_list_t *addresses = NULL; + for (id object in _contactsGroup) { + LinphoneAddress *addr = linphone_address_new(((NSString *)object).UTF8String); + if(addresses) + bctbx_list_append(addresses, addr); + else + addresses = bctbx_list_new(addr); + } + linphone_chat_room_add_participants(room, addresses); +} + +- (void)deleteContact:(NSString *)uri { + [_contacts removeObjectForKey:uri]; + [_contactsGroup removeObject:uri]; [_collectionView reloadData]; } @@ -97,6 +112,7 @@ static UICompositeViewDescription *compositeDescription = nil; NSString *uri = _contactsGroup[indexPath.item]; UIChatCreateConfirmCollectionViewCell *cell = (UIChatCreateConfirmCollectionViewCell *)[_collectionView dequeueReusableCellWithReuseIdentifier:uri forIndexPath:indexPath]; cell.uri = uri; + cell.confirmController = self; cell = [cell initWithName:_contacts[uri]]; return cell; } diff --git a/Classes/ChatConversationCreateConfirmView.xib b/Classes/ChatConversationCreateConfirmView.xib index 1354e1f32..6cc74775d 100644 --- a/Classes/ChatConversationCreateConfirmView.xib +++ b/Classes/ChatConversationCreateConfirmView.xib @@ -26,6 +26,17 @@ + + + + + + + + + + + @@ -75,12 +86,6 @@ - - - - - - diff --git a/Classes/LinphoneUI/UIChatCell.m b/Classes/LinphoneUI/UIChatCell.m index 55eedc5fc..82edb07f9 100644 --- a/Classes/LinphoneUI/UIChatCell.m +++ b/Classes/LinphoneUI/UIChatCell.m @@ -63,9 +63,15 @@ LOGW(@"Cannot update chat cell: null chat"); return; } - const LinphoneAddress *addr = linphone_chat_room_get_peer_address(chatRoom); - [ContactDisplay setDisplayNameLabel:_addressLabel forAddress:addr]; - [_avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:NO withRoundedRadius:YES]; + + if(linphone_chat_room_get_nb_participants(chatRoom) > 1) { + _addressLabel.text = [NSString stringWithUTF8String:linphone_chat_room_get_subject(chatRoom)]; + [_avatarImage setImage:[UIImage imageNamed:@"chat_group_avatar.png"] bordered:NO withRoundedRadius:YES]; + } else { + const LinphoneAddress *addr = linphone_chat_room_get_peer_address(chatRoom); + [ContactDisplay setDisplayNameLabel:_addressLabel forAddress:addr]; + [_avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:NO withRoundedRadius:YES]; + } LinphoneChatMessage *last_message = linphone_chat_room_get_user_data(chatRoom); if (last_message) { diff --git a/Classes/LinphoneUI/UIChatCreateConfirmCollectionViewCell.h b/Classes/LinphoneUI/UIChatCreateConfirmCollectionViewCell.h index 2366195b8..f5881b11c 100644 --- a/Classes/LinphoneUI/UIChatCreateConfirmCollectionViewCell.h +++ b/Classes/LinphoneUI/UIChatCreateConfirmCollectionViewCell.h @@ -7,6 +7,11 @@ #import #import "UIChatCreateCollectionViewCell.h" +#import "ChatConversationCreateConfirmView.h" -@interface UIChatCreateConfirmCollectionViewCell : UIChatCreateCollectionViewCell +@interface UIChatCreateConfirmCollectionViewCell : UICollectionViewCell +@property (weak, nonatomic) IBOutlet UILabel *displayNameLabel; +@property (strong, nonatomic) ChatConversationCreateConfirmView *confirmController; +@property (strong, nonatomic) NSString *uri; +- (id)initWithName:(NSString *)identifier; @end diff --git a/Classes/LinphoneUI/UIChatCreateConfirmCollectionViewCell.m b/Classes/LinphoneUI/UIChatCreateConfirmCollectionViewCell.m index e6874218e..fe1de1ae9 100644 --- a/Classes/LinphoneUI/UIChatCreateConfirmCollectionViewCell.m +++ b/Classes/LinphoneUI/UIChatCreateConfirmCollectionViewCell.m @@ -9,8 +9,25 @@ @implementation UIChatCreateConfirmCollectionViewCell -- (void)onDelete { +- (id)initWithName:(NSString *)identifier { + if (self != nil) { + NSArray *arrayOfViews = + [[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self.class) owner:self options:nil]; + if ([arrayOfViews count] >= 1) { + UIChatCreateCollectionViewCell *sub = ((UIChatCreateCollectionViewCell *)[arrayOfViews objectAtIndex:0]); + [self addSubview:sub]; + _displayNameLabel = sub.nameLabel; + } + } + [_displayNameLabel setText:identifier]; + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onDelete)]; + tap.numberOfTouchesRequired = 1; + [self addGestureRecognizer:tap]; + return self; } +- (void)onDelete { + [_confirmController deleteContact:_uri]; +} @end diff --git a/Classes/LinphoneUI/UIChatCreateConfirmCollectionViewCell.xib b/Classes/LinphoneUI/UIChatCreateConfirmCollectionViewCell.xib new file mode 100644 index 000000000..a8007c9e7 --- /dev/null +++ b/Classes/LinphoneUI/UIChatCreateConfirmCollectionViewCell.xib @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Resources/images/chat_group_avatar.png b/Resources/images/chat_group_avatar.png new file mode 100644 index 000000000..db9230dbb Binary files /dev/null and b/Resources/images/chat_group_avatar.png differ diff --git a/Resources/images/chat_group_avatar@2x.png b/Resources/images/chat_group_avatar@2x.png new file mode 100644 index 000000000..fa4a55bb2 Binary files /dev/null and b/Resources/images/chat_group_avatar@2x.png differ diff --git a/Resources/linphonerc-factory b/Resources/linphonerc-factory index ff3807dcd..d74dc6584 100644 --- a/Resources/linphonerc-factory +++ b/Resources/linphonerc-factory @@ -30,6 +30,7 @@ deliver_imdn=1 [misc] #by default it is set to 30 by liblinphone history_max_size=-1 +conference_factory_uri=sips:conference-factory@sip.linphone.org [sound] dtmf_player_amp=0.007 diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 09a9b4917..f0fc2a51a 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -626,6 +626,9 @@ 8C2595DD1DEDC92D007A6424 /* ProviderDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2595DC1DEDC92D007A6424 /* ProviderDelegate.m */; }; 8C2595DF1DEDCC8E007A6424 /* CallKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8C2595DE1DEDCC8E007A6424 /* CallKit.framework */; }; 8C2595E11DEDDC67007A6424 /* callkit_logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 8C2595E01DEDDC67007A6424 /* callkit_logo.png */; }; + 8C2A81921F877EDC0012A66B /* UIChatCreateConfirmCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8C2A81911F877EDC0012A66B /* UIChatCreateConfirmCollectionViewCell.xib */; }; + 8C2A81951F87B8000012A66B /* chat_group_avatar@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8C2A81931F87B7FF0012A66B /* chat_group_avatar@2x.png */; }; + 8C2A81961F87B8000012A66B /* chat_group_avatar.png in Resources */ = {isa = PBXBuildFile; fileRef = 8C2A81941F87B8000012A66B /* chat_group_avatar.png */; }; 8C300D9A1E40E0CC00728EF3 /* lime_ko.png in Resources */ = {isa = PBXBuildFile; fileRef = 8C300D981E40E0CC00728EF3 /* lime_ko.png */; }; 8C300D9B1E40E0CC00728EF3 /* lime_ko@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8C300D991E40E0CC00728EF3 /* lime_ko@2x.png */; }; 8C3EA9E31EB892D600B732B6 /* msamr.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8C3EA9E01EB892D600B732B6 /* msamr.framework */; }; @@ -1672,6 +1675,9 @@ 8C2595DC1DEDC92D007A6424 /* ProviderDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProviderDelegate.m; sourceTree = ""; }; 8C2595DE1DEDCC8E007A6424 /* CallKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CallKit.framework; path = System/Library/Frameworks/CallKit.framework; sourceTree = SDKROOT; }; 8C2595E01DEDDC67007A6424 /* callkit_logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = callkit_logo.png; sourceTree = ""; }; + 8C2A81911F877EDC0012A66B /* UIChatCreateConfirmCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = UIChatCreateConfirmCollectionViewCell.xib; sourceTree = ""; }; + 8C2A81931F87B7FF0012A66B /* chat_group_avatar@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "chat_group_avatar@2x.png"; sourceTree = ""; }; + 8C2A81941F87B8000012A66B /* chat_group_avatar.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chat_group_avatar.png; sourceTree = ""; }; 8C300D981E40E0CC00728EF3 /* lime_ko.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = lime_ko.png; sourceTree = ""; }; 8C300D991E40E0CC00728EF3 /* lime_ko@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "lime_ko@2x.png"; sourceTree = ""; }; 8C3EA9E01EB892D600B732B6 /* msamr.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = msamr.framework; path = "liblinphone-sdk/apple-darwin/Frameworks/msamr.framework"; sourceTree = ""; }; @@ -2184,6 +2190,7 @@ 8C9C5E101F83BD97006987FA /* UIChatCreateCollectionViewCell.xib */, 8CD3F5AA1F86632100680C98 /* UIChatCreateConfirmCollectionViewCell.h */, 8CD3F5AB1F86632100680C98 /* UIChatCreateConfirmCollectionViewCell.m */, + 8C2A81911F877EDC0012A66B /* UIChatCreateConfirmCollectionViewCell.xib */, 63B8D69F1BCBF43100C12B09 /* UIChatCreateCell.h */, 63B8D6A01BCBF43100C12B09 /* UIChatCreateCell.m */, 639E9CA81C0DB7F200019A75 /* UIChatCreateCell.xib */, @@ -2436,6 +2443,8 @@ 633FEBE11D3CD5570014B822 /* images */ = { isa = PBXGroup; children = ( + 8C2A81941F87B8000012A66B /* chat_group_avatar.png */, + 8C2A81931F87B7FF0012A66B /* chat_group_avatar@2x.png */, 8CB2B8F61F86229B0015CEE2 /* chat_secure.png */, 8CB2B8F71F86229C0015CEE2 /* next_disabled.png */, 8CB2B8F81F86229D0015CEE2 /* next_disabled@2x.png */, @@ -3534,6 +3543,7 @@ 633FEDA51D3CD5590014B822 /* back_default@2x.png in Resources */, 633FEF311D3CD55A0014B822 /* route_speaker_disabled@2x.png in Resources */, 633FEEE41D3CD55A0014B822 /* numpad_9_default@2x.png in Resources */, + 8C2A81961F87B8000012A66B /* chat_group_avatar.png in Resources */, 633FEDA31D3CD5590014B822 /* avatar~ipad@2x.png in Resources */, 633FEF461D3CD55A0014B822 /* speaker_disabled.png in Resources */, 638F1A911C21993D004B8E02 /* UICompositeView~ipad.xib in Resources */, @@ -3632,6 +3642,7 @@ 633FEDE11D3CD5590014B822 /* call_start_body_over~ipad@2x.png in Resources */, 633FEF4F1D3CD55A0014B822 /* valid_default@2x.png in Resources */, 633FEE241D3CD5590014B822 /* chat_start_body_over~ipad.png in Resources */, + 8C2A81951F87B8000012A66B /* chat_group_avatar@2x.png in Resources */, 633FEE091D3CD5590014B822 /* chat_add_disabled@2x.png in Resources */, 633FEE191D3CD5590014B822 /* chat_send_over@2x.png in Resources */, 633FEF181D3CD55A0014B822 /* pause_small_over_selected.png in Resources */, @@ -3682,6 +3693,7 @@ 633FEE291D3CD5590014B822 /* checkbox_unchecked@2x.png in Resources */, 63AADC001B6A0FF200AA16FD /* assistant_linphone_create.rc in Resources */, 633FEF1C1D3CD55A0014B822 /* presence_offline.png in Resources */, + 8C2A81921F877EDC0012A66B /* UIChatCreateConfirmCollectionViewCell.xib in Resources */, 633FEE901D3CD55A0014B822 /* list_details_over.png in Resources */, 633FEDE31D3CD5590014B822 /* call_status_incoming@2x.png in Resources */, 633FEE821D3CD5590014B822 /* led_disconnected.png in Resources */,