From 9ab70c60fea6a7e19918e6b3c80cb82e6758174d Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Mon, 4 Jul 2022 17:24:13 +0200 Subject: [PATCH 1/5] =?UTF-8?q?In=20chat=20conversation,=20hide=20keyboard?= =?UTF-8?q?=20when=20the=20action=20pop-up=20bubble=20(reply,=20transfer,?= =?UTF-8?q?=20etc)=20appears,=20and=20show=20keyboard=20when=20=E2=80=9Cre?= =?UTF-8?q?ply=E2=80=99=20is=20selected.=20This=20matches=20the=20usual=20?= =?UTF-8?q?behaviours=20of=20other=20messaging=20apps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Classes/ChatConversationView.m | 1 + Classes/LinphoneUI/UIChatBubbleTextCell.m | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index 823bf1742..3db5d7864 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -2186,6 +2186,7 @@ void on_shared_player_eof_reached(LinphonePlayer *p) { _showReplyView = true; [self updateFramesInclRecordingAndReplyView]; [self.tableController scrollToMessage:message]; + [self.messageField becomeFirstResponder]; } -(void) handlePendingTransferIfAny { diff --git a/Classes/LinphoneUI/UIChatBubbleTextCell.m b/Classes/LinphoneUI/UIChatBubbleTextCell.m index 156bbb30f..291e5fb89 100644 --- a/Classes/LinphoneUI/UIChatBubbleTextCell.m +++ b/Classes/LinphoneUI/UIChatBubbleTextCell.m @@ -851,7 +851,8 @@ static const CGFloat REPLY_OR_FORWARD_TAG_HEIGHT = 18; _messageActionsTitles = [[NSMutableArray alloc] init]; _messageActionsBlocks = [[NSMutableArray alloc] init]; _messageActionsIcons = [[NSMutableArray alloc] init]; - + + [VIEW(ChatConversationView).messageField resignFirstResponder]; UIChatBubbleTextCell *thiz = self; LinphoneChatMessageState state = linphone_chat_message_get_state(self.message); From da08af7e3fb50014a2f9a977dc663382e31b3102 Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Tue, 5 Jul 2022 13:50:15 +0200 Subject: [PATCH 2/5] =?UTF-8?q?=E2=80=9CBack=E2=80=9D=20button=20in=20chat?= =?UTF-8?q?rooms=20should=20now=20behave=20more=20in=20line=20with=20what?= =?UTF-8?q?=20is=20expected=20:=20return=20to=20the=20chatlist=20view=20in?= =?UTF-8?q?=20most=20cases?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Classes/ChatConversationView.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index 3db5d7864..4f74c4133 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -781,7 +781,14 @@ static UICompositeViewDescription *compositeDescription = nil; #pragma mark - Action Functions - (IBAction)onBackClick:(id)event { - [PhoneMainView.instance popCurrentView]; + NSString *previousViewName = [PhoneMainView.instance getPreviousViewName]; + if ([previousViewName isEqualToString:@"ContactDetailsView"]) { + ContactDetailsView *view = VIEW(ContactDetailsView); + [PhoneMainView.instance popToView:view.compositeViewDescription]; + } else { + ChatsListView *view = VIEW(ChatsListView); + [PhoneMainView.instance popToView:view.compositeViewDescription]; + } } - (IBAction)onEditClick:(id)event { From 81688b416bd5aaa56c13e6a5394cf599ce3d3a14 Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Tue, 5 Jul 2022 13:51:40 +0200 Subject: [PATCH 3/5] =?UTF-8?q?Do=20not=20display=20=E2=80=9CInfos?= =?UTF-8?q?=E2=80=9D=20action=20for=20messages=20in=201-1=20chatrooms?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Classes/LinphoneUI/UIChatBubbleTextCell.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/LinphoneUI/UIChatBubbleTextCell.m b/Classes/LinphoneUI/UIChatBubbleTextCell.m index 291e5fb89..425aff9cb 100644 --- a/Classes/LinphoneUI/UIChatBubbleTextCell.m +++ b/Classes/LinphoneUI/UIChatBubbleTextCell.m @@ -897,7 +897,7 @@ static const CGFloat REPLY_OR_FORWARD_TAG_HEIGHT = 18; [VIEW(ChatConversationView) initiateReplyViewForMessage:message]; }]; - if (linphone_chat_message_is_outgoing(self.message) || linphone_chat_room_get_nb_participants(linphone_chat_message_get_chat_room(self.message)) > 1) { + if (linphone_chat_room_get_nb_participants(linphone_chat_message_get_chat_room(self.message)) > 1) { [_messageActionsTitles addObject:NSLocalizedString(@"Infos", nil)]; [_messageActionsIcons addObject:@"menu_info"]; [_messageActionsBlocks addObject:^{ From 9612e2116226af380d80dc1f743ea12cc7e8b4f8 Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Fri, 8 Jul 2022 17:11:12 +0200 Subject: [PATCH 4/5] =?UTF-8?q?Fix=20=E2=80=9CAdd=20to=20contact=E2=80=9D?= =?UTF-8?q?=20action=20for=20encrypted=20chatrooms?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Classes/ChatConversationView.m | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index 4f74c4133..32fcc854a 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -1780,7 +1780,14 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog if (indexPath.row == 0) { if (isOneToOne) { - [self addOrGoToContact:linphone_chat_room_get_peer_address(_chatRoom)]; + if (isEncrypted) { + LinphoneAddress* contactAddress = linphone_address_clone(linphone_participant_get_address(bctbx_list_nth_data(linphone_chat_room_get_participants(_chatRoom), 0))); + linphone_address_clean(contactAddress); + [self addOrGoToContact:contactAddress]; + linphone_address_unref(contactAddress); + } else { + [self addOrGoToContact:linphone_chat_room_get_peer_address(_chatRoom)]; + } } else { [self displayGroupInfo]; } @@ -1838,7 +1845,15 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog if (indexPath.row == 0) { if (isOneToOne) { - Contact *contact = [FastAddressBook getContactWithAddress:linphone_chat_room_get_peer_address(_chatRoom)]; + Contact *contact; + if (isEncrypted) { + LinphoneAddress * contactAddress = linphone_address_clone(linphone_participant_get_address(bctbx_list_nth_data(linphone_chat_room_get_participants(_chatRoom), 0))); + linphone_address_clean(contactAddress); + contact = [FastAddressBook getContactWithAddress:contactAddress]; + linphone_address_unref(contactAddress); + } else { + contact = [FastAddressBook getContactWithAddress:linphone_chat_room_get_peer_address(_chatRoom)]; + } if (contact == nil) { cell.imageView.image = [LinphoneUtils resizeImage:[UIImage imageNamed:@"contact_add_default.png"] newSize:CGSizeMake(20, 25)]; cell.textLabel.text = NSLocalizedString(@"Add to contacts",nil); From d14a0d3c109469064340d5614f33264234632d58 Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Fri, 8 Jul 2022 17:21:31 +0200 Subject: [PATCH 5/5] =?UTF-8?q?In=20group=20chatrooms,=20added=20the=20?= =?UTF-8?q?=E2=80=9Cadd=20to=20contact=E2=80=9D=20contextual=20action=20wh?= =?UTF-8?q?en=20interacting=20with=20a=20message=20coming=20from=20someone?= =?UTF-8?q?=20that=20is=20not=20registered=20in=20your=20phone=20contacts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Classes/LinphoneUI/UIChatBubbleTextCell.m | 29 ++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/Classes/LinphoneUI/UIChatBubbleTextCell.m b/Classes/LinphoneUI/UIChatBubbleTextCell.m index 425aff9cb..487a2bb37 100644 --- a/Classes/LinphoneUI/UIChatBubbleTextCell.m +++ b/Classes/LinphoneUI/UIChatBubbleTextCell.m @@ -897,7 +897,9 @@ static const CGFloat REPLY_OR_FORWARD_TAG_HEIGHT = 18; [VIEW(ChatConversationView) initiateReplyViewForMessage:message]; }]; - if (linphone_chat_room_get_nb_participants(linphone_chat_message_get_chat_room(self.message)) > 1) { + LinphoneChatRoom *chatroom = linphone_chat_message_get_chat_room(self.message); + + if (linphone_chat_room_get_nb_participants(chatroom) > 1) { [_messageActionsTitles addObject:NSLocalizedString(@"Infos", nil)]; [_messageActionsIcons addObject:@"menu_info"]; [_messageActionsBlocks addObject:^{ @@ -907,6 +909,31 @@ static const CGFloat REPLY_OR_FORWARD_TAG_HEIGHT = 18; [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; }]; } + + if (!linphone_chat_message_is_outgoing(self.message) + && [FastAddressBook getContactWithAddress:linphone_chat_message_get_from_address(self.message)] == nil + && !(linphone_chat_room_get_capabilities(chatroom) & LinphoneChatRoomCapabilitiesOneToOne) ) { + + LinphoneAddress *fromAddress = linphone_address_clone(linphone_chat_message_get_from_address(self.message)); + [_messageActionsTitles addObject:NSLocalizedString(@"Add to contact", nil)]; + [_messageActionsIcons addObject:@"contact_add_default"]; + [_messageActionsBlocks addObject:^{ + [thiz dismissPopup]; + linphone_address_clean(fromAddress); + char *lAddress = linphone_address_as_string_uri_only(fromAddress); + if (lAddress != NULL) { + NSString *normSip = [NSString stringWithUTF8String:lAddress]; + normSip = [normSip hasPrefix:@"sip:"] ? [normSip substringFromIndex:4] : normSip; + normSip = [normSip hasPrefix:@"sips:"] ? [normSip substringFromIndex:5] : normSip; + [ContactSelection setAddAddress:normSip]; + [ContactSelection setSelectionMode:ContactSelectionModeEdit]; + [ContactSelection enableSipFilter:FALSE]; + [PhoneMainView.instance changeCurrentView:ContactsListView.compositeViewDescription]; + ms_free(lAddress); + } + linphone_address_unref(fromAddress); + }]; + } [_messageActionsTitles addObject:NSLocalizedString(@"Delete", nil)]; [_messageActionsIcons addObject:@"menu_delete"];