Merge branch 'charlesmchen/untweakColors'

pull/1/head
Matthew Chen 7 years ago
commit 418d33287e

@ -6,6 +6,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@class ConversationStyle;
@class ConversationViewItem; @class ConversationViewItem;
@class TSAttachmentStream; @class TSAttachmentStream;
@ -13,7 +14,8 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithAttachment:(TSAttachmentStream *)attachmentStream - (instancetype)initWithAttachment:(TSAttachmentStream *)attachmentStream
isIncoming:(BOOL)isIncoming isIncoming:(BOOL)isIncoming
viewItem:(ConversationViewItem *)viewItem; viewItem:(ConversationViewItem *)viewItem
conversationStyle:(ConversationStyle *)conversationStyle;
- (void)createContents; - (void)createContents;

@ -18,6 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic) TSAttachmentStream *attachmentStream; @property (nonatomic) TSAttachmentStream *attachmentStream;
@property (nonatomic) BOOL isIncoming; @property (nonatomic) BOOL isIncoming;
@property (nonatomic, weak) ConversationViewItem *viewItem; @property (nonatomic, weak) ConversationViewItem *viewItem;
@property (nonatomic, readonly) ConversationStyle *conversationStyle;
@property (nonatomic, nullable) UIButton *audioPlayPauseButton; @property (nonatomic, nullable) UIButton *audioPlayPauseButton;
@property (nonatomic, nullable) UILabel *audioBottomLabel; @property (nonatomic, nullable) UILabel *audioBottomLabel;
@ -32,6 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithAttachment:(TSAttachmentStream *)attachmentStream - (instancetype)initWithAttachment:(TSAttachmentStream *)attachmentStream
isIncoming:(BOOL)isIncoming isIncoming:(BOOL)isIncoming
viewItem:(ConversationViewItem *)viewItem viewItem:(ConversationViewItem *)viewItem
conversationStyle:(ConversationStyle *)conversationStyle
{ {
self = [super init]; self = [super init];
@ -39,6 +41,7 @@ NS_ASSUME_NONNULL_BEGIN
_attachmentStream = attachmentStream; _attachmentStream = attachmentStream;
_isIncoming = isIncoming; _isIncoming = isIncoming;
_viewItem = viewItem; _viewItem = viewItem;
_conversationStyle = conversationStyle;
} }
return self; return self;
@ -118,7 +121,7 @@ NS_ASSUME_NONNULL_BEGIN
[self.audioProgressView [self.audioProgressView
setProgress:(self.audioDurationSeconds > 0 ? self.audioProgressSeconds / self.audioDurationSeconds : 0.f)]; setProgress:(self.audioDurationSeconds > 0 ? self.audioProgressSeconds / self.audioDurationSeconds : 0.f)];
UIColor *progressColor = (self.isIncoming ? [UIColor ows_light02Color] : [UIColor ows_light60Color]); UIColor *progressColor = [self.conversationStyle bubbleSecondaryTextColorWithIsIncoming:self.isIncoming];
self.audioProgressView.horizontalBarColor = progressColor; self.audioProgressView.horizontalBarColor = progressColor;
self.audioProgressView.progressColor = progressColor; self.audioProgressView.progressColor = progressColor;
} }
@ -201,7 +204,7 @@ NS_ASSUME_NONNULL_BEGIN
} }
UILabel *topLabel = [UILabel new]; UILabel *topLabel = [UILabel new];
topLabel.text = topText; topLabel.text = topText;
topLabel.textColor = (self.isIncoming ? [UIColor ows_whiteColor] : [UIColor ows_light90Color]); topLabel.textColor = [self.conversationStyle bubbleTextColorWithIsIncoming:self.isIncoming];
topLabel.lineBreakMode = NSLineBreakByTruncatingMiddle; topLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
topLabel.font = [OWSAudioMessageView labelFont]; topLabel.font = [OWSAudioMessageView labelFont];
@ -213,7 +216,7 @@ NS_ASSUME_NONNULL_BEGIN
UILabel *bottomLabel = [UILabel new]; UILabel *bottomLabel = [UILabel new];
self.audioBottomLabel = bottomLabel; self.audioBottomLabel = bottomLabel;
[self updateAudioBottomLabel]; [self updateAudioBottomLabel];
bottomLabel.textColor = (self.isIncoming ? [UIColor colorWithWhite:1.f alpha:0.7f] : [UIColor ows_light60Color]); bottomLabel.textColor = [self.conversationStyle bubbleSecondaryTextColorWithIsIncoming:self.isIncoming];
bottomLabel.lineBreakMode = NSLineBreakByTruncatingMiddle; bottomLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
bottomLabel.font = [OWSAudioMessageView labelFont]; bottomLabel.font = [OWSAudioMessageView labelFont];

@ -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;

@ -134,6 +134,11 @@ NS_ASSUME_NONNULL_BEGIN
[self addSubview:label]; [self addSubview:label];
[label autoPinToSuperviewEdges]; [label autoPinToSuperviewEdges];
[label autoSetDimension:ALDimensionHeight toSize:OWSContactShareButtonsView.buttonHeight]; [label autoSetDimension:ALDimensionHeight toSize:OWSContactShareButtonsView.buttonHeight];
self.userInteractionEnabled = YES;
UITapGestureRecognizer *tap =
[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)];
[self addGestureRecognizer:tap];
} }
- (BOOL)handleTapGesture:(UITapGestureRecognizer *)sender - (BOOL)handleTapGesture:(UITapGestureRecognizer *)sender

@ -5,10 +5,13 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@class ContactShareViewModel; @class ContactShareViewModel;
@class ConversationStyle;
@interface OWSContactShareView : UIView @interface OWSContactShareView : UIView
- (instancetype)initWithContactShare:(ContactShareViewModel *)contactShare isIncoming:(BOOL)isIncoming; - (instancetype)initWithContactShare:(ContactShareViewModel *)contactShare
isIncoming:(BOOL)isIncoming
conversationStyle:(ConversationStyle *)conversationStyle;
- (void)createContents; - (void)createContents;

