fix bugs for open group time handling
This commit is contained in:
parent
1b621fc56d
commit
7773e9a280
|
@ -195,7 +195,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
timestampLabelText
|
||||
= NSLocalizedString(@"MESSAGE_STATUS_SEND_FAILED", @"Label indicating that a message failed to send.");
|
||||
} else {
|
||||
timestampLabelText = [DateUtil formatMessageTimestamp:viewItem.interaction.timestamp];
|
||||
timestampLabelText = [DateUtil formatMessageTimestamp:viewItem.interaction.timestampForUI];
|
||||
}
|
||||
|
||||
TSMessage *message = [viewItem.interaction as:TSMessage.class];
|
||||
|
|
|
@ -4683,7 +4683,7 @@ typedef enum : NSUInteger {
|
|||
OWSAssertDebug(left <= mid);
|
||||
OWSAssertDebug(mid < right);
|
||||
id<ConversationViewItem> viewItem = self.viewItems[mid];
|
||||
if (viewItem.interaction.timestamp >= viewHorizonTimestamp) {
|
||||
if (viewItem.interaction.timestampForUI >= viewHorizonTimestamp) {
|
||||
right = mid;
|
||||
} else {
|
||||
// This is an optimization; it also ensures that we converge.
|
||||
|
@ -4692,7 +4692,7 @@ typedef enum : NSUInteger {
|
|||
}
|
||||
OWSAssertDebug(left == right);
|
||||
id<ConversationViewItem> viewItem = self.viewItems[left];
|
||||
if (viewItem.interaction.timestamp >= viewHorizonTimestamp) {
|
||||
if (viewItem.interaction.timestampForUI >= viewHorizonTimestamp) {
|
||||
OWSLogInfo(@"firstIndexPathAtViewHorizonTimestamp: %zd / %zd", left, self.viewItems.count);
|
||||
return [NSIndexPath indexPathForRow:(NSInteger) left inSection:0];
|
||||
} else {
|
||||
|
@ -5402,7 +5402,7 @@ typedef enum : NSUInteger {
|
|||
__block TSInteraction *targetInteraction;
|
||||
[LKStorage writeSyncWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
[self.thread enumerateInteractionsWithTransaction:transaction usingBlock:^(TSInteraction *interaction, YapDatabaseReadTransaction *t) {
|
||||
if (interaction.timestamp == timestamp.unsignedLongLongValue) {
|
||||
if (interaction.timestampForUI == timestamp.unsignedLongLongValue) {
|
||||
targetInteraction = interaction;
|
||||
}
|
||||
}];
|
||||
|
@ -5426,7 +5426,7 @@ typedef enum : NSUInteger {
|
|||
{
|
||||
__block TSInteraction *targetInteraction;
|
||||
[self.thread enumerateInteractionsUsingBlock:^(TSInteraction *interaction) {
|
||||
if (interaction.timestamp == timestamp.unsignedLongLongValue) {
|
||||
if (interaction.timestampForUI == timestamp.unsignedLongLongValue) {
|
||||
targetInteraction = interaction;
|
||||
}
|
||||
}];
|
||||
|
|
|
@ -1350,7 +1350,7 @@ static const int kYapDatabaseRangeMaxLength = 25000;
|
|||
break;
|
||||
}
|
||||
|
||||
uint64_t viewItemTimestamp = viewItem.interaction.timestamp;
|
||||
uint64_t viewItemTimestamp = viewItem.interaction.timestampForUI;
|
||||
OWSAssertDebug(viewItemTimestamp > 0);
|
||||
|
||||
BOOL shouldShowDate = NO;
|
||||
|
@ -1417,7 +1417,7 @@ static const int kYapDatabaseRangeMaxLength = 25000;
|
|||
NSAttributedString *_Nullable senderName = nil;
|
||||
|
||||
OWSInteractionType interactionType = viewItem.interaction.interactionType;
|
||||
NSString *timestampText = [DateUtil formatTimestampShort:viewItem.interaction.timestamp];
|
||||
NSString *timestampText = [DateUtil formatTimestampShort:viewItem.interaction.timestampForUI];
|
||||
|
||||
if (interactionType == OWSInteractionType_OutgoingMessage) {
|
||||
TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)viewItem.interaction;
|
||||
|
|
|
@ -39,11 +39,14 @@ NSString *NSStringFromOWSInteractionType(OWSInteractionType value);
|
|||
@property (nonatomic, readonly) uint64_t timestamp;
|
||||
@property (nonatomic, readonly) uint64_t sortId;
|
||||
@property (nonatomic, readonly) uint64_t receivedAtTimestamp;
|
||||
@property (nonatomic, readonly) BOOL shouldUseServerTime;
|
||||
/// Used for public chats where a message sent from a slave device is interpreted as having been sent from the master device.
|
||||
@property (nonatomic) NSString *actualSenderHexEncodedPublicKey;
|
||||
|
||||
- (void)setServerTimestampToReceivedTimestamp:(uint64_t)receivedAtTimestamp;
|
||||
|
||||
- (uint64_t)timestampForUI;
|
||||
|
||||
- (NSDate *)receivedAtDate;
|
||||
|
||||
- (OWSInteractionType)interactionType;
|
||||
|
|
|
@ -177,13 +177,10 @@ NSString *NSStringFromOWSInteractionType(OWSInteractionType value)
|
|||
|
||||
#pragma mark Date operations
|
||||
|
||||
- (uint64_t)timestamp
|
||||
- (uint64_t)timestampForUI
|
||||
{
|
||||
if (self.thread.isGroupThread) {
|
||||
TSGroupThread *thread = (TSGroupThread *)self.thread;
|
||||
if (thread.isPublicChat) {
|
||||
return _receivedAtTimestamp;
|
||||
}
|
||||
if (_shouldUseServerTime) {
|
||||
return _receivedAtTimestamp;
|
||||
}
|
||||
return _timestamp;
|
||||
}
|
||||
|
@ -195,6 +192,7 @@ NSString *NSStringFromOWSInteractionType(OWSInteractionType value)
|
|||
|
||||
- (void)setServerTimestampToReceivedTimestamp:(uint64_t)receivedAtTimestamp
|
||||
{
|
||||
_shouldUseServerTime = YES;
|
||||
_receivedAtTimestamp = receivedAtTimestamp;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue