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

View file

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

View file

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

View file

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

View file

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

View file

@ -948,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];
@ -1065,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?
@ -1612,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) {

View file

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