From 8e855e236408a7b9a7d906ff7f3ce63413d0419d Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Tue, 13 Feb 2018 15:56:57 +0100 Subject: [PATCH] keep enhancing chatroom sorting --- Classes/ChatsListTableView.m | 21 +++++++-------------- Classes/LinphoneUI/UIChatCell.m | 7 +------ submodules/linphone | 2 +- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/Classes/ChatsListTableView.m b/Classes/ChatsListTableView.m index 82ab1bbf9..cdce49b52 100644 --- a/Classes/ChatsListTableView.m +++ b/Classes/ChatsListTableView.m @@ -84,21 +84,14 @@ #pragma mark - static int sorted_history_comparison(LinphoneChatRoom *to_insert, LinphoneChatRoom *elem) { - LinphoneEventLog *last_new_event = (LinphoneEventLog *)linphone_chat_room_get_history_events(to_insert, 1) ? linphone_chat_room_get_history_events(to_insert, 1)->data : NULL; - LinphoneEventLog *last_elem_event = (LinphoneEventLog *)linphone_chat_room_get_history_events(elem, 1) ? linphone_chat_room_get_history_events(elem, 1)->data : NULL; - - if (last_new_event && last_elem_event) { - time_t new = linphone_event_log_get_creation_time(last_new_event); - time_t old = linphone_event_log_get_creation_time(last_elem_event); - if (new < old) - return 1; - else if (new > old) - return -1; - } - if (last_new_event) + time_t new = linphone_chat_room_get_last_update_time(to_insert); + time_t old = linphone_chat_room_get_last_update_time(elem); + if (new < old) + return 1; + else if (new > old) return -1; - - return 1; + + return 0; } - (MSList *)sortChatRooms { diff --git a/Classes/LinphoneUI/UIChatCell.m b/Classes/LinphoneUI/UIChatCell.m index c75099545..be0f0da0e 100644 --- a/Classes/LinphoneUI/UIChatCell.m +++ b/Classes/LinphoneUI/UIChatCell.m @@ -81,12 +81,7 @@ [_avatarImage setImage:[UIImage imageNamed:@"chat_group_avatar.png"] bordered:NO withRoundedRadius:YES]; } - LinphoneEventLog *last_event = (LinphoneEventLog *)linphone_chat_room_get_history_events(chatRoom, 1) - ? linphone_chat_room_get_history_events(chatRoom, 1)->data - : NULL; - _chatLatestTimeLabel.hidden = !last_event; - if (last_event) - _chatLatestTimeLabel.text = [LinphoneUtils timeToString:linphone_event_log_get_creation_time(last_event) withFormat:LinphoneDateChatList]; + _chatLatestTimeLabel.text = [LinphoneUtils timeToString:linphone_chat_room_get_last_update_time(chatRoom) withFormat:LinphoneDateChatList]; LinphoneChatMessage *last_msg = linphone_chat_room_get_last_message_in_history(chatRoom); if (last_msg) { diff --git a/submodules/linphone b/submodules/linphone index 107aa11e1..9f5a74bd4 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 107aa11e139df6b3ab76f18930e75b9129bcbad7 +Subproject commit 9f5a74bd4232c14d9be52dd81aea4bf4cc03402b