@ -20,6 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly) ContactShareViewModel *contactShare; @property (nonatomic, readonly) ContactShareViewModel *contactShare;
@property (nonatomic, readonly) BOOL isIncoming; @property (nonatomic, readonly) BOOL isIncoming;
@property (nonatomic, readonly) ConversationStyle *conversationStyle;
@property (nonatomic, readonly) OWSContactsManager *contactsManager; @property (nonatomic, readonly) OWSContactsManager *contactsManager;
@end @end
@ -30,12 +31,14 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithContactShare:(ContactShareViewModel *)contactShare - (instancetype)initWithContactShare:(ContactShareViewModel *)contactShare
isIncoming:(BOOL)isIncoming isIncoming:(BOOL)isIncoming
conversationStyle:(ConversationStyle *)conversationStyle
{ {
self = [super init]; self = [super init];
if (self) { if (self) {
_contactShare = contactShare; _contactShare = contactShare;
_isIncoming = isIncoming; _isIncoming = isIncoming;
_conversationStyle = conversationStyle;
_contactsManager = [Environment current].contactsManager; _contactsManager = [Environment current].contactsManager;
} }
@ -101,7 +104,7 @@ NS_ASSUME_NONNULL_BEGIN
{ {
self.layoutMargins = UIEdgeInsetsZero; self.layoutMargins = UIEdgeInsetsZero;
UIColor *textColor = (self.isIncoming ? [UIColor ows_whiteColor] : [UIColor ows_light90Color]); UIColor *textColor = [self.conversationStyle bubbleTextColorWithIsIncoming:self.isIncoming];
AvatarImageView *avatarView = [AvatarImageView new]; AvatarImageView *avatarView = [AvatarImageView new];
avatarView.image = avatarView.image =
@ -128,8 +131,7 @@ 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];
// TODO: bottomLabel.textColor = [self.conversationStyle bubbleSecondaryTextColorWithIsIncoming:self.isIncoming];
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];

@ -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];

@ -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];
} }
@ -942,7 +948,8 @@ NS_ASSUME_NONNULL_BEGIN
OWSAudioMessageView *audioMessageView = [[OWSAudioMessageView alloc] initWithAttachment:self.attachmentStream OWSAudioMessageView *audioMessageView = [[OWSAudioMessageView alloc] initWithAttachment:self.attachmentStream
isIncoming:self.isIncoming isIncoming:self.isIncoming
viewItem:self.viewItem]; viewItem:self.viewItem
conversationStyle:self.conversationStyle];
self.viewItem.lastAudioMessageView = audioMessageView; self.viewItem.lastAudioMessageView = audioMessageView;
[audioMessageView createContents]; [audioMessageView createContents];
[self addAttachmentUploadViewIfNecessary:audioMessageView]; [self addAttachmentUploadViewIfNecessary:audioMessageView];
@ -1016,7 +1023,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 = ^{
@ -1034,7 +1041,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];
@ -1057,8 +1066,9 @@ NS_ASSUME_NONNULL_BEGIN
{ {
OWSAssert(self.viewItem.contactShare); OWSAssert(self.viewItem.contactShare);
OWSContactShareView *contactShareView = OWSContactShareView *contactShareView = [[OWSContactShareView alloc] initWithContactShare:self.viewItem.contactShare
[[OWSContactShareView alloc] initWithContactShare:self.viewItem.contactShare isIncoming:self.isIncoming]; isIncoming:self.isIncoming
conversationStyle:self.conversationStyle];
[contactShareView createContents]; [contactShareView createContents];
// TODO: Should we change appearance if contact avatar is uploading? // TODO: Should we change appearance if contact avatar is uploading?
@ -1193,7 +1203,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;
} }
@ -1604,11 +1614,15 @@ NS_ASSUME_NONNULL_BEGIN
// Treat this as a "body media" gesture if: // Treat this as a "body media" gesture if:
// //
// * There is a "body media" view. // * There is a "body media" view.
// * The gesture occured within or above the "body media" view. // * The gesture occured within or above the "body media" view...
// * ...OR if the message doesn't have body text.
CGPoint location = [self convertPoint:locationInMessageBubble toView:self.bodyMediaView]; CGPoint location = [self convertPoint:locationInMessageBubble toView:self.bodyMediaView];
if (location.y <= self.bodyMediaView.height) { if (location.y <= self.bodyMediaView.height) {
return OWSMessageGestureLocation_Media; return OWSMessageGestureLocation_Media;
} }
if (!self.viewItem.hasBodyText) {
return OWSMessageGestureLocation_Media;
}
} }
if (self.hasTapForMore) { if (self.hasTapForMore) {

@ -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;

@ -45,6 +45,8 @@ NS_ASSUME_NONNULL_BEGIN
self.statusIndicatorImageView = [UIImageView new]; self.statusIndicatorImageView = [UIImageView new];
[self.statusIndicatorImageView setContentHuggingHigh]; [self.statusIndicatorImageView setContentHuggingHigh];
[self addArrangedSubview:self.statusIndicatorImageView]; [self addArrangedSubview:self.statusIndicatorImageView];
self.userInteractionEnabled = NO;
} }
- (void)configureFonts - (void)configureFonts
@ -70,19 +72,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 bubbleSecondaryTextColorWithIsIncoming:isIncoming];
} }
self.timestampLabel.textColor = textColor; self.timestampLabel.textColor = textColor;
@ -115,11 +119,7 @@ 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) { self.statusIndicatorImageView.tintColor = textColor;
self.statusIndicatorImageView.tintColor = [UIColor ows_signalBlueColor];
} 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,9 +179,7 @@ NS_ASSUME_NONNULL_BEGIN
maskLayer.path = bezierPath.CGPath; maskLayer.path = bezierPath.CGPath;
}]; }];
innerBubbleView.layer.mask = maskLayer; innerBubbleView.layer.mask = maskLayer;
innerBubbleView.backgroundColor innerBubbleView.backgroundColor = [self.conversationStyle quotedReplyBubbleColorWithIsIncoming:!self.isOutgoing];
= (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];
@ -194,7 +193,7 @@ NS_ASSUME_NONNULL_BEGIN
[hStackView autoPinToSuperviewEdges]; [hStackView autoPinToSuperviewEdges];
UIView *stripeView = [UIView new]; UIView *stripeView = [UIView new];
stripeView.backgroundColor = (self.isOutgoing ? [self.conversationStyle primaryColor] : [UIColor whiteColor]); stripeView.backgroundColor = [self.conversationStyle quotedReplyStripeColorWithIsIncoming:!self.isOutgoing];
[stripeView autoSetDimension:ALDimensionWidth toSize:self.stripeThickness]; [stripeView autoSetDimension:ALDimensionWidth toSize:self.stripeThickness];
[stripeView setContentHuggingHigh]; [stripeView setContentHuggingHigh];
[stripeView setCompressionResistanceHigh]; [stripeView setCompressionResistanceHigh];
@ -500,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
@ -515,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
@ -525,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

