mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Add IMDN callback and refresh IMDN icon in UIChatCell
This commit is contained in:
parent
b6686dd2da
commit
46af917c6e
4 changed files with 37 additions and 0 deletions
|
|
@ -31,4 +31,5 @@
|
|||
|
||||
- (void)loadData;
|
||||
- (void)markCellAsRead:(LinphoneChatRoom *)chatRoom;
|
||||
- (void)updateEventEntry:(LinphoneChatMessage *)msg;
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -138,6 +138,16 @@ static int sorted_history_comparison(LinphoneChatRoom *to_insert, LinphoneChatRo
|
|||
}
|
||||
}
|
||||
|
||||
- (void)updateEventEntry:(LinphoneChatMessage *)msg {
|
||||
int idx = bctbx_list_index(_data, linphone_chat_message_get_chat_room(msg));
|
||||
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:idx inSection:0];
|
||||
if (idx < 0) {
|
||||
LOGW(@"event entry doesn't exist");
|
||||
return;
|
||||
}
|
||||
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:FALSE];
|
||||
}
|
||||
|
||||
- (void)markCellAsRead:(LinphoneChatRoom *)chatRoom {
|
||||
int idx = bctbx_list_index(_data, VIEW(ChatConversationView).chatRoom);
|
||||
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:idx inSection:0];
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
LinphoneChatRoom *chatRoom;
|
||||
}
|
||||
|
||||
@property(readonly, nonatomic) LinphoneEventLog *event;
|
||||
@property(nonatomic, strong) IBOutlet UIRoundedImageView *avatarImage;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *securityImage;
|
||||
@property(nonatomic, strong) IBOutlet UILabel *addressLabel;
|
||||
|
|
|
|||
|
|
@ -123,6 +123,13 @@
|
|||
_chatContentLabel.attributedText = boldText;
|
||||
}
|
||||
|
||||
if (outgoing){
|
||||
linphone_chat_message_set_user_data(last_msg, (void *)CFBridgingRetain(self));
|
||||
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(last_msg);
|
||||
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);
|
||||
}
|
||||
|
||||
LinphoneChatMessageState state = linphone_chat_message_get_state(last_msg);
|
||||
if (outgoing && (state == LinphoneChatMessageStateDeliveredToUser || state == LinphoneChatMessageStateDisplayed || state == LinphoneChatMessageStateNotDelivered || state == LinphoneChatMessageStateFileTransferError)) {
|
||||
|
|
@ -221,4 +228,22 @@
|
|||
}
|
||||
}
|
||||
|
||||
static void message_status(LinphoneChatMessage *msg, LinphoneChatMessageState state) {
|
||||
LOGI(@"State for message [%p] changed to %s", msg, linphone_chat_message_state_to_string(state));
|
||||
if (state == LinphoneChatMessageStateFileTransferInProgress)
|
||||
return;
|
||||
|
||||
if (!linphone_chat_message_is_outgoing(msg) || (state != LinphoneChatMessageStateFileTransferDone && state != LinphoneChatMessageStateFileTransferInProgress)) {
|
||||
ChatsListView *view = VIEW(ChatsListView);
|
||||
[view.tableController updateEventEntry:msg];
|
||||
}
|
||||
}
|
||||
|
||||
static void participant_imdn_status(LinphoneChatMessage* msg, const LinphoneParticipantImdnState *state) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
ChatConversationImdnView *imdnView = VIEW(ChatConversationImdnView);
|
||||
[imdnView updateImdnList];
|
||||
});
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue