fix get the first chat message correctly in chatsTable

This commit is contained in:
Danmei Chen 2018-11-02 11:28:33 +01:00
parent bda4e22278
commit 9645f1bb3e

View file

@ -167,9 +167,6 @@
}
- (BOOL)isFirstIndexInTableView:(NSIndexPath *)indexPath chat:(LinphoneChatMessage *)chat {
if (indexPath.row == 0)
return TRUE;
LinphoneEventLog *previousEvent = nil;
NSInteger indexOfPreviousEvent = indexPath.row - 1;
while (!previousEvent && indexOfPreviousEvent > -1) {
@ -179,11 +176,12 @@
}
--indexOfPreviousEvent;
}
if (previousEvent) {
LinphoneChatMessage *previousChat = linphone_event_log_get_chat_message(previousEvent);
if (!linphone_address_equal(linphone_chat_message_get_from_address(previousChat), linphone_chat_message_get_from_address(chat))) {
return TRUE;
}
if (!previousEvent)
return TRUE;
LinphoneChatMessage *previousChat = linphone_event_log_get_chat_message(previousEvent);
if (!linphone_address_equal(linphone_chat_message_get_from_address(previousChat), linphone_chat_message_get_from_address(chat))) {
return TRUE;
}
return FALSE;