From e7e31c5ee94eef3a064ba8cbac6153d6d9a6aa33 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Mon, 9 Jul 2018 10:15:23 -0400 Subject: [PATCH] Retweak colors. --- .../ConversationView/Cells/OWSAudioMessageView.h | 4 +++- .../ConversationView/Cells/OWSAudioMessageView.m | 9 ++++++--- .../Cells/OWSContactShareButtonsView.m | 5 +++++ .../ConversationView/Cells/OWSContactShareView.h | 5 ++++- .../ConversationView/Cells/OWSContactShareView.m | 8 +++++--- .../ConversationView/Cells/OWSMessageBubbleView.m | 14 ++++++++++---- .../ConversationView/Cells/OWSMessageFooterView.m | 2 ++ 7 files changed, 35 insertions(+), 12 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.h b/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.h index 065e69c90..4c3eb02a8 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.h +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.h @@ -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; diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.m index 406193862..029cdb0a4 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.m @@ -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]; diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareButtonsView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareButtonsView.m index 7df1139d7..d610189d9 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareButtonsView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareButtonsView.m @@ -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 diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.h b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.h index c374c9fcf..b8cab42bc 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.h +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.h @@ -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; diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.m index 3b51fd810..a51bc035d 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.m @@ -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]; diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m index dfc9d8d7d..6e794396e 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m @@ -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) { diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.m index f2341a7a8..2d866fd10 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.m @@ -45,6 +45,8 @@ NS_ASSUME_NONNULL_BEGIN self.statusIndicatorImageView = [UIImageView new]; [self.statusIndicatorImageView setContentHuggingHigh]; [self addArrangedSubview:self.statusIndicatorImageView]; + + self.userInteractionEnabled = NO; } - (void)configureFonts