address compiler breakage after rebase

pull/1/head
Michael Kirk 6 years ago
parent 0db3f240dd
commit af7ee5e1d1

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

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

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

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

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

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

@ -166,11 +166,6 @@ NSString *NSStringFromOWSInteractionType(OWSInteractionType value)
#pragma mark Date operations #pragma mark Date operations
- (NSDate *)dateForLegacySorting
{
return [NSDate ows_dateWithMillisecondsSince1970:self.timestampForLegacySorting];
}
- (uint64_t)timestampForLegacySorting - (uint64_t)timestampForLegacySorting
{ {
return self.timestamp; return self.timestamp;
@ -214,8 +209,6 @@ NSString *NSStringFromOWSInteractionType(OWSInteractionType value)
- (void)saveWithTransaction:(YapDatabaseReadWriteTransaction *)transaction - (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) { if (!self.uniqueId) {
OWSFailDebug(@"Missing uniqueId."); OWSFailDebug(@"Missing uniqueId.");
self.uniqueId = [NSUUID new].UUIDString; self.uniqueId = [NSUUID new].UUIDString;

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

@ -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
}
}

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

Loading…
Cancel
Save