Only show unread indicator if there is more than one message in the thread.

// FREEBIE
pull/1/head
Matthew Chen 9 years ago
parent 165de573c5
commit 90cdb6fcc6

@ -183,6 +183,8 @@ NS_ASSUME_NONNULL_BEGIN
[[transaction ext:TSThreadOutgoingMessageDatabaseViewExtensionName] firstObjectInGroup:thread.uniqueId]; [[transaction ext:TSThreadOutgoingMessageDatabaseViewExtensionName] firstObjectInGroup:thread.uniqueId];
NSUInteger outgoingMessageCount = NSUInteger outgoingMessageCount =
[[transaction ext:TSThreadOutgoingMessageDatabaseViewExtensionName] numberOfItemsInGroup:thread.uniqueId]; [[transaction ext:TSThreadOutgoingMessageDatabaseViewExtensionName] numberOfItemsInGroup:thread.uniqueId];
NSUInteger threadMessageCount =
[[transaction ext:TSMessageDatabaseViewExtensionName] numberOfItemsInGroup:thread.uniqueId];
// Enumerate in reverse to count the number of messages // Enumerate in reverse to count the number of messages
// after the unseen messages indicator. Not all of // after the unseen messages indicator. Not all of
@ -365,7 +367,8 @@ NS_ASSUME_NONNULL_BEGIN
[offerMessage saveWithTransaction:transaction]; [offerMessage saveWithTransaction:transaction];
} }
BOOL shouldHaveUnreadIndicator = (interactionAfterUnreadIndicator && !hideUnreadMessagesIndicator); BOOL shouldHaveUnreadIndicator
= (interactionAfterUnreadIndicator && !hideUnreadMessagesIndicator && threadMessageCount > 1);
if (!shouldHaveUnreadIndicator) { if (!shouldHaveUnreadIndicator) {
if (existingUnreadIndicator) { if (existingUnreadIndicator) {
DDLogInfo(@"%@ Removing obsolete TSUnreadIndicatorInteraction: %@", DDLogInfo(@"%@ Removing obsolete TSUnreadIndicatorInteraction: %@",

Loading…
Cancel
Save