Retweak colors.

This commit is contained in:
Matthew Chen 2018-07-09 10:15:23 -04:00
parent 4b448ed018
commit e7e31c5ee9
7 changed files with 35 additions and 12 deletions

View file

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

View file

@ -18,6 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic) TSAttachmentStream *attachmentStream;
@property (nonatomic) BOOL isIncoming;
@property (nonatomic, weak) ConversationViewItem *viewItem;
@property (nonatomic, readonly) ConversationStyle *conversationStyle;
@property (nonatomic, nullable) UIButton *audioPlayPauseButton;
@property (nonatomic, nullable) UILabel *audioBottomLabel;
@ -32,6 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithAttachment:(TSAttachmentStream *)attachmentStream
isIncoming:(BOOL)isIncoming
viewItem:(ConversationViewItem *)viewItem
conversationStyle:(ConversationStyle *)conversationStyle
{
self = [super init];
@ -39,6 +41,7 @@ NS_ASSUME_NONNULL_BEGIN
_attachmentStream = attachmentStream;
_isIncoming = isIncoming;
_viewItem = viewItem;
_conversationStyle = conversationStyle;
}
return self;
@ -118,7 +121,7 @@ NS_ASSUME_NONNULL_BEGIN
[self.audioProgressView
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.progressColor = progressColor;
}
@ -201,7 +204,7 @@ NS_ASSUME_NONNULL_BEGIN
}
UILabel *topLabel = [UILabel new];
topLabel.text = topText;
topLabel.textColor = (self.isIncoming ? [UIColor ows_whiteColor] : [UIColor ows_light90Color]);
topLabel.textColor = [self.conversationStyle bubbleTextColorWithIsIncoming:self.isIncoming];
topLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
topLabel.font = [OWSAudioMessageView labelFont];
@ -213,7 +216,7 @@ NS_ASSUME_NONNULL_BEGIN
UILabel *bottomLabel = [UILabel new];
self.audioBottomLabel = bottomLabel;
[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.font = [OWSAudioMessageView labelFont];

View file

@ -134,6 +134,11 @@ NS_ASSUME_NONNULL_BEGIN
[self addSubview:label];
[label autoPinToSuperviewEdges];
[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

View file

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

View file

@ -20,6 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly) ContactShareViewModel *contactShare;
@property (nonatomic, readonly) BOOL isIncoming;
@property (nonatomic, readonly) ConversationStyle *conversationStyle;
@property (nonatomic, readonly) OWSContactsManager *contactsManager;
@end
@ -30,12 +31,14 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithContactShare:(ContactShareViewModel *)contactShare
isIncoming:(BOOL)isIncoming
conversationStyle:(ConversationStyle *)conversationStyle
{
self = [super init];
if (self) {
_contactShare = contactShare;
_isIncoming = isIncoming;
_conversationStyle = conversationStyle;
_contactsManager = [Environment current].contactsManager;
}
@ -101,7 +104,7 @@ NS_ASSUME_NONNULL_BEGIN
{
self.layoutMargins = UIEdgeInsetsZero;
UIColor *textColor = (self.isIncoming ? [UIColor ows_whiteColor] : [UIColor ows_light90Color]);
UIColor *textColor = [self.conversationStyle bubbleTextColorWithIsIncoming:self.isIncoming];
AvatarImageView *avatarView = [AvatarImageView new];
avatarView.image =
@ -128,8 +131,7 @@ NS_ASSUME_NONNULL_BEGIN
if (firstPhoneNumber.length > 0) {
UILabel *bottomLabel = [UILabel new];
bottomLabel.text = [PhoneNumber bestEffortLocalizedPhoneNumberWithE164:firstPhoneNumber];
// TODO:
bottomLabel.textColor = [textColor colorWithAlphaComponent:0.7f];
bottomLabel.textColor = [self.conversationStyle bubbleSecondaryTextColorWithIsIncoming:self.isIncoming];
bottomLabel.lineBreakMode = NSLineBreakByTruncatingTail;
bottomLabel.font = OWSContactShareView.subtitleFont;
[labelsView addArrangedSubview:bottomLabel];

View file

@ -948,7 +948,8 @@ NS_ASSUME_NONNULL_BEGIN
OWSAudioMessageView *audioMessageView = [[OWSAudioMessageView alloc] initWithAttachment:self.attachmentStream
isIncoming:self.isIncoming
viewItem:self.viewItem];
viewItem:self.viewItem
conversationStyle:self.conversationStyle];
self.viewItem.lastAudioMessageView = audioMessageView;
[audioMessageView createContents];
[self addAttachmentUploadViewIfNecessary:audioMessageView];
@ -1065,8 +1066,9 @@ NS_ASSUME_NONNULL_BEGIN
{
OWSAssert(self.viewItem.contactShare);
OWSContactShareView *contactShareView =
[[OWSContactShareView alloc] initWithContactShare:self.viewItem.contactShare isIncoming:self.isIncoming];
OWSContactShareView *contactShareView = [[OWSContactShareView alloc] initWithContactShare:self.viewItem.contactShare
isIncoming:self.isIncoming
conversationStyle:self.conversationStyle];
[contactShareView createContents];
// TODO: Should we change appearance if contact avatar is uploading?
@ -1612,11 +1614,15 @@ NS_ASSUME_NONNULL_BEGIN
// Treat this as a "body media" gesture if:
//
// * 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];
if (location.y <= self.bodyMediaView.height) {
return OWSMessageGestureLocation_Media;
}
if (!self.viewItem.hasBodyText) {
return OWSMessageGestureLocation_Media;
}
}
if (self.hasTapForMore) {

View file

@ -45,6 +45,8 @@ NS_ASSUME_NONNULL_BEGIN
self.statusIndicatorImageView = [UIImageView new];
[self.statusIndicatorImageView setContentHuggingHigh];
[self addArrangedSubview:self.statusIndicatorImageView];
self.userInteractionEnabled = NO;
}
- (void)configureFonts