diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSCallMessageCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSCallMessageCell.m index be2b5d587..d824c6a4b 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSCallMessageCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSCallMessageCell.m @@ -137,7 +137,10 @@ NS_ASSUME_NONNULL_BEGIN [self applyTitleForCall:call label:self.titleLabel]; 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; } else { self.footerView.hidden = YES; diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m index 6b612d25f..74618dc74 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m @@ -454,7 +454,10 @@ NS_ASSUME_NONNULL_BEGIN [bodyMediaView addSubview:gradientView]; [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.layoutMargins = UIEdgeInsetsZero; @@ -465,7 +468,10 @@ NS_ASSUME_NONNULL_BEGIN [self.footerView autoPinBottomToSuperviewMarginWithInset:self.conversationStyle.textInsetBottom], ]]; } 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]; } diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.h b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.h index bc138e7b8..55ef23ff5 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.h +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.h @@ -2,13 +2,17 @@ // Copyright (c) 2018 Open Whisper Systems. All rights reserved. // +@class ConversationStyle; @class ConversationViewItem; NS_ASSUME_NONNULL_BEGIN @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; diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.m index 75f6f6dfb..a713127d6 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.m @@ -70,19 +70,21 @@ NS_ASSUME_NONNULL_BEGIN #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(conversationStyle); [self configureLabelsWithConversationViewItem:viewItem]; UIColor *textColor; if (isOverlayingMedia) { textColor = [UIColor whiteColor]; - } else if (viewItem.interaction.interactionType == OWSInteractionType_IncomingMessage) { - textColor = [UIColor colorWithWhite:1.f alpha:0.7f]; } else { - textColor = [UIColor ows_light60Color]; + textColor = [conversationStyle secondaryTextColorWithIsIncoming:isIncoming]; } self.timestampLabel.textColor = textColor; diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m index 3bfe39fb8..01bd49642 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m @@ -178,6 +178,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]); @@ -194,6 +195,7 @@ NS_ASSUME_NONNULL_BEGIN [hStackView autoPinToSuperviewEdges]; UIView *stripeView = [UIView new]; + // TODO: stripeView.backgroundColor = (self.isOutgoing ? [self.conversationStyle primaryColor] : [UIColor whiteColor]); [stripeView autoSetDimension:ALDimensionWidth toSize:self.stripeThickness]; [stripeView setContentHuggingHigh]; diff --git a/SignalMessaging/utils/ConversationStyle.swift b/SignalMessaging/utils/ConversationStyle.swift index 7abd3fcc0..668141515 100644 --- a/SignalMessaging/utils/ConversationStyle.swift +++ b/SignalMessaging/utils/ConversationStyle.swift @@ -134,18 +134,46 @@ public class ConversationStyle: NSObject { 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 - // TODO: @objc - public let bubbleColorOutgoingUnsent = UIColor.ows_red + public let bubbleColorOutgoingUnsent = UIColor.gray - // TODO: @objc - public let bubbleColorOutgoingSending = UIColor.ows_light35 + public let bubbleColorOutgoingSending = UIColor.ows_fadedBlue @objc - public let bubbleColorOutgoingSent = UIColor.ows_light10 + public let bubbleColorOutgoingSent = UIColor.ows_materialBlue @objc public var primaryColor: UIColor @@ -153,59 +181,68 @@ public class ConversationStyle: NSObject { @objc public func bubbleColor(message: TSMessage) -> UIColor { if message is TSIncomingMessage { - return primaryColor + return ConversationStyle.defaultBubbleColorIncoming } else if let outgoingMessage = message as? TSOutgoingMessage { switch outgoingMessage.messageState { case .failed: - return self.bubbleColorOutgoingUnsent + return bubbleColorOutgoingUnsent case .sending: - return self.bubbleColorOutgoingSending + return bubbleColorOutgoingSending default: - return self.bubbleColorOutgoingSent + return bubbleColorOutgoingSent } } else { owsFail("Unexpected message type: \(message)") - return UIColor.ows_materialBlue + return bubbleColorOutgoingSent } } @objc public func bubbleColor(call: TSCall) -> UIColor { - if call.isIncoming { - return primaryColor + return bubbleColor(isIncoming: call.isIncoming) + } + + @objc + public func bubbleColor(isIncoming: Bool) -> UIColor { + if isIncoming { + return ConversationStyle.defaultBubbleColorIncoming } else { return self.bubbleColorOutgoingSent } } @objc - public static var bubbleTextColorIncoming = UIColor.ows_white + public static var bubbleTextColorIncoming = UIColor.ows_black + public static var bubbleTextColorOutgoing = UIColor.ows_white @objc public func bubbleTextColor(message: TSMessage) -> UIColor { if message is TSIncomingMessage { return ConversationStyle.bubbleTextColorIncoming - } else if let outgoingMessage = message as? TSOutgoingMessage { - switch outgoingMessage.messageState { - case .failed: - return UIColor.ows_black - case .sending: - return UIColor.ows_black - default: - return UIColor.ows_black - } + } else if let _ = message as? TSOutgoingMessage { + return ConversationStyle.bubbleTextColorOutgoing } else { owsFail("Unexpected message type: \(message)") - return UIColor.ows_materialBlue + return ConversationStyle.bubbleTextColorOutgoing } } @objc 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 } else { - return UIColor.ows_black + return ConversationStyle.bubbleTextColorOutgoing } } + + @objc + public func secondaryTextColor(isIncoming: Bool) -> UIColor { + return bubbleTextColor(isIncoming: isIncoming).withAlphaComponent(0.7) + } }