Merge branch 'mkirk/quote-you'
This commit is contained in:
commit
6703e1b11d
@ -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) {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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];
|
||||
|
||||
@ -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. */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user