mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Apply conversation colors.
This commit is contained in:
parent
63fa6f5c00
commit
2653ed7e3f
|
@ -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];
|
||||
|
||||
|
|
|
@ -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)];
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Reference in a new issue