From 376e2cc1db406d9e1f11b6937341fd9320c45180 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 11 Jul 2018 16:54:44 -0400 Subject: [PATCH] Respond to CR. --- .../ConversationViewController.m | 22 +++++-------------- SignalMessaging/utils/ThreadUtil.m | 2 +- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index fd1607e01..5efadd928 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -3215,7 +3215,6 @@ typedef enum : NSUInteger { // We need to reload any modified interactions _before_ we call // reloadViewItems. - BOOL hasDeletions = NO; BOOL hasMalformedRowChange = NO; for (YapDatabaseViewRowChange *rowChange in rowChanges) { switch (rowChange.type) { @@ -3245,7 +3244,6 @@ typedef enum : NSUInteger { } else { hasMalformedRowChange = YES; } - hasDeletions = YES; break; } default: @@ -3264,7 +3262,6 @@ typedef enum : NSUInteger { [self.collectionView reloadData]; self.lastReloadDate = [NSDate new]; [self updateLastVisibleTimestamp]; - [self cleanUpUnreadIndicatorIfNecessary]; return; } @@ -3349,9 +3346,6 @@ typedef enum : NSUInteger { if (scrollToBottom) { [self scrollToBottomAnimated:shouldAnimateScrollToBottom && shouldAnimateUpdates]; } - if (hasDeletions) { - [self cleanUpUnreadIndicatorIfNecessary]; - } }; if (shouldAnimateUpdates) { [self.collectionView performBatchUpdates:batchUpdates completion:batchUpdatesCompletion]; @@ -3785,17 +3779,6 @@ typedef enum : NSUInteger { 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 { OWSAssert(timestamp > 0); @@ -4924,6 +4907,11 @@ typedef enum : NSUInteger { viewItem.shouldHideFooter = shouldHideFooter; 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.viewItemCache = viewItemCache; diff --git a/SignalMessaging/utils/ThreadUtil.m b/SignalMessaging/utils/ThreadUtil.m index 619ecc5d0..e70951a8c 100644 --- a/SignalMessaging/utils/ThreadUtil.m +++ b/SignalMessaging/utils/ThreadUtil.m @@ -567,7 +567,7 @@ NS_ASSUME_NONNULL_BEGIN if (!interactionAfterUnreadIndicator) { // 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. return; }