Retweak colors.

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

@ -137,7 +137,10 @@ NS_ASSUME_NONNULL_BEGIN
[self applyTitleForCall:call label:self.titleLabel]; [self applyTitleForCall:call label:self.titleLabel];
if (self.hasFooter) { if (self.hasFooter) {
[self.footerView configureWithConversationViewItem:self.viewItem isOverlayingMedia:NO]; [self.footerView configureWithConversationViewItem:self.viewItem
isOverlayingMedia:NO
conversationStyle:self.conversationStyle
isIncoming:call.isIncoming];
self.footerView.hidden = NO; self.footerView.hidden = NO;
} else { } else {
self.footerView.hidden = YES; self.footerView.hidden = YES;

@ -454,7 +454,10 @@ NS_ASSUME_NONNULL_BEGIN
[bodyMediaView addSubview:gradientView]; [bodyMediaView addSubview:gradientView];
[self.viewConstraints addObjectsFromArray:[gradientView autoPinToSuperviewEdges]]; [self.viewConstraints addObjectsFromArray:[gradientView autoPinToSuperviewEdges]];
[self.footerView configureWithConversationViewItem:self.viewItem isOverlayingMedia:YES]; [self.footerView configureWithConversationViewItem:self.viewItem
isOverlayingMedia:YES
conversationStyle:self.conversationStyle
isIncoming:self.isIncoming];
[bodyMediaView addSubview:self.footerView]; [bodyMediaView addSubview:self.footerView];
bodyMediaView.layoutMargins = UIEdgeInsetsZero; bodyMediaView.layoutMargins = UIEdgeInsetsZero;
@ -465,7 +468,10 @@ NS_ASSUME_NONNULL_BEGIN
[self.footerView autoPinBottomToSuperviewMarginWithInset:self.conversationStyle.textInsetBottom], [self.footerView autoPinBottomToSuperviewMarginWithInset:self.conversationStyle.textInsetBottom],
]]; ]];
} else { } else {
[self.footerView configureWithConversationViewItem:self.viewItem isOverlayingMedia:NO]; [self.footerView configureWithConversationViewItem:self.viewItem
isOverlayingMedia:NO
conversationStyle:self.conversationStyle
isIncoming:self.isIncoming];
[textViews addObject:self.footerView]; [textViews addObject:self.footerView];
} }

@ -2,13 +2,17 @@
// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// //
@class ConversationStyle;
@class ConversationViewItem; @class ConversationViewItem;
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface OWSMessageFooterView : UIStackView @interface OWSMessageFooterView : UIStackView
- (void)configureWithConversationViewItem:(ConversationViewItem *)viewItem isOverlayingMedia:(BOOL)isOverlayingMedia; - (void)configureWithConversationViewItem:(ConversationViewItem *)viewItem
isOverlayingMedia:(BOOL)isOverlayingMedia
conversationStyle:(ConversationStyle *)conversationStyle
isIncoming:(BOOL)isIncoming;
- (CGSize)measureWithConversationViewItem:(ConversationViewItem *)viewItem; - (CGSize)measureWithConversationViewItem:(ConversationViewItem *)viewItem;

@ -70,19 +70,21 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Load #pragma mark - Load
- (void)configureWithConversationViewItem:(ConversationViewItem *)viewItem isOverlayingMedia:(BOOL)isOverlayingMedia - (void)configureWithConversationViewItem:(ConversationViewItem *)viewItem
isOverlayingMedia:(BOOL)isOverlayingMedia
conversationStyle:(ConversationStyle *)conversationStyle
isIncoming:(BOOL)isIncoming
{ {
OWSAssert(viewItem); OWSAssert(viewItem);
OWSAssert(conversationStyle);
[self configureLabelsWithConversationViewItem:viewItem]; [self configureLabelsWithConversationViewItem:viewItem];
UIColor *textColor; UIColor *textColor;
if (isOverlayingMedia) { if (isOverlayingMedia) {
textColor = [UIColor whiteColor]; textColor = [UIColor whiteColor];
} else if (viewItem.interaction.interactionType == OWSInteractionType_IncomingMessage) {
textColor = [UIColor colorWithWhite:1.f alpha:0.7f];
} else { } else {
textColor = [UIColor ows_light60Color]; textColor = [conversationStyle secondaryTextColorWithIsIncoming:isIncoming];
} }
self.timestampLabel.textColor = textColor; self.timestampLabel.textColor = textColor;

@ -178,6 +178,7 @@ NS_ASSUME_NONNULL_BEGIN
maskLayer.path = bezierPath.CGPath; maskLayer.path = bezierPath.CGPath;
}]; }];
innerBubbleView.layer.mask = maskLayer; innerBubbleView.layer.mask = maskLayer;
// TODO:
innerBubbleView.backgroundColor innerBubbleView.backgroundColor
= (self.isOutgoing ? [self.conversationStyle.primaryColor colorWithAlphaComponent:0.25f] = (self.isOutgoing ? [self.conversationStyle.primaryColor colorWithAlphaComponent:0.25f]
: [UIColor colorWithWhite:1.f alpha:0.75f]); : [UIColor colorWithWhite:1.f alpha:0.75f]);
@ -194,6 +195,7 @@ NS_ASSUME_NONNULL_BEGIN
[hStackView autoPinToSuperviewEdges]; [hStackView autoPinToSuperviewEdges];
UIView *stripeView = [UIView new]; UIView *stripeView = [UIView new];
// TODO:
stripeView.backgroundColor = (self.isOutgoing ? [self.conversationStyle primaryColor] : [UIColor whiteColor]); 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];

@ -134,18 +134,46 @@ public class ConversationStyle: NSObject {
return color return color
} }
// @objc
// public static let bubbleColorIncoming = UIColor.ows_messageBubbleLightGray
//
// @objc
// public static let bubbleColorOutgoingUnsent = UIColor.gray
//
// @objc
// public static let bubbleColorOutgoingSending = UIColor.ows_fadedBlue
//
// @objc
// public static let bubbleColorOutgoingSent = UIColor.ows_materialBlue
//
// @objc
// public func bubbleColor(message: TSMessage) -> UIColor {
// if message is TSIncomingMessage {
// return OWSMessagesBubbleImageFactory.bubbleColorIncoming
// } else if let outgoingMessage = message as? TSOutgoingMessage {
// switch outgoingMessage.messageState {
// case .failed:
// return OWSMessagesBubbleImageFactory.bubbleColorOutgoingUnsent
// case .sending:
// return OWSMessagesBubbleImageFactory.bubbleColorOutgoingSending
// default:
// return OWSMessagesBubbleImageFactory.bubbleColorOutgoingSent
// }
// } else {
// owsFail("Unexpected message type: \(message)")
// return UIColor.ows_materialBlue
// }
// }
private static let defaultBubbleColorIncoming = UIColor.ows_messageBubbleLightGray private static let defaultBubbleColorIncoming = UIColor.ows_messageBubbleLightGray
// TODO:
@objc @objc
public let bubbleColorOutgoingUnsent = UIColor.ows_red public let bubbleColorOutgoingUnsent = UIColor.gray
// TODO:
@objc @objc
public let bubbleColorOutgoingSending = UIColor.ows_light35 public let bubbleColorOutgoingSending = UIColor.ows_fadedBlue
@objc @objc
public let bubbleColorOutgoingSent = UIColor.ows_light10 public let bubbleColorOutgoingSent = UIColor.ows_materialBlue
@objc @objc
public var primaryColor: UIColor public var primaryColor: UIColor
@ -153,59 +181,68 @@ public class ConversationStyle: NSObject {
@objc @objc
public func bubbleColor(message: TSMessage) -> UIColor { public func bubbleColor(message: TSMessage) -> UIColor {
if message is TSIncomingMessage { if message is TSIncomingMessage {
return primaryColor return ConversationStyle.defaultBubbleColorIncoming
} else if let outgoingMessage = message as? TSOutgoingMessage { } else if let outgoingMessage = message as? TSOutgoingMessage {
switch outgoingMessage.messageState { switch outgoingMessage.messageState {
case .failed: case .failed:
return self.bubbleColorOutgoingUnsent return bubbleColorOutgoingUnsent
case .sending: case .sending:
return self.bubbleColorOutgoingSending return bubbleColorOutgoingSending
default: default:
return self.bubbleColorOutgoingSent return bubbleColorOutgoingSent
} }
} else { } else {
owsFail("Unexpected message type: \(message)") owsFail("Unexpected message type: \(message)")
return UIColor.ows_materialBlue return bubbleColorOutgoingSent
} }
} }
@objc @objc
public func bubbleColor(call: TSCall) -> UIColor { public func bubbleColor(call: TSCall) -> UIColor {
if call.isIncoming { return bubbleColor(isIncoming: call.isIncoming)
return primaryColor }
@objc
public func bubbleColor(isIncoming: Bool) -> UIColor {
if isIncoming {
return ConversationStyle.defaultBubbleColorIncoming
} else { } else {
return self.bubbleColorOutgoingSent return self.bubbleColorOutgoingSent
} }
} }
@objc @objc
public static var bubbleTextColorIncoming = UIColor.ows_white public static var bubbleTextColorIncoming = UIColor.ows_black
public static var bubbleTextColorOutgoing = UIColor.ows_white
@objc @objc
public func bubbleTextColor(message: TSMessage) -> UIColor { public func bubbleTextColor(message: TSMessage) -> UIColor {
if message is TSIncomingMessage { if message is TSIncomingMessage {
return ConversationStyle.bubbleTextColorIncoming return ConversationStyle.bubbleTextColorIncoming
} else if let outgoingMessage = message as? TSOutgoingMessage { } else if let _ = message as? TSOutgoingMessage {
switch outgoingMessage.messageState { return ConversationStyle.bubbleTextColorOutgoing
case .failed:
return UIColor.ows_black
case .sending:
return UIColor.ows_black
default:
return UIColor.ows_black
}
} else { } else {
owsFail("Unexpected message type: \(message)") owsFail("Unexpected message type: \(message)")
return UIColor.ows_materialBlue return ConversationStyle.bubbleTextColorOutgoing
} }
} }
@objc @objc
public func bubbleTextColor(call: TSCall) -> UIColor { public func bubbleTextColor(call: TSCall) -> UIColor {
if call.isIncoming { return bubbleTextColor(isIncoming: call.isIncoming)
}
@objc
public func bubbleTextColor(isIncoming: Bool) -> UIColor {
if isIncoming {
return ConversationStyle.bubbleTextColorIncoming return ConversationStyle.bubbleTextColorIncoming
} else { } else {
return UIColor.ows_black return ConversationStyle.bubbleTextColorOutgoing
} }
} }
@objc
public func secondaryTextColor(isIncoming: Bool) -> UIColor {
return bubbleTextColor(isIncoming: isIncoming).withAlphaComponent(0.7)
}
} }

Loading…
Cancel
Save