prevent disappearing message affecting the order of conversations
This commit is contained in:
parent
49688c0a2d
commit
ceb88f3d00
|
@ -278,15 +278,8 @@ NSString *const TSLazyRestoreAttachmentsGroup = @"TSLazyRestoreAttachmentsGroup"
|
||||||
TSThread *thread1 = (TSThread *)object1;
|
TSThread *thread1 = (TSThread *)object1;
|
||||||
TSThread *thread2 = (TSThread *)object2;
|
TSThread *thread2 = (TSThread *)object2;
|
||||||
if ([group isEqualToString:TSArchiveGroup] || [group isEqualToString:TSInboxGroup]) {
|
if ([group isEqualToString:TSArchiveGroup] || [group isEqualToString:TSInboxGroup]) {
|
||||||
|
NSDate *date1 = thread1.lastInteractionDate ?: thread1.creationDate;
|
||||||
TSInteraction *_Nullable lastInteractionForInbox1 =
|
NSDate *date2 = thread2.lastInteractionDate ?: thread2.creationDate;
|
||||||
[thread1 lastInteractionForInboxWithTransaction:transaction];
|
|
||||||
NSDate *date1 = lastInteractionForInbox1 ? lastInteractionForInbox1.receivedAtDate : thread1.creationDate;
|
|
||||||
|
|
||||||
TSInteraction *_Nullable lastInteractionForInbox2 =
|
|
||||||
[thread2 lastInteractionForInboxWithTransaction:transaction];
|
|
||||||
NSDate *date2 = lastInteractionForInbox2 ? lastInteractionForInbox2.receivedAtDate : thread2.creationDate;
|
|
||||||
|
|
||||||
return [date1 compare:date2];
|
return [date1 compare:date2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ BOOL IsNoteToSelfEnabled(void);
|
||||||
|
|
||||||
@property (nonatomic) BOOL shouldBeVisible;
|
@property (nonatomic) BOOL shouldBeVisible;
|
||||||
@property (nonatomic, readonly) NSDate *creationDate;
|
@property (nonatomic, readonly) NSDate *creationDate;
|
||||||
|
@property (nonatomic, readonly, nullable) NSDate *lastInteractionDate;
|
||||||
@property (nonatomic, readonly) TSInteraction *lastInteraction;
|
@property (nonatomic, readonly) TSInteraction *lastInteraction;
|
||||||
@property (atomic, readonly) BOOL isMuted;
|
@property (atomic, readonly) BOOL isMuted;
|
||||||
@property (atomic, readonly, nullable) NSDate *mutedUntilDate;
|
@property (atomic, readonly, nullable) NSDate *mutedUntilDate;
|
||||||
|
|
|
@ -21,6 +21,7 @@ BOOL IsNoteToSelfEnabled(void)
|
||||||
@interface TSThread ()
|
@interface TSThread ()
|
||||||
|
|
||||||
@property (nonatomic) NSDate *creationDate;
|
@property (nonatomic) NSDate *creationDate;
|
||||||
|
@property (nonatomic, nullable) NSDate *lastInteractionDate;
|
||||||
@property (nonatomic, nullable) NSNumber *archivedAsOfMessageSortId;
|
@property (nonatomic, nullable) NSNumber *archivedAsOfMessageSortId;
|
||||||
@property (nonatomic, copy, nullable) NSString *messageDraft;
|
@property (nonatomic, copy, nullable) NSString *messageDraft;
|
||||||
@property (atomic, nullable) NSDate *mutedUntilDate;
|
@property (atomic, nullable) NSDate *mutedUntilDate;
|
||||||
|
@ -355,6 +356,8 @@ BOOL IsNoteToSelfEnabled(void)
|
||||||
if (![self.class shouldInteractionAppearInInbox:lastMessage]) {
|
if (![self.class shouldInteractionAppearInInbox:lastMessage]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_lastInteractionDate = lastMessage.receivedAtDate;
|
||||||
|
|
||||||
if (!self.shouldBeVisible) {
|
if (!self.shouldBeVisible) {
|
||||||
self.shouldBeVisible = YES;
|
self.shouldBeVisible = YES;
|
||||||
|
|
Loading…
Reference in New Issue