Retweak colors.

pull/1/head
Matthew Chen 7 years ago
parent bbd65d6433
commit 4b448ed018

@ -4,13 +4,14 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@class ConversationStyle;
@class TSAttachmentStream; @class TSAttachmentStream;
@interface OWSGenericAttachmentView : UIStackView @interface OWSGenericAttachmentView : UIStackView
- (instancetype)initWithAttachment:(TSAttachmentStream *)attachmentStream isIncoming:(BOOL)isIncoming; - (instancetype)initWithAttachment:(TSAttachmentStream *)attachmentStream isIncoming:(BOOL)isIncoming;
- (void)createContents; - (void)createContentsWithConversationStyle:(ConversationStyle *)conversationStyle;
- (CGSize)measureSizeWithMaxMessageWidth:(CGFloat)maxMessageWidth; - (CGSize)measureSizeWithMaxMessageWidth:(CGFloat)maxMessageWidth;

@ -4,6 +4,7 @@
#import "OWSGenericAttachmentView.h" #import "OWSGenericAttachmentView.h"
#import "OWSBezierPathView.h" #import "OWSBezierPathView.h"
#import "Signal-Swift.h"
#import "UIFont+OWS.h" #import "UIFont+OWS.h"
#import "UIView+OWS.h" #import "UIView+OWS.h"
#import "ViewControllerUtils.h" #import "ViewControllerUtils.h"
@ -84,8 +85,10 @@ NS_ASSUME_NONNULL_BEGIN
return 48.f; return 48.f;
} }
- (void)createContents - (void)createContentsWithConversationStyle:(ConversationStyle *)conversationStyle
{ {
OWSAssert(conversationStyle);
self.axis = UILayoutConstraintAxisHorizontal; self.axis = UILayoutConstraintAxisHorizontal;
self.alignment = UIStackViewAlignmentCenter; self.alignment = UIStackViewAlignmentCenter;
self.spacing = self.hSpacing; self.spacing = self.hSpacing;
@ -137,7 +140,7 @@ NS_ASSUME_NONNULL_BEGIN
UILabel *topLabel = [UILabel new]; UILabel *topLabel = [UILabel new];
self.topLabel = topLabel; self.topLabel = topLabel;
topLabel.text = topText; topLabel.text = topText;
topLabel.textColor = (self.isIncoming ? [UIColor ows_whiteColor] : [UIColor ows_light90Color]); topLabel.textColor = [conversationStyle bubbleTextColorWithIsIncoming:self.isIncoming];
topLabel.lineBreakMode = NSLineBreakByTruncatingMiddle; topLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
topLabel.font = [OWSGenericAttachmentView topLabelFont]; topLabel.font = [OWSGenericAttachmentView topLabelFont];
[labelsView addArrangedSubview:topLabel]; [labelsView addArrangedSubview:topLabel];
@ -150,7 +153,7 @@ NS_ASSUME_NONNULL_BEGIN
UILabel *bottomLabel = [UILabel new]; UILabel *bottomLabel = [UILabel new];
self.bottomLabel = bottomLabel; self.bottomLabel = bottomLabel;
bottomLabel.text = bottomText; bottomLabel.text = bottomText;
bottomLabel.textColor = (self.isIncoming ? [UIColor colorWithWhite:1.f alpha:0.7f] : [UIColor ows_light60Color]); bottomLabel.textColor = [conversationStyle bubbleSecondaryTextColorWithIsIncoming:self.isIncoming];
bottomLabel.lineBreakMode = NSLineBreakByTruncatingMiddle; bottomLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
bottomLabel.font = [OWSGenericAttachmentView bottomLabelFont]; bottomLabel.font = [OWSGenericAttachmentView bottomLabelFont];
[labelsView addArrangedSubview:bottomLabel]; [labelsView addArrangedSubview:bottomLabel];

@ -1022,7 +1022,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(self.viewItem.attachmentStream); OWSAssert(self.viewItem.attachmentStream);
OWSGenericAttachmentView *attachmentView = OWSGenericAttachmentView *attachmentView =
[[OWSGenericAttachmentView alloc] initWithAttachment:self.attachmentStream isIncoming:self.isIncoming]; [[OWSGenericAttachmentView alloc] initWithAttachment:self.attachmentStream isIncoming:self.isIncoming];
[attachmentView createContents]; [attachmentView createContentsWithConversationStyle:self.conversationStyle];
[self addAttachmentUploadViewIfNecessary:attachmentView]; [self addAttachmentUploadViewIfNecessary:attachmentView];
self.loadCellContentBlock = ^{ self.loadCellContentBlock = ^{
@ -1040,7 +1040,9 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(self.attachmentPointer); OWSAssert(self.attachmentPointer);
AttachmentPointerView *downloadView = AttachmentPointerView *downloadView =
[[AttachmentPointerView alloc] initWithAttachmentPointer:self.attachmentPointer isIncoming:self.isIncoming]; [[AttachmentPointerView alloc] initWithAttachmentPointer:self.attachmentPointer
isIncoming:self.isIncoming
conversationStyle:self.conversationStyle];
UIView *wrapper = [UIView new]; UIView *wrapper = [UIView new];
[wrapper addSubview:downloadView]; [wrapper addSubview:downloadView];
@ -1199,7 +1201,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(self.viewItem.attachmentStream); OWSAssert(self.viewItem.attachmentStream);
OWSGenericAttachmentView *attachmentView = OWSGenericAttachmentView *attachmentView =
[[OWSGenericAttachmentView alloc] initWithAttachment:self.attachmentStream isIncoming:self.isIncoming]; [[OWSGenericAttachmentView alloc] initWithAttachment:self.attachmentStream isIncoming:self.isIncoming];
[attachmentView createContents]; [attachmentView createContentsWithConversationStyle:self.conversationStyle];
result = [attachmentView measureSizeWithMaxMessageWidth:maxMessageWidth]; result = [attachmentView measureSizeWithMaxMessageWidth:maxMessageWidth];
break; break;
} }

@ -84,7 +84,7 @@ NS_ASSUME_NONNULL_BEGIN
if (isOverlayingMedia) { if (isOverlayingMedia) {
textColor = [UIColor whiteColor]; textColor = [UIColor whiteColor];
} else { } else {
textColor = [conversationStyle secondaryTextColorWithIsIncoming:isIncoming]; textColor = [conversationStyle bubbleSecondaryTextColorWithIsIncoming:isIncoming];
} }
self.timestampLabel.textColor = textColor; self.timestampLabel.textColor = textColor;
@ -117,11 +117,8 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(statusIndicatorImage.size.width <= self.maxImageWidth); OWSAssert(statusIndicatorImage.size.width <= self.maxImageWidth);
self.statusIndicatorImageView.image = self.statusIndicatorImageView.image =
[statusIndicatorImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; [statusIndicatorImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
if (messageStatus == MessageReceiptStatusRead) { // TODO: How to indicate read status for transitional colors?
self.statusIndicatorImageView.tintColor = [UIColor ows_signalBlueColor]; self.statusIndicatorImageView.tintColor = textColor;
} else {
self.statusIndicatorImageView.tintColor = textColor;
}
self.statusIndicatorImageView.hidden = NO; self.statusIndicatorImageView.hidden = NO;
} else { } else {
self.statusIndicatorImageView.image = nil; self.statusIndicatorImageView.image = nil;

@ -117,7 +117,8 @@ NS_ASSUME_NONNULL_BEGIN
- (UIColor *)highlightColor - (UIColor *)highlightColor
{ {
BOOL isQuotingSelf = [NSObject isNullableObject:self.quotedMessage.authorId equalTo:TSAccountManager.localNumber]; BOOL isQuotingSelf = [NSObject isNullableObject:self.quotedMessage.authorId equalTo:TSAccountManager.localNumber];
return (isQuotingSelf ? self.conversationStyle.bubbleColorOutgoingSent : [UIColor colorWithRGBHex:0xB5B5B5]); return (isQuotingSelf ? self.conversationStyle.bubbleColorOutgoingSent
: [self.conversationStyle quotingSelfHighlightColor]);
} }
#pragma mark - #pragma mark -
@ -178,10 +179,7 @@ NS_ASSUME_NONNULL_BEGIN
maskLayer.path = bezierPath.CGPath; maskLayer.path = bezierPath.CGPath;
}]; }];
innerBubbleView.layer.mask = maskLayer; innerBubbleView.layer.mask = maskLayer;
// TODO: innerBubbleView.backgroundColor = [self.conversationStyle quotedReplyBubbleColorWithIsIncoming:!self.isOutgoing];
innerBubbleView.backgroundColor
= (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];
@ -195,8 +193,7 @@ NS_ASSUME_NONNULL_BEGIN
[hStackView autoPinToSuperviewEdges]; [hStackView autoPinToSuperviewEdges];
UIView *stripeView = [UIView new]; UIView *stripeView = [UIView new];
// TODO: stripeView.backgroundColor = [self.conversationStyle quotedReplyStripeColorWithIsIncoming:!self.isOutgoing];
stripeView.backgroundColor = (self.isOutgoing ? [self.conversationStyle primaryColor] : [UIColor whiteColor]);
[stripeView autoSetDimension:ALDimensionWidth toSize:self.stripeThickness]; [stripeView autoSetDimension:ALDimensionWidth toSize:self.stripeThickness];
[stripeView setContentHuggingHigh]; [stripeView setContentHuggingHigh];
[stripeView setCompressionResistanceHigh]; [stripeView setCompressionResistanceHigh];
@ -502,12 +499,12 @@ NS_ASSUME_NONNULL_BEGIN
- (UIColor *)quotedAuthorColor - (UIColor *)quotedAuthorColor
{ {
return [UIColor ows_light90Color]; return [self.conversationStyle quotedReplyAuthorColor];
} }
- (UIColor *)quotedTextColor - (UIColor *)quotedTextColor
{ {
return [UIColor ows_light90Color]; return [self.conversationStyle quotedReplyTextColor];
} }
- (UIFont *)quotedTextFont - (UIFont *)quotedTextFont
@ -517,7 +514,7 @@ NS_ASSUME_NONNULL_BEGIN
- (UIColor *)fileTypeTextColor - (UIColor *)fileTypeTextColor
{ {
return [UIColor colorWithWhite:0.5f alpha:1.f]; return [self.conversationStyle quotedReplyAttachmentColor];
} }
- (UIFont *)fileTypeFont - (UIFont *)fileTypeFont
@ -527,7 +524,7 @@ NS_ASSUME_NONNULL_BEGIN
- (UIColor *)filenameTextColor - (UIColor *)filenameTextColor
{ {
return [UIColor colorWithWhite:0.5f alpha:1.f]; return [self.conversationStyle quotedReplyAttachmentColor];
} }
- (UIFont *)filenameFont - (UIFont *)filenameFont

@ -10,12 +10,14 @@ class AttachmentPointerView: UIStackView {
let TAG = "[AttachmentPointerView]" let TAG = "[AttachmentPointerView]"
let isIncoming: Bool
let attachmentPointer: TSAttachmentPointer
let conversationStyle: ConversationStyle
let progressView = OWSProgressView() let progressView = OWSProgressView()
let nameLabel = UILabel() let nameLabel = UILabel()
let statusLabel = UILabel() let statusLabel = UILabel()
let isIncoming: Bool
let filename: String let filename: String
let attachmentPointer: TSAttachmentPointer
let genericFilename = NSLocalizedString("ATTACHMENT_DEFAULT_FILENAME", comment: "Generic filename for an attachment with no known name") let genericFilename = NSLocalizedString("ATTACHMENT_DEFAULT_FILENAME", comment: "Generic filename for an attachment with no known name")
var progress: CGFloat = 0 { var progress: CGFloat = 0 {
@ -25,9 +27,10 @@ class AttachmentPointerView: UIStackView {
} }
@objc @objc
required init(attachmentPointer: TSAttachmentPointer, isIncoming: Bool) { required init(attachmentPointer: TSAttachmentPointer, isIncoming: Bool, conversationStyle: ConversationStyle) {
self.isIncoming = isIncoming
self.attachmentPointer = attachmentPointer self.attachmentPointer = attachmentPointer
self.isIncoming = isIncoming
self.conversationStyle = conversationStyle
let attachmentPointerFilename = attachmentPointer.sourceFilename let attachmentPointerFilename = attachmentPointer.sourceFilename
if let filename = attachmentPointerFilename, !filename.isEmpty { if let filename = attachmentPointerFilename, !filename.isEmpty {
@ -126,7 +129,7 @@ class AttachmentPointerView: UIStackView {
} }
var textColor: UIColor { var textColor: UIColor {
return self.isIncoming ? UIColor.ows_white : UIColor.ows_light90 return conversationStyle.bubbleTextColor(isIncoming: isIncoming)
} }
@objc @objc

@ -242,7 +242,55 @@ public class ConversationStyle: NSObject {
} }
@objc @objc
public func secondaryTextColor(isIncoming: Bool) -> UIColor { public func bubbleSecondaryTextColor(isIncoming: Bool) -> UIColor {
return bubbleTextColor(isIncoming: isIncoming).withAlphaComponent(0.7) return bubbleTextColor(isIncoming: isIncoming).withAlphaComponent(0.7)
} }
@objc
public func quotedReplyBubbleColor(isIncoming: Bool) -> UIColor {
// TODO: Values
// TODO: Should this reflect "quoting self" v. "quoting other"?
if isIncoming {
return bubbleColorOutgoingSent.withAlphaComponent(0.7)
} else {
return ConversationStyle.defaultBubbleColorIncoming.withAlphaComponent(0.7)
}
}
@objc
public func quotedReplyStripeColor(isIncoming: Bool) -> UIColor {
// TODO: Values
// TODO: Should this reflect "quoting self" v. "quoting other"?
if isIncoming {
return bubbleColorOutgoingSent
} else {
return ConversationStyle.defaultBubbleColorIncoming
}
}
@objc
public func quotingSelfHighlightColor() -> UIColor {
// TODO:
return UIColor.init(rgbHex: 0xB5B5B5)
}
@objc
public func quotedReplyAuthorColor() -> UIColor {
// TODO:
return UIColor.ows_light90
}
@objc
public func quotedReplyTextColor() -> UIColor {
// TODO:
return UIColor.ows_light90
}
@objc
public func quotedReplyAttachmentColor() -> UIColor {
// TODO:
return UIColor(white: 0.5, alpha: 1.0)
}
} }

Loading…
Cancel
Save