From 14b172f2adf7ec859c96b42eeb16b53d123badc9 Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Fri, 25 Jan 2019 10:55:19 +0100 Subject: [PATCH] update Imdn status --- Classes/ChatConversationImdnView.h | 1 + Classes/ChatConversationImdnView.m | 16 +++++++++++----- Classes/LinphoneUI/UIChatBubbleTextCell.m | 6 ++++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Classes/ChatConversationImdnView.h b/Classes/ChatConversationImdnView.h index ea0991871..2d6b9d84c 100644 --- a/Classes/ChatConversationImdnView.h +++ b/Classes/ChatConversationImdnView.h @@ -34,6 +34,7 @@ @property (weak, nonatomic) IBOutlet UITableView *tableView; - (IBAction)onBackClick:(id)sender; +- (void)updateImdnList; @end diff --git a/Classes/ChatConversationImdnView.m b/Classes/ChatConversationImdnView.m index 703a4f3fc..60c075085 100644 --- a/Classes/ChatConversationImdnView.m +++ b/Classes/ChatConversationImdnView.m @@ -54,12 +54,18 @@ static UICompositeViewDescription *compositeDescription = nil; _tableView.delegate = self; _tableView.dataSource = self; - _displayedList = linphone_chat_message_get_participants_by_imdn_state(_msg, LinphoneChatMessageStateDisplayed); - _receivedList = linphone_chat_message_get_participants_by_imdn_state(_msg, LinphoneChatMessageStateDeliveredToUser); - _notReceivedList = linphone_chat_message_get_participants_by_imdn_state(_msg, LinphoneChatMessageStateDelivered); - _errorList = linphone_chat_message_get_participants_by_imdn_state(_msg, LinphoneChatMessageStateNotDelivered); + [self updateImdnList]; +} - [_tableView reloadData]; +- (void)updateImdnList { + if (_msg) { + _displayedList = linphone_chat_message_get_participants_by_imdn_state(_msg, LinphoneChatMessageStateDisplayed); + _receivedList = linphone_chat_message_get_participants_by_imdn_state(_msg, LinphoneChatMessageStateDeliveredToUser); + _notReceivedList = linphone_chat_message_get_participants_by_imdn_state(_msg, LinphoneChatMessageStateDelivered); + _errorList = linphone_chat_message_get_participants_by_imdn_state(_msg, LinphoneChatMessageStateNotDelivered); + + [_tableView reloadData]; + } } - (void)fitContent { diff --git a/Classes/LinphoneUI/UIChatBubbleTextCell.m b/Classes/LinphoneUI/UIChatBubbleTextCell.m index 93093ec74..281602762 100644 --- a/Classes/LinphoneUI/UIChatBubbleTextCell.m +++ b/Classes/LinphoneUI/UIChatBubbleTextCell.m @@ -88,6 +88,7 @@ linphone_chat_message_set_user_data(_message, (void *)CFBridgingRetain(self)); LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(_message); linphone_chat_message_cbs_set_msg_state_changed(cbs, message_status); + linphone_chat_message_cbs_set_participant_imdn_state_changed(cbs, participant_imdn_status); linphone_chat_message_cbs_set_user_data(cbs, (void *)_event); } @@ -369,6 +370,11 @@ static void message_status(LinphoneChatMessage *msg, LinphoneChatMessageState st [view.tableController updateEventEntry:event]; } +static void participant_imdn_status(LinphoneChatMessage* msg, const LinphoneParticipantImdnState *state) { + ChatConversationImdnView *imdnView = VIEW(ChatConversationImdnView); + [imdnView updateImdnList]; +} + - (void)displayImdmStatus:(LinphoneChatMessageState)state { if (state == LinphoneChatMessageStateDeliveredToUser) { [_imdmIcon setImage:[UIImage imageNamed:@"chat_delivered"]];