mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
fix UI crashes concerning group chat
This commit is contained in:
parent
d0d6d86537
commit
7024dd3a5a
4 changed files with 21 additions and 7 deletions
|
|
@ -73,6 +73,9 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
bctbx_list_t *addresses = NULL;
|
||||
for(NSString *addr in _contacts.allKeys) {
|
||||
LinphoneAddress *linphoneAddress = linphone_address_new(addr.UTF8String);
|
||||
if (!linphoneAddress)
|
||||
continue;
|
||||
|
||||
if (!addresses) {
|
||||
addresses = bctbx_list_new((void *)linphoneAddress);
|
||||
continue;
|
||||
|
|
@ -105,6 +108,9 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
view.tableController.contactsGroup = [[_contacts allKeys] mutableCopy];
|
||||
view.tableController.notFirstTime = TRUE;
|
||||
[PhoneMainView.instance popToView:view.compositeViewDescription];
|
||||
} else {
|
||||
ChatConversationView *view = VIEW(ChatConversationView);
|
||||
[PhoneMainView.instance popToView:view.compositeViewDescription];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
#include "linphone/linphonecore.h"
|
||||
|
||||
#import "linphone/c-event-log.h"
|
||||
#import "linphone/c-chat-room.h"
|
||||
|
||||
#import "UICheckBoxTableView.h"
|
||||
|
||||
@protocol ChatConversationDelegate <NSObject>
|
||||
|
|
|
|||
|
|
@ -129,9 +129,10 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
|
||||
[self callUpdateEvent:nil];
|
||||
PhoneMainView.instance.currentRoom = self.chatRoom;
|
||||
_addressLabel.text = [NSString stringWithUTF8String:linphone_chat_room_get_subject(_chatRoom)];
|
||||
if (linphone_chat_room_get_subject(_chatRoom))
|
||||
_addressLabel.text = [NSString stringWithUTF8String:linphone_chat_room_get_subject(_chatRoom)];
|
||||
|
||||
if (linphone_chat_room_get_nb_participants(_chatRoom) == 1) {
|
||||
if (!linphone_chat_room_can_handle_participants(_chatRoom)) {
|
||||
_particpantsLabel.hidden = TRUE;
|
||||
} else {
|
||||
_particpantsLabel.hidden = FALSE;
|
||||
|
|
@ -142,7 +143,9 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
if (![_particpantsLabel.text isEqualToString:@""])
|
||||
_particpantsLabel.text = [_particpantsLabel.text stringByAppendingString:@", "];
|
||||
|
||||
_particpantsLabel.text = [_particpantsLabel.text stringByAppendingString:[NSString stringWithUTF8String:linphone_address_get_display_name(linphone_participant_get_address(participant))]];
|
||||
_particpantsLabel.text = [_particpantsLabel.text stringByAppendingString:[NSString stringWithUTF8String:linphone_address_get_display_name(linphone_participant_get_address(participant))
|
||||
? linphone_address_get_display_name(linphone_participant_get_address(participant))
|
||||
: linphone_address_get_username(linphone_participant_get_address(participant))]];
|
||||
participants = participants->next;
|
||||
}
|
||||
}
|
||||
|
|
@ -356,7 +359,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
|
||||
- (void)updateSuperposedButtons {
|
||||
[_backToCallButton update];
|
||||
_infoButton.hidden = (linphone_chat_room_get_nb_participants(_chatRoom) == 1) || !_backToCallButton.hidden;
|
||||
_infoButton.hidden = !linphone_chat_room_can_handle_participants(_chatRoom) || !_backToCallButton.hidden;
|
||||
_callButton.hidden = !_backToCallButton.hidden && !_infoButton.hidden;
|
||||
}
|
||||
|
||||
|
|
@ -523,7 +526,9 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
bctbx_list_t *participants = linphone_chat_room_get_participants(_chatRoom);
|
||||
while (participants) {
|
||||
LinphoneParticipant *participant = (LinphoneParticipant *)participants->data;
|
||||
NSString *name = [NSString stringWithUTF8String:linphone_address_get_display_name(linphone_participant_get_address(participant))];
|
||||
NSString *name = [NSString stringWithUTF8String:linphone_address_get_display_name(linphone_participant_get_address(participant))
|
||||
? linphone_address_get_display_name(linphone_participant_get_address(participant))
|
||||
: linphone_address_get_username(linphone_participant_get_address(participant))];
|
||||
NSString *uri = [NSString stringWithUTF8String:linphone_address_as_string_uri_only(linphone_participant_get_address(participant))];
|
||||
[contactsDict setObject:name forKey:uri];
|
||||
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@
|
|||
return;
|
||||
}
|
||||
|
||||
if(linphone_chat_room_get_nb_participants(chatRoom) > 1) {
|
||||
_addressLabel.text = [NSString stringWithUTF8String:linphone_chat_room_get_subject(chatRoom)];
|
||||
if(linphone_chat_room_can_handle_participants(chatRoom)) {
|
||||
_addressLabel.text = [NSString stringWithUTF8String:linphone_chat_room_get_subject(chatRoom) ? linphone_chat_room_get_subject(chatRoom) : "No subject"];
|
||||
[_avatarImage setImage:[UIImage imageNamed:@"chat_group_avatar.png"] bordered:NO withRoundedRadius:YES];
|
||||
} else {
|
||||
const LinphoneAddress *addr = linphone_chat_room_get_peer_address(chatRoom);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue