Retweak colors.

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

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

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

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

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

@ -117,7 +117,8 @@ NS_ASSUME_NONNULL_BEGIN
- (UIColor *)highlightColor
{
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 -
@ -178,10 +179,7 @@ NS_ASSUME_NONNULL_BEGIN
maskLayer.path = bezierPath.CGPath;
}];
innerBubbleView.layer.mask = maskLayer;
// TODO:
innerBubbleView.backgroundColor
= (self.isOutgoing ? [self.conversationStyle.primaryColor colorWithAlphaComponent:0.25f]
: [UIColor colorWithWhite:1.f alpha:0.75f]);
innerBubbleView.backgroundColor = [self.conversationStyle quotedReplyBubbleColorWithIsIncoming:!self.isOutgoing];
[self addSubview:innerBubbleView];
[innerBubbleView autoPinLeadingToSuperviewMarginWithInset:self.bubbleHMargin];
[innerBubbleView autoPinTrailingToSuperviewMarginWithInset:self.bubbleHMargin];
@ -195,8 +193,7 @@ NS_ASSUME_NONNULL_BEGIN
[hStackView autoPinToSuperviewEdges];
UIView *stripeView = [UIView new];
// TODO:
stripeView.backgroundColor = (self.isOutgoing ? [self.conversationStyle primaryColor] : [UIColor whiteColor]);
stripeView.backgroundColor = [self.conversationStyle quotedReplyStripeColorWithIsIncoming:!self.isOutgoing];
[stripeView autoSetDimension:ALDimensionWidth toSize:self.stripeThickness];
[stripeView setContentHuggingHigh];
[stripeView setCompressionResistanceHigh];
@ -502,12 +499,12 @@ NS_ASSUME_NONNULL_BEGIN
- (UIColor *)quotedAuthorColor
{
return [UIColor ows_light90Color];
return [self.conversationStyle quotedReplyAuthorColor];
}
- (UIColor *)quotedTextColor
{
return [UIColor ows_light90Color];
return [self.conversationStyle quotedReplyTextColor];
}
- (UIFont *)quotedTextFont
@ -517,7 +514,7 @@ NS_ASSUME_NONNULL_BEGIN
- (UIColor *)fileTypeTextColor
{
return [UIColor colorWithWhite:0.5f alpha:1.f];
return [self.conversationStyle quotedReplyAttachmentColor];
}
- (UIFont *)fileTypeFont
@ -527,7 +524,7 @@ NS_ASSUME_NONNULL_BEGIN
- (UIColor *)filenameTextColor
{
return [UIColor colorWithWhite:0.5f alpha:1.f];
return [self.conversationStyle quotedReplyAttachmentColor];
}
- (UIFont *)filenameFont

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

@ -242,7 +242,55 @@ public class ConversationStyle: NSObject {
}
@objc
public func secondaryTextColor(isIncoming: Bool) -> UIColor {
public func bubbleSecondaryTextColor(isIncoming: Bool) -> UIColor {
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