From 368f1e1810bda7b44faaf5d2ad18db2b590e171a Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Fri, 5 Mar 2021 09:36:15 +0100 Subject: [PATCH] fix isFirst chat cell not showed correctly --- Classes/ChatConversationTableView.m | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Classes/ChatConversationTableView.m b/Classes/ChatConversationTableView.m index 781fe0360..031aa723a 100644 --- a/Classes/ChatConversationTableView.m +++ b/Classes/ChatConversationTableView.m @@ -193,12 +193,11 @@ static const int BASIC_EVENT_LIST=15; - (BOOL)isFirstIndexInTableView:(NSIndexPath *)indexPath chat:(LinphoneChatMessage *)chat { LinphoneEventLog *previousEvent = nil; NSInteger indexOfPreviousEvent = indexPath.row - 1; - while (!previousEvent && indexOfPreviousEvent > -1) { - LinphoneEventLog *tmp = [[eventList objectAtIndex:indexOfPreviousEvent] pointerValue]; - if (linphone_event_log_get_type(tmp) == LinphoneEventLogTypeConferenceChatMessage) { - previousEvent = tmp; + if (indexOfPreviousEvent > -1) { + previousEvent = [[eventList objectAtIndex:indexOfPreviousEvent] pointerValue]; + if (linphone_event_log_get_type(previousEvent) != LinphoneEventLogTypeConferenceChatMessage) { + return TRUE; } - --indexOfPreviousEvent; } if (!previousEvent) return TRUE;