@ -75,6 +75,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (class, readonly, nonatomic) UIColor *ows_green800Color; @property (class, readonly, nonatomic) UIColor *ows_green800Color;
@property (class, readonly, nonatomic) UIColor *ows_deepOrange900Color; @property (class, readonly, nonatomic) UIColor *ows_deepOrange900Color;
@property (class, readonly, nonatomic) UIColor *ows_grey600Color; @property (class, readonly, nonatomic) UIColor *ows_grey600Color;
@property (class, readonly, nonatomic) UIColor *ows_darkSkyBlueColor;
@end @end

@ -289,6 +289,11 @@ NS_ASSUME_NONNULL_BEGIN
return [UIColor colorWithRGBHex:0x757575]; return [UIColor colorWithRGBHex:0x757575];
} }
+ (UIColor *)ows_darkSkyBlueColor
{
return [UIColor colorWithRed:32.f / 255.f green:144.f / 255.f blue:234.f / 255.f alpha:1.f];
}
+ (NSDictionary<NSString *, UIColor *> *)ows_conversationColorMap + (NSDictionary<NSString *, UIColor *> *)ows_conversationColorMap
{ {
static NSDictionary<NSString *, UIColor *> *colorMap; static NSDictionary<NSString *, UIColor *> *colorMap;

@ -136,16 +136,14 @@ public class ConversationStyle: NSObject {
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.ows_light10
// 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_darkSkyBlue
@objc @objc
public var primaryColor: UIColor public var primaryColor: UIColor
@ -153,59 +151,108 @@ 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_light90
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 message is 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 bubbleSecondaryTextColor(isIncoming: Bool) -> UIColor {
return bubbleTextColor(isIncoming: isIncoming).withAlphaComponent(0.7)
}
@objc
public func quotedReplyBubbleColor(isIncoming: Bool) -> UIColor {
if isIncoming {
return bubbleColorOutgoingSent.withAlphaComponent(0.25)
} else {
return ConversationStyle.defaultBubbleColorIncoming.withAlphaComponent(0.75)
}
}
@objc
public func quotedReplyStripeColor(isIncoming: Bool) -> UIColor {
if isIncoming {
return bubbleColorOutgoingSent
} else {
return UIColor.white
}
}
@objc
public func quotingSelfHighlightColor() -> UIColor {
// TODO:
return UIColor.init(rgbHex: 0xB5B5B5)
}
@objc
public func quotedReplyAuthorColor() -> UIColor {
return UIColor.ows_light90
}
@objc
public func quotedReplyTextColor() -> UIColor {
return UIColor.ows_light90
}
@objc
public func quotedReplyAttachmentColor() -> UIColor {
// TODO:
return UIColor(white: 0.5, alpha: 1.0)
}
} }

Loading…
Cancel
Save