minor fix on conversation ordering

This commit is contained in:
ryanzhao 2021-10-05 15:09:11 +11:00
parent c85b9020b9
commit f51651ce8e
2 changed files with 15 additions and 3 deletions

View File

@ -278,8 +278,18 @@ NSString *const TSLazyRestoreAttachmentsGroup = @"TSLazyRestoreAttachmentsGroup"
TSThread *thread1 = (TSThread *)object1;
TSThread *thread2 = (TSThread *)object2;
if ([group isEqualToString:TSArchiveGroup] || [group isEqualToString:TSInboxGroup]) {
NSDate *date1 = thread1.lastInteractionDate ?: thread1.creationDate;
NSDate *date2 = thread2.lastInteractionDate ?: thread2.creationDate;
TSInteraction *_Nullable lastInteractionForInbox1 =
[thread1 lastInteractionForInboxWithTransaction:transaction];
NSDate *lastInteractionForInboxDate1 = lastInteractionForInbox1 ? lastInteractionForInbox1.receivedAtDate : thread1.creationDate;
TSInteraction *_Nullable lastInteractionForInbox2 =
[thread2 lastInteractionForInboxWithTransaction:transaction];
NSDate *lastInteractionForInboxDate2 = lastInteractionForInbox2 ? lastInteractionForInbox2.receivedAtDate : thread2.creationDate;
NSDate *date1 = thread1.lastInteractionDate ?: lastInteractionForInboxDate1 ?: thread1.creationDate;
NSDate *date2 = thread2.lastInteractionDate ?: lastInteractionForInboxDate2 ?: thread2.creationDate;
return [date1 compare:date2];
}

View File

@ -357,7 +357,9 @@ BOOL IsNoteToSelfEnabled(void)
return;
}
_lastInteractionDate = lastMessage.receivedAtDate;
if ([_lastInteractionDate compare: lastMessage.receivedAtDate] == NSOrderedAscending) {
_lastInteractionDate = lastMessage.receivedAtDate;
}
if (!self.shouldBeVisible) {
self.shouldBeVisible = YES;