Apply conversation colors.

pull/1/head
Matthew Chen 7 years ago
parent 63fa6f5c00
commit 2653ed7e3f

@ -172,6 +172,8 @@ NS_ASSUME_NONNULL_BEGIN
{ {
self.layoutMargins = UIEdgeInsetsZero; self.layoutMargins = UIEdgeInsetsZero;
UIColor *textColor = (self.isIncoming ? [UIColor ows_whiteColor] : [UIColor ows_light90Color]);
AvatarImageView *avatarView = [AvatarImageView new]; AvatarImageView *avatarView = [AvatarImageView new];
avatarView.image = avatarView.image =
[self.contactShare getAvatarImageWithDiameter:self.iconSize contactsManager:self.contactsManager]; [self.contactShare getAvatarImageWithDiameter:self.iconSize contactsManager:self.contactsManager];
@ -183,7 +185,7 @@ NS_ASSUME_NONNULL_BEGIN
UILabel *topLabel = [UILabel new]; UILabel *topLabel = [UILabel new];
topLabel.text = self.contactShare.displayName; topLabel.text = self.contactShare.displayName;
topLabel.textColor = [UIColor blackColor]; topLabel.textColor = textColor;
topLabel.lineBreakMode = NSLineBreakByTruncatingTail; topLabel.lineBreakMode = NSLineBreakByTruncatingTail;
topLabel.font = OWSContactShareView.nameFont; topLabel.font = OWSContactShareView.nameFont;
@ -197,7 +199,8 @@ NS_ASSUME_NONNULL_BEGIN
if (firstPhoneNumber.length > 0) { if (firstPhoneNumber.length > 0) {
UILabel *bottomLabel = [UILabel new]; UILabel *bottomLabel = [UILabel new];
bottomLabel.text = [PhoneNumber bestEffortLocalizedPhoneNumberWithE164:firstPhoneNumber]; bottomLabel.text = [PhoneNumber bestEffortLocalizedPhoneNumberWithE164:firstPhoneNumber];
bottomLabel.textColor = [UIColor ows_darkGrayColor]; // TODO:
bottomLabel.textColor = [textColor colorWithAlphaComponent:0.7f];
bottomLabel.lineBreakMode = NSLineBreakByTruncatingTail; bottomLabel.lineBreakMode = NSLineBreakByTruncatingTail;
bottomLabel.font = OWSContactShareView.subtitleFont; bottomLabel.font = OWSContactShareView.subtitleFont;
[labelsView addArrangedSubview:bottomLabel]; [labelsView addArrangedSubview:bottomLabel];
@ -208,7 +211,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(disclosureImage); OWSAssert(disclosureImage);
UIImageView *disclosureImageView = [UIImageView new]; UIImageView *disclosureImageView = [UIImageView new];
disclosureImageView.image = [disclosureImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; disclosureImageView.image = [disclosureImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
disclosureImageView.tintColor = [UIColor blackColor]; disclosureImageView.tintColor = textColor;
[disclosureImageView setCompressionResistanceHigh]; [disclosureImageView setCompressionResistanceHigh];
[disclosureImageView setContentHuggingHigh]; [disclosureImageView setContentHuggingHigh];

@ -285,7 +285,8 @@ NS_ASSUME_NONNULL_BEGIN
[OWSQuotedMessageView quotedMessageViewForConversation:self.viewItem.quotedReply [OWSQuotedMessageView quotedMessageViewForConversation:self.viewItem.quotedReply
displayableQuotedText:displayableQuotedText displayableQuotedText:displayableQuotedText
conversationStyle:self.conversationStyle conversationStyle:self.conversationStyle
isOutgoing:isOutgoing]; isOutgoing:isOutgoing
sharesTopBorderWithMessageBubble:!self.shouldShowSenderName];
quotedMessageView.delegate = self; quotedMessageView.delegate = self;
self.quotedMessageView = quotedMessageView; self.quotedMessageView = quotedMessageView;
@ -1130,7 +1131,8 @@ NS_ASSUME_NONNULL_BEGIN
[OWSQuotedMessageView quotedMessageViewForConversation:self.viewItem.quotedReply [OWSQuotedMessageView quotedMessageViewForConversation:self.viewItem.quotedReply
displayableQuotedText:displayableQuotedText displayableQuotedText:displayableQuotedText
conversationStyle:self.conversationStyle conversationStyle:self.conversationStyle
isOutgoing:isOutgoing]; isOutgoing:isOutgoing
sharesTopBorderWithMessageBubble:NO];
CGSize result = [quotedMessageView sizeForMaxWidth:self.conversationStyle.maxMessageWidth]; CGSize result = [quotedMessageView sizeForMaxWidth:self.conversationStyle.maxMessageWidth];
return [NSValue valueWithCGSize:CGSizeCeil(result)]; return [NSValue valueWithCGSize:CGSizeCeil(result)];
} }

@ -34,7 +34,8 @@ NS_ASSUME_NONNULL_BEGIN
+ (OWSQuotedMessageView *)quotedMessageViewForConversation:(OWSQuotedReplyModel *)quotedMessage + (OWSQuotedMessageView *)quotedMessageViewForConversation:(OWSQuotedReplyModel *)quotedMessage
displayableQuotedText:(nullable DisplayableText *)displayableQuotedText displayableQuotedText:(nullable DisplayableText *)displayableQuotedText
conversationStyle:(ConversationStyle *)conversationStyle conversationStyle:(ConversationStyle *)conversationStyle
isOutgoing:(BOOL)isOutgoing; isOutgoing:(BOOL)isOutgoing
sharesTopBorderWithMessageBubble:(BOOL)sharesTopBorderWithMessageBubble;
// Factory method for "message compose" views. // Factory method for "message compose" views.
+ (OWSQuotedMessageView *)quotedMessageViewForPreview:(OWSQuotedReplyModel *)quotedMessage + (OWSQuotedMessageView *)quotedMessageViewForPreview:(OWSQuotedReplyModel *)quotedMessage

@ -25,6 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly) BOOL isForPreview; @property (nonatomic, readonly) BOOL isForPreview;
@property (nonatomic, readonly) BOOL isOutgoing; @property (nonatomic, readonly) BOOL isOutgoing;
@property (nonatomic, readonly) BOOL sharesTopBorderWithMessageBubble;
@property (nonatomic, readonly) UILabel *quotedAuthorLabel; @property (nonatomic, readonly) UILabel *quotedAuthorLabel;
@property (nonatomic, readonly) UILabel *quotedTextLabel; @property (nonatomic, readonly) UILabel *quotedTextLabel;
@ -39,6 +40,7 @@ NS_ASSUME_NONNULL_BEGIN
displayableQuotedText:(nullable DisplayableText *)displayableQuotedText displayableQuotedText:(nullable DisplayableText *)displayableQuotedText
conversationStyle:(ConversationStyle *)conversationStyle conversationStyle:(ConversationStyle *)conversationStyle
isOutgoing:(BOOL)isOutgoing isOutgoing:(BOOL)isOutgoing
sharesTopBorderWithMessageBubble:(BOOL)sharesTopBorderWithMessageBubble
{ {
OWSAssert(quotedMessage); OWSAssert(quotedMessage);
@ -46,7 +48,8 @@ NS_ASSUME_NONNULL_BEGIN
displayableQuotedText:displayableQuotedText displayableQuotedText:displayableQuotedText
conversationStyle:conversationStyle conversationStyle:conversationStyle
isForPreview:NO isForPreview:NO
isOutgoing:isOutgoing]; isOutgoing:isOutgoing
sharesTopBorderWithMessageBubble:sharesTopBorderWithMessageBubble];
} }
+ (OWSQuotedMessageView *)quotedMessageViewForPreview:(OWSQuotedReplyModel *)quotedMessage + (OWSQuotedMessageView *)quotedMessageViewForPreview:(OWSQuotedReplyModel *)quotedMessage
@ -63,7 +66,8 @@ NS_ASSUME_NONNULL_BEGIN
displayableQuotedText:displayableQuotedText displayableQuotedText:displayableQuotedText
conversationStyle:conversationStyle conversationStyle:conversationStyle
isForPreview:YES isForPreview:YES
isOutgoing:YES]; isOutgoing:YES
sharesTopBorderWithMessageBubble:NO];
[instance createContents]; [instance createContents];
return instance; return instance;
} }
@ -73,6 +77,7 @@ NS_ASSUME_NONNULL_BEGIN
conversationStyle:(ConversationStyle *)conversationStyle conversationStyle:(ConversationStyle *)conversationStyle
isForPreview:(BOOL)isForPreview isForPreview:(BOOL)isForPreview
isOutgoing:(BOOL)isOutgoing isOutgoing:(BOOL)isOutgoing
sharesTopBorderWithMessageBubble:(BOOL)sharesTopBorderWithMessageBubble
{ {
self = [super init]; self = [super init];
@ -87,6 +92,7 @@ NS_ASSUME_NONNULL_BEGIN
_isForPreview = isForPreview; _isForPreview = isForPreview;
_conversationStyle = conversationStyle; _conversationStyle = conversationStyle;
_isOutgoing = isOutgoing; _isOutgoing = isOutgoing;
_sharesTopBorderWithMessageBubble = sharesTopBorderWithMessageBubble;
_quotedAuthorLabel = [UILabel new]; _quotedAuthorLabel = [UILabel new];
_quotedTextLabel = [UILabel new]; _quotedTextLabel = [UILabel new];
@ -140,6 +146,7 @@ NS_ASSUME_NONNULL_BEGIN
self.clipsToBounds = YES; self.clipsToBounds = YES;
CAShapeLayer *maskLayer = [CAShapeLayer new]; CAShapeLayer *maskLayer = [CAShapeLayer new];
BOOL sharesTopBorderWithMessageBubble = self.sharesTopBorderWithMessageBubble;
OWSLayerView *innerBubbleView = [[OWSLayerView alloc] OWSLayerView *innerBubbleView = [[OWSLayerView alloc]
initWithFrame:CGRectZero initWithFrame:CGRectZero
layoutCallback:^(UIView *layerView) { layoutCallback:^(UIView *layerView) {
@ -151,9 +158,8 @@ NS_ASSUME_NONNULL_BEGIN
CGFloat bubbleRight = layerFrame.size.width; CGFloat bubbleRight = layerFrame.size.width;
CGFloat bubbleTop = 0.f; CGFloat bubbleTop = 0.f;
CGFloat bubbleBottom = layerFrame.size.height; CGFloat bubbleBottom = layerFrame.size.height;
// TODO: CGFloat bubbleTopRounding = (sharesTopBorderWithMessageBubble ? 10.f : 4.f);
CGFloat bubbleTopRounding = 12.f; CGFloat bubbleBottomRounding = 4.f;
CGFloat bubbleBottomRounding = 12.f;
[bezierPath moveToPoint:CGPointMake(bubbleLeft + bubbleTopRounding, bubbleTop)]; [bezierPath moveToPoint:CGPointMake(bubbleLeft + bubbleTopRounding, bubbleTop)];
[bezierPath addLineToPoint:CGPointMake(bubbleRight - bubbleTopRounding, bubbleTop)]; [bezierPath addLineToPoint:CGPointMake(bubbleRight - bubbleTopRounding, bubbleTop)];
@ -172,8 +178,9 @@ NS_ASSUME_NONNULL_BEGIN
maskLayer.path = bezierPath.CGPath; maskLayer.path = bezierPath.CGPath;
}]; }];
innerBubbleView.layer.mask = maskLayer; innerBubbleView.layer.mask = maskLayer;
// TODO: Color. innerBubbleView.backgroundColor
innerBubbleView.backgroundColor = [[UIColor ows_cyan800Color] colorWithAlphaComponent:0.25f]; = (self.isOutgoing ? [self.conversationStyle.primaryColor colorWithAlphaComponent:0.25f]
: [UIColor colorWithWhite:1.f alpha:0.75f]);
[self addSubview:innerBubbleView]; [self addSubview:innerBubbleView];
[innerBubbleView autoPinLeadingToSuperviewMarginWithInset:self.bubbleHMargin]; [innerBubbleView autoPinLeadingToSuperviewMarginWithInset:self.bubbleHMargin];
[innerBubbleView autoPinTrailingToSuperviewMarginWithInset:self.bubbleHMargin]; [innerBubbleView autoPinTrailingToSuperviewMarginWithInset:self.bubbleHMargin];
@ -187,8 +194,7 @@ NS_ASSUME_NONNULL_BEGIN
[hStackView autoPinToSuperviewEdges]; [hStackView autoPinToSuperviewEdges];
UIView *stripeView = [UIView new]; UIView *stripeView = [UIView new];
// TODO: Color. stripeView.backgroundColor = (self.isOutgoing ? [self.conversationStyle primaryColor] : [UIColor whiteColor]);
stripeView.backgroundColor = [UIColor ows_cyan800Color];
[stripeView autoSetDimension:ALDimensionWidth toSize:self.stripeThickness]; [stripeView autoSetDimension:ALDimensionWidth toSize:self.stripeThickness];
[stripeView setContentHuggingHigh]; [stripeView setContentHuggingHigh];
[stripeView setCompressionResistanceHigh]; [stripeView setCompressionResistanceHigh];

Loading…
Cancel
Save