From 2b893c53be99dc3f610bc184c966bb4a20482e3d Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Fri, 10 Nov 2017 11:29:21 +0100 Subject: [PATCH] do not change nature of an existing chatroom --- Classes/ChatConversationInfoView.m | 11 +++-------- Classes/ChatConversationView.m | 4 ++-- Classes/LinphoneUI/UIChatCell.m | 9 +++++---- submodules/linphone | 2 +- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Classes/ChatConversationInfoView.m b/Classes/ChatConversationInfoView.m index 81542ab86..c7b58bdfa 100644 --- a/Classes/ChatConversationInfoView.m +++ b/Classes/ChatConversationInfoView.m @@ -59,17 +59,13 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - if (_room) { - _nameLabel.text = linphone_chat_room_get_subject(_room) - ? [NSString stringWithUTF8String:linphone_chat_room_get_subject(_room)] - : @""; - } - + _nameLabel.text = _room && linphone_chat_room_get_subject(_room) + ? [NSString stringWithUTF8String:linphone_chat_room_get_subject(_room)] + : @""; _nextButton.enabled = _nameLabel.text.length > 0 && _contacts.count > 0; LinphoneParticipant *me = _room && (linphone_chat_room_get_state(_room) == LinphoneChatRoomStateCreated) ? linphone_chat_room_get_me(_room) : NULL; - _imAdmin = me ? linphone_participant_is_admin(me) : false; @@ -81,7 +77,6 @@ static UICompositeViewDescription *compositeDescription = nil; CGFloat height = _quitButton.hidden ? self.view.frame.size.height - _tableView.frame.origin.y : _quitButton.frame.origin.y - _tableView.frame.origin.y - 10; - [_tableView setFrame:CGRectMake( _tableView.frame.origin.x, _tableView.frame.origin.y, diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index 1de3c207f..3f0d2e232 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -373,12 +373,12 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)updateSuperposedButtons { [_backToCallButton update]; - _infoButton.hidden = (linphone_chat_room_get_nb_participants(_chatRoom) == 1) || !_backToCallButton.hidden || _tableController.tableView.isEditing; + _infoButton.hidden = (strcmp(linphone_chat_room_get_subject(_chatRoom) ?: "dummy subject", "dummy subject") == 0) || !_backToCallButton.hidden || _tableController.tableView.isEditing; _callButton.hidden = !_backToCallButton.hidden || !_infoButton.hidden || _tableController.tableView.isEditing; } - (void)updateParticipantLabel { - if (linphone_chat_room_get_nb_participants(_chatRoom) == 1) { + if (strcmp(linphone_chat_room_get_subject(_chatRoom) ?: "dummy subject", "dummy subject") == 0) { _particpantsLabel.hidden = TRUE; } else { _particpantsLabel.hidden = FALSE; diff --git a/Classes/LinphoneUI/UIChatCell.m b/Classes/LinphoneUI/UIChatCell.m index d619d2a53..5b4e8822c 100644 --- a/Classes/LinphoneUI/UIChatCell.m +++ b/Classes/LinphoneUI/UIChatCell.m @@ -64,14 +64,15 @@ return; } - if(linphone_chat_room_get_nb_participants(chatRoom) > 1) { - _addressLabel.text = [NSString stringWithUTF8String:linphone_chat_room_get_subject(chatRoom) ? linphone_chat_room_get_subject(chatRoom) : "dummy subject"]; + const char *subject = linphone_chat_room_get_subject(chatRoom) ?: "dummy subject"; + if (strcmp(subject, "dummy subject") != 0) { + _addressLabel.text = [NSString stringWithUTF8String:subject]; [_avatarImage setImage:[UIImage imageNamed:@"chat_group_avatar.png"] bordered:NO withRoundedRadius:YES]; } else { - if(linphone_chat_room_get_participants(chatRoom) != NULL) { + if (linphone_chat_room_get_participants(chatRoom) != NULL) { LinphoneParticipant *participant = linphone_chat_room_get_participants(chatRoom)->data; const LinphoneAddress *addr = linphone_participant_get_address(participant); - if(addr) { + if (addr) { [ContactDisplay setDisplayNameLabel:_addressLabel forAddress:addr]; [_avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:NO withRoundedRadius:YES]; } diff --git a/submodules/linphone b/submodules/linphone index b0bf790f6..e536ded32 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit b0bf790f6ba4fefbe08105c711290c73be2ab80f +Subproject commit e536ded32d85483e834f541ef3986a6ae13bf618