better condition to differentiate simple from group chat rooms

This commit is contained in:
Benjamin Reis 2017-11-23 16:40:30 +01:00
parent 73913ba4d8
commit fda16165ce
5 changed files with 16 additions and 9 deletions

View file

@ -102,7 +102,7 @@ void create_chat_room_state_changed(LinphoneChatRoom *cr, LinphoneChatRoomState
- (void)createChatRoom {
_waitView.hidden = NO;
LinphoneChatRoom *room = linphone_core_create_client_group_chat_room(LC, "dummy subject");
LinphoneChatRoom *room = linphone_core_create_client_group_chat_room(LC, LINPHONE_DUMMY_SUBJECT);
NSString *addr = _tableController.contactsGroup[0];
LinphoneAddress *linphoneAddress = linphone_address_new(addr.UTF8String);
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(room);

View file

@ -131,8 +131,9 @@ static UICompositeViewDescription *compositeDescription = nil;
[_pictureButton setEnabled:fileSharingEnabled];
[self callUpdateEvent:nil];
PhoneMainView.instance.currentRoom = self.chatRoom;
if (strcmp(linphone_chat_room_get_subject(_chatRoom) ?: "dummy subject", "dummy subject") != 0)
PhoneMainView.instance.currentRoom = _chatRoom;
if (linphone_chat_room_can_handle_participants(_chatRoom)
&& (strcmp(linphone_chat_room_get_subject(_chatRoom) ?: LINPHONE_DUMMY_SUBJECT, LINPHONE_DUMMY_SUBJECT) != 0 || linphone_chat_room_get_nb_participants(_chatRoom) > 1))
_addressLabel.text = [NSString stringWithUTF8String:linphone_chat_room_get_subject(_chatRoom)];
else {
const LinphoneAddress *addr = linphone_participant_get_address(linphone_chat_room_get_participants(_chatRoom)->data);
@ -375,12 +376,16 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)updateSuperposedButtons {
[_backToCallButton update];
_infoButton.hidden = (strcmp(linphone_chat_room_get_subject(_chatRoom) ?: "dummy subject", "dummy subject") == 0) || !_backToCallButton.hidden || _tableController.tableView.isEditing;
_infoButton.hidden = (!linphone_chat_room_can_handle_participants(_chatRoom)
|| (strcmp(linphone_chat_room_get_subject(_chatRoom) ?: LINPHONE_DUMMY_SUBJECT, LINPHONE_DUMMY_SUBJECT) == 0 && linphone_chat_room_get_nb_participants(_chatRoom) == 1)
|| !_backToCallButton.hidden
|| _tableController.tableView.isEditing);
_callButton.hidden = !_backToCallButton.hidden || !_infoButton.hidden || _tableController.tableView.isEditing;
}
- (void)updateParticipantLabel {
if (strcmp(linphone_chat_room_get_subject(_chatRoom) ?: "dummy subject", "dummy subject") == 0) {
if (!linphone_chat_room_can_handle_participants(_chatRoom)
|| (strcmp(linphone_chat_room_get_subject(_chatRoom) ?: LINPHONE_DUMMY_SUBJECT, LINPHONE_DUMMY_SUBJECT) == 0 && linphone_chat_room_get_nb_participants(_chatRoom) == 1)) {
_particpantsLabel.hidden = TRUE;
} else {
_particpantsLabel.hidden = FALSE;

View file

@ -64,8 +64,8 @@
return;
}
const char *subject = linphone_chat_room_get_subject(chatRoom) ?: "dummy subject";
if (strcmp(subject, "dummy subject") != 0) {
const char *subject = linphone_chat_room_get_subject(chatRoom) ?: LINPHONE_DUMMY_SUBJECT;
if (linphone_chat_room_can_handle_participants(chatRoom) && (strcmp(subject, LINPHONE_DUMMY_SUBJECT) != 0 || linphone_chat_room_get_nb_participants(chatRoom) > 1)) {
_addressLabel.text = [NSString stringWithUTF8String:subject];
[_avatarImage setImage:[UIImage imageNamed:@"chat_group_avatar.png"] bordered:NO withRoundedRadius:YES];
} else {
@ -77,7 +77,7 @@
[_avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:NO withRoundedRadius:YES];
}
} else {
_addressLabel.text = [NSString stringWithUTF8String:"dummy subject"];
_addressLabel.text = [NSString stringWithUTF8String:LINPHONE_DUMMY_SUBJECT];
}
}

View file

@ -57,6 +57,8 @@
#define VIEW(x) \
DYNAMIC_CAST([PhoneMainView.instance.mainViewController getCachedController:x.compositeViewDescription.name], x)
#define LINPHONE_DUMMY_SUBJECT "dummy subject"
@class PhoneMainView;
@interface RootViewManager : NSObject

@ -1 +1 @@
Subproject commit 97cd45702cc7c7774807d4b0e97e332c2373286f
Subproject commit 60915d8a159424576ad3db515a91cf49d7aad286