|
|
@ -21,9 +21,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
|
|
|
|
const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
|
|
|
|
|
|
|
|
= UIDataDetectorTypeLink | UIDataDetectorTypeAddress | UIDataDetectorTypeCalendarEvent;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@interface OWSMessageBubbleView () <OWSQuotedMessageViewDelegate, OWSContactShareButtonsViewDelegate>
|
|
|
|
@interface OWSMessageBubbleView () <OWSQuotedMessageViewDelegate, OWSContactShareButtonsViewDelegate>
|
|
|
|
|
|
|
|
|
|
|
|
@property (nonatomic) OWSBubbleView *bubbleView;
|
|
|
|
@property (nonatomic) OWSBubbleView *bubbleView;
|
|
|
@ -107,8 +104,6 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
|
|
|
|
[self.senderNameLabel ows_autoPinToSuperviewMargins];
|
|
|
|
[self.senderNameLabel ows_autoPinToSuperviewMargins];
|
|
|
|
|
|
|
|
|
|
|
|
self.bodyTextView = [self newTextView];
|
|
|
|
self.bodyTextView = [self newTextView];
|
|
|
|
// Setting dataDetectorTypes is expensive. Do it just once.
|
|
|
|
|
|
|
|
self.bodyTextView.dataDetectorTypes = kOWSAllowedDataDetectorTypes;
|
|
|
|
|
|
|
|
self.bodyTextView.hidden = YES;
|
|
|
|
self.bodyTextView.hidden = YES;
|
|
|
|
|
|
|
|
|
|
|
|
self.linkPreviewView = [[LinkPreviewView alloc] initWithDraftDelegate:nil];
|
|
|
|
self.linkPreviewView = [[LinkPreviewView alloc] initWithDraftDelegate:nil];
|
|
|
@ -682,7 +677,7 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
|
|
|
|
shouldIgnoreEvents = outgoingMessage.messageState != TSOutgoingMessageStateSent;
|
|
|
|
shouldIgnoreEvents = outgoingMessage.messageState != TSOutgoingMessageStateSent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
[self.class loadForTextDisplay:self.bodyTextView
|
|
|
|
[self.class loadForTextDisplay:self.bodyTextView
|
|
|
|
text:self.displayableBodyText.displayText
|
|
|
|
displayableText:self.displayableBodyText
|
|
|
|
searchText:self.delegate.lastSearchedText
|
|
|
|
searchText:self.delegate.lastSearchedText
|
|
|
|
textColor:self.bodyTextColor
|
|
|
|
textColor:self.bodyTextColor
|
|
|
|
font:self.textMessageFont
|
|
|
|
font:self.textMessageFont
|
|
|
@ -690,7 +685,7 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ (void)loadForTextDisplay:(OWSMessageTextView *)textView
|
|
|
|
+ (void)loadForTextDisplay:(OWSMessageTextView *)textView
|
|
|
|
text:(NSString *)text
|
|
|
|
displayableText:(DisplayableText *)displayableText
|
|
|
|
searchText:(nullable NSString *)searchText
|
|
|
|
searchText:(nullable NSString *)searchText
|
|
|
|
textColor:(UIColor *)textColor
|
|
|
|
textColor:(UIColor *)textColor
|
|
|
|
font:(UIFont *)font
|
|
|
|
font:(UIFont *)font
|
|
|
@ -707,6 +702,8 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
|
|
|
|
};
|
|
|
|
};
|
|
|
|
textView.shouldIgnoreEvents = shouldIgnoreEvents;
|
|
|
|
textView.shouldIgnoreEvents = shouldIgnoreEvents;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NSString *text = displayableText.displayText;
|
|
|
|
|
|
|
|
|
|
|
|
NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc]
|
|
|
|
NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc]
|
|
|
|
initWithString:text
|
|
|
|
initWithString:text
|
|
|
|
attributes:@{ NSFontAttributeName : font, NSForegroundColorAttributeName : textColor }];
|
|
|
|
attributes:@{ NSFontAttributeName : font, NSForegroundColorAttributeName : textColor }];
|
|
|
@ -725,6 +722,8 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[textView ensureShouldLinkifyText:displayableText.shouldAllowLinkification];
|
|
|
|
|
|
|
|
|
|
|
|
// For perf, set text last. Otherwise changing font/color is more expensive.
|
|
|
|
// For perf, set text last. Otherwise changing font/color is more expensive.
|
|
|
|
|
|
|
|
|
|
|
|
// We use attributedText even when we're not highlighting searched text to esnure any lingering
|
|
|
|
// We use attributedText even when we're not highlighting searched text to esnure any lingering
|
|
|
|