diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m index 21ebde3c0..3d5fbc6fa 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m @@ -263,9 +263,14 @@ NS_ASSUME_NONNULL_BEGIN if (self.isQuotedReply) { OWSAssert(!lastSubview); - OWSQuotedMessageView *quotedMessageView = [OWSQuotedMessageView - quotedMessageViewForConversation:self.viewItem.quotedReply - displayableQuotedText:(self.viewItem.hasQuotedText ? self.viewItem.displayableQuotedText : nil)]; + BOOL isOutgoing = [self.viewItem.interaction isKindOfClass:TSOutgoingMessage.class]; + DisplayableText *_Nullable displayableQuotedText + = (self.viewItem.hasQuotedText ? self.viewItem.displayableQuotedText : nil); + + OWSQuotedMessageView *quotedMessageView = + [OWSQuotedMessageView quotedMessageViewForConversation:self.viewItem.quotedReply + displayableQuotedText:displayableQuotedText + isOutgoing:isOutgoing]; self.quotedMessageView = quotedMessageView; [quotedMessageView createContents]; [self.bubbleView addSubview:quotedMessageView]; @@ -915,9 +920,14 @@ NS_ASSUME_NONNULL_BEGIN return CGSizeZero; } - OWSQuotedMessageView *quotedMessageView = [OWSQuotedMessageView - quotedMessageViewForConversation:self.viewItem.quotedReply - displayableQuotedText:(self.hasQuotedText ? self.viewItem.displayableQuotedText : nil)]; + BOOL isOutgoing = [self.viewItem.interaction isKindOfClass:TSOutgoingMessage.class]; + DisplayableText *_Nullable displayableQuotedText + = (self.viewItem.hasQuotedText ? self.viewItem.displayableQuotedText : nil); + + OWSQuotedMessageView *quotedMessageView = + [OWSQuotedMessageView quotedMessageViewForConversation:self.viewItem.quotedReply + displayableQuotedText:displayableQuotedText + isOutgoing:isOutgoing]; const int maxMessageWidth = [self maxMessageWidthForContentWidth:contentWidth]; CGSize result = [quotedMessageView sizeForMaxWidth:maxMessageWidth - kBubbleThornSideInset]; if (includeMargins) { diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.h b/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.h index 272f811bf..aa63d192c 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.h +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.h @@ -22,7 +22,8 @@ NS_ASSUME_NONNULL_BEGIN // Factory method for "message bubble" views. + (OWSQuotedMessageView *)quotedMessageViewForConversation:(OWSQuotedReplyModel *)quotedMessage - displayableQuotedText:(nullable DisplayableText *)displayableQuotedText; + displayableQuotedText:(nullable DisplayableText *)displayableQuotedText + isOutgoing:(BOOL)isOutgoing; // Factory method for "message compose" views. + (OWSQuotedMessageView *)quotedMessageViewForPreview:(OWSQuotedReplyModel *)quotedMessage; diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m index 98c0d183f..6702221dd 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m @@ -24,6 +24,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, nullable) OWSBubbleStrokeView *boundsStrokeView; @property (nonatomic, readonly) BOOL isForPreview; +@property (nonatomic, readonly) BOOL isOutgoing; @end @@ -33,12 +34,14 @@ NS_ASSUME_NONNULL_BEGIN + (OWSQuotedMessageView *)quotedMessageViewForConversation:(OWSQuotedReplyModel *)quotedMessage displayableQuotedText:(nullable DisplayableText *)displayableQuotedText + isOutgoing:(BOOL)isOutgoing { OWSAssert(quotedMessage); return [[OWSQuotedMessageView alloc] initWithQuotedMessage:quotedMessage displayableQuotedText:displayableQuotedText - isForPreview:NO]; + isForPreview:NO + isOutgoing:isOutgoing]; } + (OWSQuotedMessageView *)quotedMessageViewForPreview:(OWSQuotedReplyModel *)quotedMessage @@ -52,12 +55,14 @@ NS_ASSUME_NONNULL_BEGIN return [[OWSQuotedMessageView alloc] initWithQuotedMessage:quotedMessage displayableQuotedText:displayableQuotedText - isForPreview:YES]; + isForPreview:YES + isOutgoing:YES]; } - (instancetype)initWithQuotedMessage:(OWSQuotedReplyModel *)quotedMessage displayableQuotedText:(nullable DisplayableText *)displayableQuotedText isForPreview:(BOOL)isForPreview + isOutgoing:(BOOL)isOutgoing { self = [super init]; @@ -70,6 +75,7 @@ NS_ASSUME_NONNULL_BEGIN _quotedMessage = quotedMessage; _displayableQuotedText = displayableQuotedText; _isForPreview = isForPreview; + _isOutgoing = isOutgoing; [self createContents]; @@ -91,10 +97,9 @@ NS_ASSUME_NONNULL_BEGIN - (UIColor *)highlightColor { - BOOL isIncomingQuote - = ![NSObject isNullableObject:self.quotedMessage.authorId equalTo:TSAccountManager.localNumber]; - return (isIncomingQuote ? OWSMessagesBubbleImageFactory.bubbleColorIncoming - : OWSMessagesBubbleImageFactory.bubbleColorOutgoingSent); + BOOL isQuotingSelf = [NSObject isNullableObject:self.quotedMessage.authorId equalTo:TSAccountManager.localNumber]; + return (isQuotingSelf ? OWSMessagesBubbleImageFactory.bubbleColorOutgoingSent + : OWSMessagesBubbleImageFactory.bubbleColorIncoming); } #pragma mark - @@ -305,8 +310,14 @@ NS_ASSUME_NONNULL_BEGIN NSString *_Nullable localNumber = [TSAccountManager localNumber]; NSString *quotedAuthorText; if ([localNumber isEqualToString:self.quotedMessage.authorId]) { - quotedAuthorText = NSLocalizedString( - @"QUOTED_REPLY_AUTHOR_INDICATOR_YOURSELF", @"Indicates the author of a quoted message is yourself."); + + if (self.isOutgoing) { + quotedAuthorText = NSLocalizedString( + @"QUOTED_REPLY_AUTHOR_INDICATOR_YOURSELF", @"message header label when quoting yourself"); + } else { + quotedAuthorText = NSLocalizedString( + @"QUOTED_REPLY_AUTHOR_INDICATOR_YOU", @"message header label when someone else is quoting you"); + } } else { OWSContactsManager *contactsManager = Environment.current.contactsManager; NSString *quotedAuthor = [contactsManager displayNameForPhoneIdentifier:self.quotedMessage.authorId]; diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index fc89353b0..563a6101f 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -1411,7 +1411,10 @@ /* Indicates the author of a quoted message. Embeds {{the author's name or phone number}}. */ "QUOTED_REPLY_AUTHOR_INDICATOR_FORMAT" = "Replying to %@"; -/* Indicates the author of a quoted message is yourself. */ +/* message header label when someone else is quoting you */ +"QUOTED_REPLY_AUTHOR_INDICATOR_YOU" = "Replying to You"; + +/* message header label when quoting yourself */ "QUOTED_REPLY_AUTHOR_INDICATOR_YOURSELF" = "Replying to Yourself"; /* Indicates this message is a quoted reply to an attachment of unknown type. */