mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Fix "missed calls" not sorting threads
Ensure we touch thread after saving *any* interaction
This commit is contained in:
parent
273974880d
commit
a1b412c704
7 changed files with 14 additions and 28 deletions
|
@ -429,6 +429,8 @@ ConversationColorName const kConversationColorName_Default = ConversationColorNa
|
|||
if (!self.shouldThreadBeVisible) {
|
||||
self.shouldThreadBeVisible = YES;
|
||||
[self saveWithTransaction:transaction];
|
||||
} else {
|
||||
[self touchWithTransaction:transaction];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -218,7 +218,6 @@ NSUInteger TSErrorMessageSchemaVersion = 1;
|
|||
OWSLogDebug(@"marking as read uniqueId: %@ which has timestamp: %llu", self.uniqueId, self.timestamp);
|
||||
_read = YES;
|
||||
[self saveWithTransaction:transaction];
|
||||
[self touchThreadWithTransaction:transaction];
|
||||
|
||||
// Ignore sendReadReceipt - it doesn't apply to error messages.
|
||||
}
|
||||
|
|
|
@ -158,7 +158,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
secondsAgoRead);
|
||||
_read = YES;
|
||||
[self saveWithTransaction:transaction];
|
||||
[self touchThreadWithTransaction:transaction];
|
||||
|
||||
[transaction addCompletionQueue:nil
|
||||
completionBlock:^{
|
||||
|
|
|
@ -181,7 +181,6 @@ NSUInteger TSInfoMessageSchemaVersion = 1;
|
|||
OWSLogDebug(@"marking as read uniqueId: %@ which has timestamp: %llu", self.uniqueId, self.timestamp);
|
||||
_read = YES;
|
||||
[self saveWithTransaction:transaction];
|
||||
[self touchThreadWithTransaction:transaction];
|
||||
|
||||
// Ignore sendReadReceipt, it doesn't apply to info messages.
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TSInteraction.h"
|
||||
|
@ -160,8 +160,16 @@ NSString *NSStringFromOWSInteractionType(OWSInteractionType value)
|
|||
|
||||
- (void)touchThreadWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||
{
|
||||
TSThread *thread = [TSThread fetchObjectWithUniqueID:self.uniqueThreadId transaction:transaction];
|
||||
[thread touchWithTransaction:transaction];
|
||||
[transaction touchObjectForKey:self.uniqueThreadId inCollection:[TSThread collection]];
|
||||
}
|
||||
|
||||
- (void)applyChangeToSelfAndLatestCopy:(YapDatabaseReadWriteTransaction *)transaction
|
||||
changeBlock:(void (^)(id))changeBlock
|
||||
{
|
||||
OWSAssertDebug(transaction);
|
||||
|
||||
[super applyChangeToSelfAndLatestCopy:transaction changeBlock:changeBlock];
|
||||
[self touchThreadWithTransaction:transaction];
|
||||
}
|
||||
|
||||
#pragma mark Date operations
|
||||
|
|
|
@ -370,14 +370,6 @@ static const NSUInteger OWSMessageSchemaVersion = 4;
|
|||
}
|
||||
[attachment removeWithTransaction:transaction];
|
||||
};
|
||||
|
||||
// Updates inbox thread preview
|
||||
[self touchThreadWithTransaction:transaction];
|
||||
}
|
||||
|
||||
- (void)touchThreadWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||
{
|
||||
[transaction touchObjectForKey:self.uniqueThreadId inCollection:[TSThread collection]];
|
||||
}
|
||||
|
||||
- (BOOL)isExpiringMessage
|
||||
|
@ -416,15 +408,6 @@ static const NSUInteger OWSMessageSchemaVersion = 4;
|
|||
|
||||
#pragma mark - Update With... Methods
|
||||
|
||||
- (void)applyChangeToSelfAndLatestCopy:(YapDatabaseReadWriteTransaction *)transaction
|
||||
changeBlock:(void (^)(id))changeBlock
|
||||
{
|
||||
OWSAssertDebug(transaction);
|
||||
|
||||
[super applyChangeToSelfAndLatestCopy:transaction changeBlock:changeBlock];
|
||||
[self touchThreadWithTransaction:transaction];
|
||||
}
|
||||
|
||||
- (void)updateWithExpireStartedAt:(uint64_t)expireStartedAt transaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||
{
|
||||
OWSAssertDebug(expireStartedAt > 0);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TSCall.h"
|
||||
|
@ -144,7 +144,6 @@ NSUInteger TSCallCurrentSchemaVersion = 1;
|
|||
OWSLogDebug(@"marking as read uniqueId: %@ which has timestamp: %llu", self.uniqueId, self.timestamp);
|
||||
_read = YES;
|
||||
[self saveWithTransaction:transaction];
|
||||
[self touchThreadWithTransaction:transaction];
|
||||
|
||||
// Ignore sendReadReceipt - it doesn't apply to calls.
|
||||
}
|
||||
|
@ -171,9 +170,6 @@ NSUInteger TSCallCurrentSchemaVersion = 1;
|
|||
_callType = callType;
|
||||
|
||||
[self saveWithTransaction:transaction];
|
||||
|
||||
// redraw any thread-related unread count UI.
|
||||
[self touchThreadWithTransaction:transaction];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue