From 0f2c0dcd85871420a95166e80d875fd45ce2d6a9 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Thu, 5 Jul 2018 19:13:57 -0600 Subject: [PATCH] Only collapse footers within a cluster (from the same author) --- .../ConversationViewController.m | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 98c3af041..7d637f376 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -4894,11 +4894,19 @@ typedef enum : NSUInteger { NSString *incomingSenderId = incomingMessage.authorId; OWSAssert(incomingSenderId.length > 0); + NSString *_Nullable nextIncomingSenderId = nil; + if (nextViewItem && nextViewItem.interaction.interactionType == interactionType) { + TSIncomingMessage *nextIncomingMessage = (TSIncomingMessage *)nextViewItem.interaction; + nextIncomingSenderId = nextIncomingMessage.authorId; + OWSAssert(nextIncomingSenderId.length > 0); + } + if (nextViewItem && nextViewItem.interaction.interactionType == interactionType) { NSString *nextTimestampText = [DateUtil formatTimestampShort:nextViewItem.interaction.timestamp]; - // We can skip the "incoming message status" footer if the next message + // We can skip the "incoming message status" footer in a cluster if the next message // has the same footer and no "date break" separates us. - shouldHideFooter = ([timestampText isEqualToString:nextTimestampText] && !nextViewItem.shouldShowDate); + shouldHideFooter = [timestampText isEqualToString:nextTimestampText] && !nextViewItem.shouldShowDate && + [NSObject isNullableObject:nextIncomingSenderId equalTo:incomingSenderId]; } if (viewItem.isGroupThread) { @@ -4930,10 +4938,6 @@ typedef enum : NSUInteger { // no "date break" separates us. shouldShowSenderAvatar = YES; if (nextViewItem && nextViewItem.interaction.interactionType == interactionType) { - TSIncomingMessage *nextIncomingMessage = (TSIncomingMessage *)nextViewItem.interaction; - NSString *nextIncomingSenderId = nextIncomingMessage.authorId; - OWSAssert(nextIncomingSenderId.length > 0); - shouldShowSenderAvatar = (![NSObject isNullableObject:nextIncomingSenderId equalTo:incomingSenderId] || nextViewItem.shouldShowDate); }