address compiler breakage after rebase

This commit is contained in:
Michael Kirk 2018-12-17 12:54:44 -07:00
parent 0db3f240dd
commit af7ee5e1d1
10 changed files with 23 additions and 74 deletions

View File

@ -4454,7 +4454,7 @@ typedef enum : NSUInteger {
return;
} else if (conversationUpdate.conversationUpdateType == ConversationUpdateType_Reload) {
[self resetContentAndLayout];
[self updateLastVisibleTimestamp];
[self updateLastVisibleSortId];
[self scrollToBottomAnimated:NO];
return;
}
@ -4527,7 +4527,7 @@ typedef enum : NSUInteger {
OWSLogInfo(@"performBatchUpdates did not finish");
}
[self updateLastVisibleTimestamp];
[self updateLastVisibleSortId];
if (scrollToBottom && shouldAnimateUpdates) {
[self scrollToBottomAnimated:shouldAnimateScrollToBottom];

View File

@ -604,8 +604,7 @@ static const int kYapDatabaseRangeMinLength = 0;
for (TSOutgoingMessage *unsavedOutgoingMessage in self.unsavedOutgoingMessages) {
// unsavedOutgoingMessages should only exist for a short period (usually 30-50ms) before
// they are saved and moved into the `persistedViewItems`
OWSAssertDebug(
unsavedOutgoingMessage.timestampForSorting >= ([NSDate ows_millisecondTimeStamp] - 1 * kSecondInMs));
OWSAssertDebug(unsavedOutgoingMessage.timestamp >= ([NSDate ows_millisecondTimeStamp] - 1 * kSecondInMs));
NSUInteger index = [rowChanges indexOfObjectPassingTest:^BOOL(
YapDatabaseViewRowChange *_Nonnull rowChange, NSUInteger idx, BOOL *_Nonnull stop) {
return [rowChange.collectionKey.key isEqualToString:unsavedOutgoingMessage.uniqueId];
@ -1186,7 +1185,7 @@ static const int kYapDatabaseRangeMinLength = 0;
recipientId:recipientId
beforeInteractionId:firstCallOrMessage.uniqueId];
OWSLogInfo(@"Creating contact offers: %@ (%llu)", offersMessage.uniqueId, offersMessage.timestampForSorting);
OWSLogInfo(@"Creating contact offers: %@ (%llu)", offersMessage.uniqueId, offersMessage.sortId);
return offersMessage;
}
@ -1333,7 +1332,7 @@ static const int kYapDatabaseRangeMinLength = 0;
break;
}
uint64_t viewItemTimestamp = viewItem.interaction.timestampForSorting;
uint64_t viewItemTimestamp = viewItem.interaction.timestamp;
OWSAssertDebug(viewItemTimestamp > 0);
BOOL shouldShowDate = NO;
@ -1364,18 +1363,15 @@ static const int kYapDatabaseRangeMinLength = 0;
BOOL isItemUnread = ([viewItem.interaction conformsToProtocol:@protocol(OWSReadTracking)]
&& !((id<OWSReadTracking>)viewItem.interaction).wasRead);
if (isItemUnread && !unreadIndicator && !hasPlacedUnreadIndicator && !self.hasClearedUnreadMessagesIndicator) {
unreadIndicator =
[[OWSUnreadIndicator alloc] initUnreadIndicatorWithTimestamp:viewItem.interaction.timestamp
hasMoreUnseenMessages:NO
missingUnseenSafetyNumberChangeCount:0
unreadIndicatorPosition:0
firstUnseenInteractionTimestamp:viewItem.interaction.timestamp];
unreadIndicator = [[OWSUnreadIndicator alloc] initWithFirstUnseenSortId:viewItem.interaction.sortId
hasMoreUnseenMessages:NO
missingUnseenSafetyNumberChangeCount:0
unreadIndicatorPosition:0];
}
// Place the unread indicator onto the first appropriate view item,
// if any.
if (unreadIndicator && viewItem.interaction.timestampForSorting >= unreadIndicator.timestamp) {
if (unreadIndicator && viewItem.interaction.sortId >= unreadIndicator.firstUnseenSortId) {
viewItem.unreadIndicator = unreadIndicator;
unreadIndicator = nil;
hasPlacedUnreadIndicator = YES;
@ -1526,7 +1522,7 @@ static const int kYapDatabaseRangeMinLength = 0;
}
}
if (viewItem.interaction.timestampForSorting > collapseCutoffTimestamp) {
if (viewItem.interaction.receivedAtTimestamp > collapseCutoffTimestamp) {
shouldHideFooter = NO;
}

View File

@ -33,11 +33,6 @@ NS_ASSUME_NONNULL_BEGIN
recipientId:(NSString *)recipientId
beforeInteractionId:(NSString *)beforeInteractionId NS_DESIGNATED_INITIALIZER;
- (void)updateHasBlockOffer:(BOOL)hasBlockOffer
hasAddToContactsOffer:(BOOL)hasAddToContactsOffer
hasAddToProfileWhitelistOffer:(BOOL)hasAddToProfileWhitelistOffer
transaction:(YapDatabaseReadWriteTransaction *)transaction;
@end
NS_ASSUME_NONNULL_END

View File

@ -386,13 +386,13 @@ NS_ASSUME_NONNULL_BEGIN
}
[self ensureUnreadIndicator:result
thread:thread
transaction:transaction
maxRangeSize:maxRangeSize
blockingSafetyNumberChanges:blockingSafetyNumberChanges
nonBlockingSafetyNumberChanges:nonBlockingSafetyNumberChanges
hideUnreadMessagesIndicator:hideUnreadMessagesIndicator
firstUnseenInteractionTimestamp:firstUnseenInteractionTimestamp];
thread:thread
transaction:transaction
maxRangeSize:maxRangeSize
blockingSafetyNumberChanges:blockingSafetyNumberChanges
nonBlockingSafetyNumberChanges:nonBlockingSafetyNumberChanges
hideUnreadMessagesIndicator:hideUnreadMessagesIndicator
firstUnseenSortId:firstUnseenSortId];
// Determine the position of the focus message _after_ performing any mutations
// around dynamic interactions.
@ -412,7 +412,7 @@ NS_ASSUME_NONNULL_BEGIN
blockingSafetyNumberChanges:(NSArray<TSInvalidIdentityKeyErrorMessage *> *)blockingSafetyNumberChanges
nonBlockingSafetyNumberChanges:(NSArray<TSInteraction *> *)nonBlockingSafetyNumberChanges
hideUnreadMessagesIndicator:(BOOL)hideUnreadMessagesIndicator
firstUnseenInteractionTimestamp:(nullable NSNumber *)firstUnseenInteractionTimestamp
firstUnseenSortId:(nullable NSNumber *)firstUnseenSortId
{
OWSAssertDebug(dynamicInteractions);
OWSAssertDebug(thread);
@ -458,8 +458,7 @@ NS_ASSUME_NONNULL_BEGIN
return;
}
if (interaction.timestampForSorting
< firstUnseenInteractionTimestamp.unsignedLongLongValue) {
if (interaction.sortId < firstUnseenSortId.unsignedLongLongValue) {
// By default we want the unread indicator to appear just before
// the first unread message.
*stop = YES;

View File

@ -399,12 +399,8 @@ ConversationColorName const kConversationColorName_Default = ConversationColorNa
return;
}
self.shouldThreadBeVisible = YES;
// MJK FIXME - reconcile this
NSDate *lastMessageDate = [lastMessage dateForSorting];
if (!_lastMessageDate || [lastMessageDate timeIntervalSinceDate:self.lastMessageDate] > 0) {
_lastMessageDate = lastMessageDate;
if (!self.shouldThreadBeVisible) {
self.shouldThreadBeVisible = YES;
[self saveWithTransaction:transaction];
}
}

View File

@ -61,7 +61,6 @@ NSString *NSStringFromOWSInteractionType(OWSInteractionType value);
filter:(BOOL (^_Nonnull)(TSInteraction *))filter
withTransaction:(YapDatabaseReadTransaction *)transaction;
- (NSDate *)dateForLegacySorting;
- (uint64_t)timestampForLegacySorting;
- (NSComparisonResult)compareForSorting:(TSInteraction *)other;

View File

@ -166,11 +166,6 @@ NSString *NSStringFromOWSInteractionType(OWSInteractionType value)
#pragma mark Date operations
- (NSDate *)dateForLegacySorting
{
return [NSDate ows_dateWithMillisecondsSince1970:self.timestampForLegacySorting];
}
- (uint64_t)timestampForLegacySorting
{
return self.timestamp;
@ -214,8 +209,6 @@ NSString *NSStringFromOWSInteractionType(OWSInteractionType value)
- (void)saveWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
{
// MJK can we remove this? We can't trust the legacy order of this id field. Any reason not to use UUID like for
// other objects?
if (!self.uniqueId) {
OWSFailDebug(@"Missing uniqueId.");
self.uniqueId = [NSUUID new].UUIDString;

View File

@ -1276,8 +1276,6 @@ NS_ASSUME_NONNULL_BEGIN
return nil;
}
// MJK FIXME - this `becomeConsistent...` call seems to have been remove in master.
// to where?
[[OWSDisappearingMessagesJob sharedJob] becomeConsistentWithDisappearingDuration:dataMessage.expireTimer
thread:oldGroupThread
createdByRemoteRecipientId:envelope.source

View File

@ -1,27 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
import Foundation
@objc
public class SSKIncrementingIdFinder: NSObject {
private static let collectionName = "IncrementingIdCollection"
@objc
public class func previousId(key: String, transaction: YapDatabaseReadTransaction) -> UInt64 {
let previousId: UInt64 = transaction.object(forKey: key, inCollection: collectionName) as? UInt64 ?? 0
return previousId
}
@objc
public class func nextId(key: String, transaction: YapDatabaseReadWriteTransaction) -> UInt64 {
let previousId: UInt64 = transaction.object(forKey: key, inCollection: collectionName) as? UInt64 ?? 0
let nextId: UInt64 = previousId + 1
transaction.setObject(nextId, forKey: key, inCollection: collectionName)
Logger.debug("key: \(key) nextId: \(nextId)")
return nextId
}
}

View File

@ -161,7 +161,7 @@ static NSString *const OWSMediaGalleryFinderExtensionName = @"OWSMediaGalleryFin
}
return [@(index1) compare:@(index2)];
} else {
return [@(message1.timestampForSorting) compare:@(message2.timestampForSorting)];
return [message1 compareForSorting:message2];
}
}];