WIP making OWSQuotedMessageView work with preview

// FREEBIE
pull/1/head
Michael Kirk 7 years ago
parent 5287ab8f8c
commit 520dad25bb

@ -23,6 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, nullable, readonly) DisplayableText *displayableQuotedText;
@property (nonatomic, nullable) OWSBubbleStrokeView *boundsStrokeView;
@property (nonatomic, readonly) BOOL isForPreview;
@end
@ -35,8 +36,9 @@ NS_ASSUME_NONNULL_BEGIN
{
OWSAssert(quotedMessage);
return
[[OWSQuotedMessageView alloc] initWithQuotedMessage:quotedMessage displayableQuotedText:displayableQuotedText];
return [[OWSQuotedMessageView alloc] initWithQuotedMessage:quotedMessage
displayableQuotedText:displayableQuotedText
isForPreview:NO];
}
+ (OWSQuotedMessageView *)quotedMessageViewForPreview:(OWSQuotedReplyModel *)quotedMessage
@ -48,12 +50,14 @@ NS_ASSUME_NONNULL_BEGIN
displayableQuotedText = [DisplayableText displayableText:quotedMessage.body];
}
return
[[OWSQuotedMessageView alloc] initWithQuotedMessage:quotedMessage displayableQuotedText:displayableQuotedText];
return [[OWSQuotedMessageView alloc] initWithQuotedMessage:quotedMessage
displayableQuotedText:displayableQuotedText
isForPreview:YES];
}
- (instancetype)initWithQuotedMessage:(OWSQuotedReplyModel *)quotedMessage
displayableQuotedText:(nullable DisplayableText *)displayableQuotedText
isForPreview:(BOOL)isForPreview
{
self = [super init];
@ -65,6 +69,7 @@ NS_ASSUME_NONNULL_BEGIN
_quotedMessage = quotedMessage;
_displayableQuotedText = displayableQuotedText;
_isForPreview = isForPreview;
[self createContents];
@ -260,7 +265,7 @@ NS_ASSUME_NONNULL_BEGIN
}
UILabel *quotedTextLabel = [UILabel new];
quotedTextLabel.numberOfLines = 3;
quotedTextLabel.numberOfLines = self.isForPreview ? 1 : 3;
quotedTextLabel.lineBreakMode = NSLineBreakByWordWrapping;
quotedTextLabel.text = text;
quotedTextLabel.textColor = textColor;

@ -21,6 +21,7 @@ class QuotedReplyPreview: UIView {
super.init(frame: .zero)
let quotedMessageView = OWSQuotedMessageView(forPreview: quotedReply)
quotedMessageView.backgroundColor = .clear
let isQuotingSelf = quotedReply.authorId == TSAccountManager.localNumber()
@ -116,6 +117,9 @@ class QuotedReplyPreview: UIView {
cancelButton.autoPinEdge(.leading, to: .trailing, of: quotedMessageView)
cancelButton.autoSetDimensions(to: CGSize(width: 40, height: 40))
// TODO this is arbitrary and breaks with dynamic type
self.autoSetDimension(.height, toSize: 70)
}
// MARK: UIViewOverrides

Loading…
Cancel
Save