From e9252e2cf1294d78a31946c9f44619cb6db00ba7 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Mon, 30 Apr 2018 15:20:56 +0200 Subject: [PATCH] do not crash when displaying imdn of a file transfer --- Classes/ChatConversationImdnView.m | 6 ++++- Classes/LinphoneUI/UIChatBubbleTextCell.m | 2 +- .../UIChatConversationImdnTableViewCell.xib | 22 +++++++++---------- linphone-Info.plist | 2 +- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Classes/ChatConversationImdnView.m b/Classes/ChatConversationImdnView.m index b7d8015cb..ef40eaa4b 100644 --- a/Classes/ChatConversationImdnView.m +++ b/Classes/ChatConversationImdnView.m @@ -47,7 +47,11 @@ static UICompositeViewDescription *compositeDescription = nil; [LinphoneUtils timeToString:linphone_chat_message_get_time(_msg) withFormat:LinphoneDateChatBubble], [FastAddressBook displayNameForAddress:addr]]; _msgAvatarImage.image = outgoing ? [LinphoneUtils selfAvatar] : [FastAddressBook imageForAddress:addr]; - _msgText.text = [NSString stringWithUTF8String:linphone_chat_message_get_text(_msg)]; + if (linphone_chat_message_has_text_content(_msg)) + _msgText.text = [NSString stringWithUTF8String:linphone_chat_message_get_text(_msg)]; + else + _msgText.text = [NSString stringWithUTF8String: linphone_content_get_name(linphone_chat_message_get_file_transfer_information(_msg))]; + _msgBackgroundColorImage.image = _msgBottomBar.image = [UIImage imageNamed:(outgoing ? @"color_A.png" : @"color_D.png")]; _msgDateLabel.textColor = [UIColor colorWithPatternImage:_msgBackgroundColorImage.image]; [_msgView setFrame:CGRectMake(_msgView.frame.origin.x, diff --git a/Classes/LinphoneUI/UIChatBubbleTextCell.m b/Classes/LinphoneUI/UIChatBubbleTextCell.m index 1120a150f..213abcaad 100644 --- a/Classes/LinphoneUI/UIChatBubbleTextCell.m +++ b/Classes/LinphoneUI/UIChatBubbleTextCell.m @@ -148,7 +148,7 @@ if (outgoing) { _avatarImage.image = [LinphoneUtils selfAvatar]; } else { - [_avatarImage setImage:[FastAddressBook imageForAddress:linphone_chat_message_get_peer_address(_message)] + [_avatarImage setImage:[FastAddressBook imageForAddress:linphone_chat_message_get_from_address(_message)] bordered:NO withRoundedRadius:YES]; } diff --git a/Classes/LinphoneUI/UIChatConversationImdnTableViewCell.xib b/Classes/LinphoneUI/UIChatConversationImdnTableViewCell.xib index 517e27a99..8b0ef11fe 100644 --- a/Classes/LinphoneUI/UIChatConversationImdnTableViewCell.xib +++ b/Classes/LinphoneUI/UIChatConversationImdnTableViewCell.xib @@ -1,5 +1,5 @@ - + @@ -24,20 +24,20 @@ -