Merge branch 'charlesmchen/moreColors'

pull/1/head
Matthew Chen 7 years ago
commit a80eb0911d

@ -91,28 +91,26 @@ NS_ASSUME_NONNULL_BEGIN
}
}
- (void)setAudioIcon:(UIImage *)icon iconColor:(UIColor *)iconColor
- (void)setAudioIcon:(UIImage *)icon
{
OWSAssert(icon.size.height == self.iconSize);
icon = [icon imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[_audioPlayPauseButton setImage:icon forState:UIControlStateNormal];
[_audioPlayPauseButton setImage:icon forState:UIControlStateDisabled];
_audioPlayPauseButton.imageView.tintColor = self.bubbleBackgroundColor;
_audioPlayPauseButton.backgroundColor = iconColor;
_audioPlayPauseButton.imageView.tintColor = [UIColor ows_signalBlueColor];
_audioPlayPauseButton.backgroundColor = [UIColor colorWithWhite:1.f alpha:0.92f];
_audioPlayPauseButton.layer.cornerRadius = self.iconSize * 0.5f;
}
- (void)setAudioIconToPlay
{
[self setAudioIcon:[UIImage imageNamed:@"audio_play_black_40"]
iconColor:(self.isIncoming ? [UIColor colorWithRGBHex:0x9e9e9e] : [self audioColorWithOpacity:0.15f])];
[self setAudioIcon:[UIImage imageNamed:@"audio_play_black_40"]];
}
- (void)setAudioIconToPause
{
[self setAudioIcon:[UIImage imageNamed:@"audio_pause_black_40"]
iconColor:(self.isIncoming ? [UIColor colorWithRGBHex:0x9e9e9e] : [self audioColorWithOpacity:0.15f])];
[self setAudioIcon:[UIImage imageNamed:@"audio_pause_black_40"]];
}
- (void)updateAudioProgressView
@ -120,10 +118,9 @@ NS_ASSUME_NONNULL_BEGIN
[self.audioProgressView
setProgress:(self.audioDurationSeconds > 0 ? self.audioProgressSeconds / self.audioDurationSeconds : 0.f)];
self.audioProgressView.horizontalBarColor = [self audioColorWithOpacity:0.75f];
self.audioProgressView.progressColor
= (self.isAudioPlaying ? [self audioColorWithOpacity:self.isIncoming ? 0.2f : 0.1f]
: [self audioColorWithOpacity:0.4f]);
UIColor *progressColor = (self.isIncoming ? [UIColor ows_light02Color] : [UIColor ows_light60Color]);
self.audioProgressView.horizontalBarColor = progressColor;
self.audioProgressView.progressColor = progressColor;
}
#pragma mark -
@ -172,34 +169,13 @@ NS_ASSUME_NONNULL_BEGIN
return [OWSAudioMessageView iconSize];
}
- (UIColor *)audioTextColor
{
return (self.isIncoming ? [UIColor colorWithWhite:0.2f alpha:1.f] : [UIColor whiteColor]);
}
- (UIColor *)audioColorWithOpacity:(CGFloat)alpha
{
return [self.audioTextColor blendWithColor:self.bubbleBackgroundColor alpha:alpha];
}
- (UIColor *)bubbleBackgroundColor
{
return self.isIncoming ? [UIColor ows_messageBubbleLightGrayColor] : [UIColor ows_materialBlueColor];
}
- (BOOL)isVoiceMessage
{
// We want to treat "pre-voice messages flag" messages as voice messages if
// they have no file name.
//
// TODO: Remove this after the flag has been in production for a few months.
return (self.attachmentStream.isVoiceMessage || self.attachmentStream.sourceFilename.length < 1);
return self.attachmentStream.isVoiceMessage;
}
- (void)createContents
{
UIColor *textColor = [self audioTextColor];
self.axis = UILayoutConstraintAxisHorizontal;
self.alignment = UIStackViewAlignmentCenter;
self.spacing = self.hSpacing;
@ -225,7 +201,7 @@ NS_ASSUME_NONNULL_BEGIN
}
UILabel *topLabel = [UILabel new];
topLabel.text = topText;
topLabel.textColor = [textColor colorWithAlphaComponent:0.85f];
topLabel.textColor = (self.isIncoming ? [UIColor ows_whiteColor] : [UIColor ows_light90Color]);
topLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
topLabel.font = [OWSAudioMessageView labelFont];
@ -237,7 +213,7 @@ NS_ASSUME_NONNULL_BEGIN
UILabel *bottomLabel = [UILabel new];
self.audioBottomLabel = bottomLabel;
[self updateAudioBottomLabel];
bottomLabel.textColor = [textColor colorWithAlphaComponent:0.85f];
bottomLabel.textColor = (self.isIncoming ? [UIColor colorWithWhite:1.f alpha:0.7f] : [UIColor ows_light60Color]);
bottomLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
bottomLabel.font = [OWSAudioMessageView labelFont];

@ -45,7 +45,7 @@ NS_ASSUME_NONNULL_BEGIN
self.contentView.layoutMargins = UIEdgeInsetsZero;
self.titleLabel = [UILabel new];
self.titleLabel.textColor = [UIColor blackColor];
self.titleLabel.textColor = [UIColor ows_light60Color];
self.titleLabel.text = NSLocalizedString(@"CONVERSATION_VIEW_CONTACTS_OFFER_TITLE",
@"Title for the group of buttons show for unknown contacts offering to add them to contacts, etc.");
self.titleLabel.lineBreakMode = NSLineBreakByTruncatingTail;
@ -85,9 +85,9 @@ NS_ASSUME_NONNULL_BEGIN
- (void)configureFonts
{
self.titleLabel.font = UIFont.ows_dynamicTypeBodyFont.ows_mediumWeight;
self.titleLabel.font = UIFont.ows_dynamicTypeSubheadlineFont;
UIFont *buttonFont = UIFont.ows_dynamicTypeBodyFont;
UIFont *buttonFont = UIFont.ows_dynamicTypeSubheadlineFont.ows_mediumWeight;
self.addToContactsButton.titleLabel.font = buttonFont;
self.addToProfileWhitelistButton.titleLabel.font = buttonFont;
self.blockButton.titleLabel.font = buttonFont;
@ -97,10 +97,10 @@ NS_ASSUME_NONNULL_BEGIN
{
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:title forState:UIControlStateNormal];
[button setTitleColor:[UIColor ows_materialBlueColor] forState:UIControlStateNormal];
[button setTitleColor:[UIColor ows_signalBlueColor] forState:UIControlStateNormal];
button.titleLabel.textAlignment = NSTextAlignmentCenter;
[button setBackgroundColor:[UIColor colorWithRGBHex:0xf5f5f5]];
button.layer.cornerRadius = 5.f;
[button setBackgroundColor:[UIColor ows_light02Color]];
button.layer.cornerRadius = 4.f;
[button addTarget:self action:selector forControlEvents:UIControlEventTouchUpInside];
return button;
}
@ -130,6 +130,10 @@ NS_ASSUME_NONNULL_BEGIN
[NSLayoutConstraint deactivateConstraints:self.layoutConstraints];
self.layoutConstraints = @[
[self.addToContactsButton autoSetDimension:ALDimensionHeight toSize:self.buttonHeight],
[self.addToProfileWhitelistButton autoSetDimension:ALDimensionHeight toSize:self.buttonHeight],
[self.blockButton autoSetDimension:ALDimensionHeight toSize:self.buttonHeight],
[self.stackView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:self.topVMargin],
[self.stackView autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:self.bottomVMargin],
// TODO: Honor "full-width gutters"?
@ -142,27 +146,22 @@ NS_ASSUME_NONNULL_BEGIN
- (CGFloat)topVMargin
{
return 5.f;
return 0.f;
}
- (CGFloat)bottomVMargin
{
return 5.f;
}
- (CGFloat)buttonVPadding
{
return 5.f;
return 0.f;
}
- (CGFloat)vSpacing
{
return 5.f;
return 8.f;
}
- (CGFloat)buttonHeight
{
return (self.buttonVPadding + CGSizeCeil([self.addToContactsButton sizeThatFits:CGSizeZero]).height);
return (24.f + self.addToContactsButton.titleLabel.font.lineHeight);
}
- (CGSize)cellSizeWithTransaction:(YapDatabaseReadTransaction *)transaction

@ -172,6 +172,8 @@ NS_ASSUME_NONNULL_BEGIN
{
self.layoutMargins = UIEdgeInsetsZero;
UIColor *textColor = (self.isIncoming ? [UIColor ows_whiteColor] : [UIColor ows_light90Color]);
AvatarImageView *avatarView = [AvatarImageView new];
avatarView.image =
[self.contactShare getAvatarImageWithDiameter:self.iconSize contactsManager:self.contactsManager];
@ -183,7 +185,7 @@ NS_ASSUME_NONNULL_BEGIN
UILabel *topLabel = [UILabel new];
topLabel.text = self.contactShare.displayName;
topLabel.textColor = [UIColor blackColor];
topLabel.textColor = textColor;
topLabel.lineBreakMode = NSLineBreakByTruncatingTail;
topLabel.font = OWSContactShareView.nameFont;
@ -197,7 +199,8 @@ NS_ASSUME_NONNULL_BEGIN
if (firstPhoneNumber.length > 0) {
UILabel *bottomLabel = [UILabel new];
bottomLabel.text = [PhoneNumber bestEffortLocalizedPhoneNumberWithE164:firstPhoneNumber];
bottomLabel.textColor = [UIColor ows_darkGrayColor];
// TODO:
bottomLabel.textColor = [textColor colorWithAlphaComponent:0.7f];
bottomLabel.lineBreakMode = NSLineBreakByTruncatingTail;
bottomLabel.font = OWSContactShareView.subtitleFont;
[labelsView addArrangedSubview:bottomLabel];
@ -208,7 +211,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(disclosureImage);
UIImageView *disclosureImageView = [UIImageView new];
disclosureImageView.image = [disclosureImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
disclosureImageView.tintColor = [UIColor blackColor];
disclosureImageView.tintColor = textColor;
[disclosureImageView setCompressionResistanceHigh];
[disclosureImageView setContentHuggingHigh];

@ -4,7 +4,6 @@
#import "OWSGenericAttachmentView.h"
#import "OWSBezierPathView.h"
#import "UIColor+OWS.h"
#import "UIFont+OWS.h"
#import "UIView+OWS.h"
#import "ViewControllerUtils.h"
@ -85,25 +84,8 @@ NS_ASSUME_NONNULL_BEGIN
return 48.f;
}
- (UIColor *)bubbleBackgroundColor
{
return self.isIncoming ? [UIColor ows_messageBubbleLightGrayColor] : [UIColor ows_materialBlueColor];
}
- (UIColor *)textColor
{
return (self.isIncoming ? [UIColor colorWithWhite:0.2f alpha:1.f] : [UIColor whiteColor]);
}
- (UIColor *)foregroundColorWithOpacity:(CGFloat)alpha
{
return [self.textColor blendWithColor:self.bubbleBackgroundColor alpha:alpha];
}
- (void)createContents
{
UIColor *textColor = (self.isIncoming ? [UIColor colorWithWhite:0.2 alpha:1.f] : [UIColor whiteColor]);
self.axis = UILayoutConstraintAxisHorizontal;
self.alignment = UIStackViewAlignmentCenter;
self.spacing = self.hSpacing;
@ -115,7 +97,6 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(image.size.height == self.iconHeight);
UIImageView *imageView = [UIImageView new];
imageView.image = image;
imageView.tintColor = self.bubbleBackgroundColor;
[self addArrangedSubview:imageView];
[imageView setContentHuggingHigh];
@ -130,7 +111,7 @@ NS_ASSUME_NONNULL_BEGIN
UILabel *fileTypeLabel = [UILabel new];
fileTypeLabel.text = fileExtension.uppercaseString;
fileTypeLabel.textColor = UIColor.ows_light90Color;
fileTypeLabel.textColor = [UIColor ows_light90Color];
fileTypeLabel.lineBreakMode = NSLineBreakByTruncatingTail;
fileTypeLabel.font = [UIFont ows_dynamicTypeCaption1Font].ows_mediumWeight;
fileTypeLabel.adjustsFontSizeToFitWidth = YES;
@ -156,7 +137,7 @@ NS_ASSUME_NONNULL_BEGIN
UILabel *topLabel = [UILabel new];
self.topLabel = topLabel;
topLabel.text = topText;
topLabel.textColor = textColor;
topLabel.textColor = (self.isIncoming ? [UIColor ows_whiteColor] : [UIColor ows_light90Color]);
topLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
topLabel.font = [OWSGenericAttachmentView topLabelFont];
[labelsView addArrangedSubview:topLabel];
@ -169,7 +150,7 @@ NS_ASSUME_NONNULL_BEGIN
UILabel *bottomLabel = [UILabel new];
self.bottomLabel = bottomLabel;
bottomLabel.text = bottomText;
bottomLabel.textColor = [textColor colorWithAlphaComponent:0.85f];
bottomLabel.textColor = (self.isIncoming ? [UIColor colorWithWhite:1.f alpha:0.7f] : [UIColor ows_light60Color]);
bottomLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
bottomLabel.font = [OWSGenericAttachmentView bottomLabelFont];
[labelsView addArrangedSubview:bottomLabel];

@ -285,7 +285,8 @@ NS_ASSUME_NONNULL_BEGIN
[OWSQuotedMessageView quotedMessageViewForConversation:self.viewItem.quotedReply
displayableQuotedText:displayableQuotedText
conversationStyle:self.conversationStyle
isOutgoing:isOutgoing];
isOutgoing:isOutgoing
sharesTopBorderWithMessageBubble:!self.shouldShowSenderName];
quotedMessageView.delegate = self;
self.quotedMessageView = quotedMessageView;
@ -1130,7 +1131,8 @@ NS_ASSUME_NONNULL_BEGIN
[OWSQuotedMessageView quotedMessageViewForConversation:self.viewItem.quotedReply
displayableQuotedText:displayableQuotedText
conversationStyle:self.conversationStyle
isOutgoing:isOutgoing];
isOutgoing:isOutgoing
sharesTopBorderWithMessageBubble:NO];
CGSize result = [quotedMessageView sizeForMaxWidth:self.conversationStyle.maxMessageWidth];
return [NSValue valueWithCGSize:CGSizeCeil(result)];
}

@ -117,8 +117,7 @@ NS_ASSUME_NONNULL_BEGIN
self.statusIndicatorImageView.image =
[statusIndicatorImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
if (messageStatus == MessageReceiptStatusRead) {
// TODO: Tint the icon with the conversation color.
self.statusIndicatorImageView.tintColor = textColor;
self.statusIndicatorImageView.tintColor = [UIColor ows_signalBlueColor];
} else {
self.statusIndicatorImageView.tintColor = textColor;
}

@ -34,7 +34,8 @@ NS_ASSUME_NONNULL_BEGIN
+ (OWSQuotedMessageView *)quotedMessageViewForConversation:(OWSQuotedReplyModel *)quotedMessage
displayableQuotedText:(nullable DisplayableText *)displayableQuotedText
conversationStyle:(ConversationStyle *)conversationStyle
isOutgoing:(BOOL)isOutgoing;
isOutgoing:(BOOL)isOutgoing
sharesTopBorderWithMessageBubble:(BOOL)sharesTopBorderWithMessageBubble;
// Factory method for "message compose" views.
+ (OWSQuotedMessageView *)quotedMessageViewForPreview:(OWSQuotedReplyModel *)quotedMessage

@ -25,6 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly) BOOL isForPreview;
@property (nonatomic, readonly) BOOL isOutgoing;
@property (nonatomic, readonly) BOOL sharesTopBorderWithMessageBubble;
@property (nonatomic, readonly) UILabel *quotedAuthorLabel;
@property (nonatomic, readonly) UILabel *quotedTextLabel;
@ -39,6 +40,7 @@ NS_ASSUME_NONNULL_BEGIN
displayableQuotedText:(nullable DisplayableText *)displayableQuotedText
conversationStyle:(ConversationStyle *)conversationStyle
isOutgoing:(BOOL)isOutgoing
sharesTopBorderWithMessageBubble:(BOOL)sharesTopBorderWithMessageBubble
{
OWSAssert(quotedMessage);
@ -46,7 +48,8 @@ NS_ASSUME_NONNULL_BEGIN
displayableQuotedText:displayableQuotedText
conversationStyle:conversationStyle
isForPreview:NO
isOutgoing:isOutgoing];
isOutgoing:isOutgoing
sharesTopBorderWithMessageBubble:sharesTopBorderWithMessageBubble];
}
+ (OWSQuotedMessageView *)quotedMessageViewForPreview:(OWSQuotedReplyModel *)quotedMessage
@ -63,7 +66,8 @@ NS_ASSUME_NONNULL_BEGIN
displayableQuotedText:displayableQuotedText
conversationStyle:conversationStyle
isForPreview:YES
isOutgoing:YES];
isOutgoing:YES
sharesTopBorderWithMessageBubble:NO];
[instance createContents];
return instance;
}
@ -73,6 +77,7 @@ NS_ASSUME_NONNULL_BEGIN
conversationStyle:(ConversationStyle *)conversationStyle
isForPreview:(BOOL)isForPreview
isOutgoing:(BOOL)isOutgoing
sharesTopBorderWithMessageBubble:(BOOL)sharesTopBorderWithMessageBubble
{
self = [super init];
@ -87,6 +92,7 @@ NS_ASSUME_NONNULL_BEGIN
_isForPreview = isForPreview;
_conversationStyle = conversationStyle;
_isOutgoing = isOutgoing;
_sharesTopBorderWithMessageBubble = sharesTopBorderWithMessageBubble;
_quotedAuthorLabel = [UILabel new];
_quotedTextLabel = [UILabel new];
@ -140,6 +146,7 @@ NS_ASSUME_NONNULL_BEGIN
self.clipsToBounds = YES;
CAShapeLayer *maskLayer = [CAShapeLayer new];
BOOL sharesTopBorderWithMessageBubble = self.sharesTopBorderWithMessageBubble;
OWSLayerView *innerBubbleView = [[OWSLayerView alloc]
initWithFrame:CGRectZero
layoutCallback:^(UIView *layerView) {
@ -151,9 +158,8 @@ NS_ASSUME_NONNULL_BEGIN
CGFloat bubbleRight = layerFrame.size.width;
CGFloat bubbleTop = 0.f;
CGFloat bubbleBottom = layerFrame.size.height;
// TODO:
CGFloat bubbleTopRounding = 12.f;
CGFloat bubbleBottomRounding = 12.f;
CGFloat bubbleTopRounding = (sharesTopBorderWithMessageBubble ? 10.f : 4.f);
CGFloat bubbleBottomRounding = 4.f;
[bezierPath moveToPoint:CGPointMake(bubbleLeft + bubbleTopRounding, bubbleTop)];
[bezierPath addLineToPoint:CGPointMake(bubbleRight - bubbleTopRounding, bubbleTop)];
@ -172,8 +178,9 @@ NS_ASSUME_NONNULL_BEGIN
maskLayer.path = bezierPath.CGPath;
}];
innerBubbleView.layer.mask = maskLayer;
// TODO: Color.
innerBubbleView.backgroundColor = [[UIColor ows_cyan800Color] colorWithAlphaComponent:0.25f];
innerBubbleView.backgroundColor
= (self.isOutgoing ? [self.conversationStyle.primaryColor colorWithAlphaComponent:0.25f]
: [UIColor colorWithWhite:1.f alpha:0.75f]);
[self addSubview:innerBubbleView];
[innerBubbleView autoPinLeadingToSuperviewMarginWithInset:self.bubbleHMargin];
[innerBubbleView autoPinTrailingToSuperviewMarginWithInset:self.bubbleHMargin];
@ -187,8 +194,7 @@ NS_ASSUME_NONNULL_BEGIN
[hStackView autoPinToSuperviewEdges];
UIView *stripeView = [UIView new];
// TODO: Color.
stripeView.backgroundColor = [UIColor ows_cyan800Color];
stripeView.backgroundColor = (self.isOutgoing ? [self.conversationStyle primaryColor] : [UIColor whiteColor]);
[stripeView autoSetDimension:ALDimensionWidth toSize:self.stripeThickness];
[stripeView setContentHuggingHigh];
[stripeView setCompressionResistanceHigh];

@ -126,7 +126,7 @@ class AttachmentPointerView: UIStackView {
}
var textColor: UIColor {
return self.isIncoming ? UIColor.darkText : UIColor.white
return self.isIncoming ? UIColor.ows_white : UIColor.ows_light90
}
@objc

Loading…
Cancel
Save