Respond to CR.

pull/1/head
Matthew Chen 7 years ago
parent 35f058c46a
commit 376e2cc1db

@ -3215,7 +3215,6 @@ typedef enum : NSUInteger {
// We need to reload any modified interactions _before_ we call // We need to reload any modified interactions _before_ we call
// reloadViewItems. // reloadViewItems.
BOOL hasDeletions = NO;
BOOL hasMalformedRowChange = NO; BOOL hasMalformedRowChange = NO;
for (YapDatabaseViewRowChange *rowChange in rowChanges) { for (YapDatabaseViewRowChange *rowChange in rowChanges) {
switch (rowChange.type) { switch (rowChange.type) {
@ -3245,7 +3244,6 @@ typedef enum : NSUInteger {
} else { } else {
hasMalformedRowChange = YES; hasMalformedRowChange = YES;
} }
hasDeletions = YES;
break; break;
} }
default: default:
@ -3264,7 +3262,6 @@ typedef enum : NSUInteger {
[self.collectionView reloadData]; [self.collectionView reloadData];
self.lastReloadDate = [NSDate new]; self.lastReloadDate = [NSDate new];
[self updateLastVisibleTimestamp]; [self updateLastVisibleTimestamp];
[self cleanUpUnreadIndicatorIfNecessary];
return; return;
} }
@ -3349,9 +3346,6 @@ typedef enum : NSUInteger {
if (scrollToBottom) { if (scrollToBottom) {
[self scrollToBottomAnimated:shouldAnimateScrollToBottom && shouldAnimateUpdates]; [self scrollToBottomAnimated:shouldAnimateScrollToBottom && shouldAnimateUpdates];
} }
if (hasDeletions) {
[self cleanUpUnreadIndicatorIfNecessary];
}
}; };
if (shouldAnimateUpdates) { if (shouldAnimateUpdates) {
[self.collectionView performBatchUpdates:batchUpdates completion:batchUpdatesCompletion]; [self.collectionView performBatchUpdates:batchUpdates completion:batchUpdatesCompletion];
@ -3785,17 +3779,6 @@ typedef enum : NSUInteger {
self.hasUnreadMessages = numberOfUnreadMessages > 0; self.hasUnreadMessages = numberOfUnreadMessages > 0;
} }
- (void)cleanUpUnreadIndicatorIfNecessary
{
BOOL hasUnreadIndicator = self.dynamicInteractions.unreadIndicator != nil;
if (!hasUnreadIndicator) {
return;
}
// If the last unread message was deleted (manually or due to disappearing messages)
// we may need to clean up an obsolete unread indicator.
[self ensureDynamicInteractions];
}
- (void)updateLastVisibleTimestamp:(uint64_t)timestamp - (void)updateLastVisibleTimestamp:(uint64_t)timestamp
{ {
OWSAssert(timestamp > 0); OWSAssert(timestamp > 0);
@ -4924,6 +4907,11 @@ typedef enum : NSUInteger {
viewItem.shouldHideFooter = shouldHideFooter; viewItem.shouldHideFooter = shouldHideFooter;
viewItem.senderName = senderName; viewItem.senderName = senderName;
} }
if (unreadIndicator) {
// This isn't necessarily a bug - all of the interactions after the
// unread indicator may have disappeared or been deleted.
DDLogWarn(@"%@ Couldn't find an interaction to hang the unread indicator on.", self.logTag);
}
self.viewItems = viewItems; self.viewItems = viewItems;
self.viewItemCache = viewItemCache; self.viewItemCache = viewItemCache;

@ -567,7 +567,7 @@ NS_ASSUME_NONNULL_BEGIN
if (!interactionAfterUnreadIndicator) { if (!interactionAfterUnreadIndicator) {
// If we can't find an interaction after the unread indicator, // If we can't find an interaction after the unread indicator,
// remove it. All unread messages may have been deleted or // don't show it. All unread messages may have been deleted or
// expired. // expired.
return; return;
} }

Loading…
Cancel
Save