Browse Source

Fixing issue with message ordering.

pull/1/head
Frederic Jacobs 6 years ago
parent
commit
eb94a1114a
  1. 11
      Signal/src/textsecure/Contacts/TSThread.m

11
Signal/src/textsecure/Contacts/TSThread.m

@ -118,9 +118,16 @@
- (void)updateWithLastMessage:(TSInteraction *)lastMessage transaction:(YapDatabaseReadWriteTransaction *)transaction
{
if (!_lastMessageDate || [lastMessage.date timeIntervalSinceDate:self.lastMessageDate] > 0) {
NSDate *lastMessageDate = lastMessage.date;
if ([lastMessage isKindOfClass:[TSIncomingMessage class]]) {
TSIncomingMessage *message = (TSIncomingMessage*)lastMessage;
lastMessageDate = message.receivedAt;
}
if (!_lastMessageDate || [lastMessageDate timeIntervalSinceDate:self.lastMessageDate] > 0) {
_latestMessageId = lastMessage.uniqueId;
_lastMessageDate = lastMessage.date;
_lastMessageDate = lastMessageDate;
[self saveWithTransaction:transaction];
}

Loading…
Cancel
Save