diff --git a/Classes/ChatsListTableView.m b/Classes/ChatsListTableView.m index 661d95815..82ab1bbf9 100644 --- a/Classes/ChatsListTableView.m +++ b/Classes/ChatsListTableView.m @@ -96,9 +96,9 @@ static int sorted_history_comparison(LinphoneChatRoom *to_insert, LinphoneChatRo return -1; } if (last_new_event) - return 1; + return -1; - return -1; + return 1; } - (MSList *)sortChatRooms { diff --git a/Classes/LinphoneUI/UIChatCell.m b/Classes/LinphoneUI/UIChatCell.m index 720b420ca..c75099545 100644 --- a/Classes/LinphoneUI/UIChatCell.m +++ b/Classes/LinphoneUI/UIChatCell.m @@ -81,12 +81,13 @@ [_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; - if (last_event) { - _chatLatestTimeLabel.text = - [LinphoneUtils timeToString:linphone_event_log_get_creation_time(last_event) withFormat:LinphoneDateChatList]; - _chatLatestTimeLabel.hidden = NO; - } + 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]; + LinphoneChatMessage *last_msg = linphone_chat_room_get_last_message_in_history(chatRoom); if (last_msg) { NSString *message = [UIChatBubbleTextCell TextMessageForChat:last_msg];