From 5a373d04fa6a6d23fd11f39acf2611d8485204ed Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Tue, 10 Dec 2019 15:11:46 +1100 Subject: [PATCH] WIP --- .../Cells/OWSQuotedMessageView.m | 31 +++++++--------- SignalMessaging/utils/ConversationStyle.swift | 37 ++++--------------- 2 files changed, 21 insertions(+), 47 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m index 386fc4d0b..a38ccda9c 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m @@ -131,7 +131,7 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3; - (CGFloat)bubbleHMargin { - return (self.isForPreview ? 0.f : 6.f); + return (self.isForPreview ? 0.f : LKValues.largeSpacing); } - (CGFloat)hSpacing @@ -141,12 +141,12 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3; - (CGFloat)vSpacing { - return 2.f; + return 4.f; } - (CGFloat)stripeThickness { - return 4.f; + return LKValues.accentLineThickness; } - (UIColor *)quoteBubbleBackgroundColor @@ -176,8 +176,8 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3; const CGFloat bubbleTop = 0.f; const CGFloat bubbleBottom = layerFrame.size.height; - const CGFloat sharpCornerRadius = 4; - const CGFloat wideCornerRadius = 12; + const CGFloat sharpCornerRadius = self.isForPreview ? 4 : 2; + const CGFloat wideCornerRadius = self.isForPreview ? 14 : 4; UIBezierPath *bezierPath = [OWSBubbleView roundedBezierRectWithBubbleTop:bubbleTop bubbleLeft:bubbleLeft @@ -191,7 +191,9 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3; }]; innerBubbleView.layer.mask = maskLayer; if (self.isForPreview) { - innerBubbleView.backgroundColor = [UIColor.lokiGreen colorWithAlphaComponent:0.4f]; + NSString *userHexEncodedPublicKey = OWSIdentityManager.sharedManager.identityKeyPair.hexEncodedPublicKey; + BOOL wasSentByUser = [self.quotedMessage.authorId isEqual:userHexEncodedPublicKey]; + innerBubbleView.backgroundColor = [self.conversationStyle quotedReplyBubbleColorWithIsIncoming:wasSentByUser]; } else { innerBubbleView.backgroundColor = self.quoteBubbleBackgroundColor; } @@ -209,7 +211,7 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3; UIView *stripeView = [UIView new]; if (self.isForPreview) { - stripeView.backgroundColor = UIColor.lokiGreen; + stripeView.backgroundColor = LKColors.accent; } else { stripeView.backgroundColor = [self.conversationStyle quotedReplyStripeColorWithIsIncoming:!self.isOutgoing]; } @@ -318,10 +320,7 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3; if (self.isForPreview) { UIButton *cancelButton = [UIButton buttonWithType:UIButtonTypeCustom]; - [cancelButton - setImage:[[UIImage imageNamed:@"compose-cancel"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] - forState:UIControlStateNormal]; - cancelButton.imageView.tintColor = Theme.secondaryColor; + [cancelButton setImage:[UIImage imageNamed:@"X"] forState:UIControlStateNormal]; [cancelButton addTarget:self action:@selector(didTapCancel) forControlEvents:UIControlEventTouchUpInside]; [cancelButton setContentHuggingHorizontalHigh]; [cancelButton setCompressionResistanceHorizontalHigh]; @@ -563,11 +562,7 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3; }]; } - quotedAuthorText = [NSString - stringWithFormat: - NSLocalizedString(@"QUOTED_REPLY_AUTHOR_INDICATOR_FORMAT", - @"Indicates the author of a quoted message. Embeds {{the author's name or phone number}}."), - quotedAuthor]; + quotedAuthorText = quotedAuthor; } self.quotedAuthorLabel.text = quotedAuthorText; @@ -638,7 +633,7 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3; - (UIFont *)quotedAuthorFont { - return UIFont.ows_dynamicTypeSubheadlineFont.ows_mediumWeight; + return [UIFont boldSystemFontOfSize:LKValues.smallFontSize]; } - (UIColor *)quotedAuthorColor @@ -653,7 +648,7 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3; - (UIFont *)quotedTextFont { - return [UIFont ows_dynamicTypeBodyFont]; + return [UIFont systemFontOfSize:LKValues.mediumFontSize]; } - (UIColor *)fileTypeTextColor diff --git a/SignalMessaging/utils/ConversationStyle.swift b/SignalMessaging/utils/ConversationStyle.swift index 75f92dbb7..5e95bce71 100644 --- a/SignalMessaging/utils/ConversationStyle.swift +++ b/SignalMessaging/utils/ConversationStyle.swift @@ -218,57 +218,36 @@ public class ConversationStyle: NSObject { @objc public func quotedReplyBubbleColor(isIncoming: Bool) -> UIColor { - if Theme.isDarkThemeEnabled { - if isIncoming { - return UIColor.lokiGreen().withAlphaComponent(0.75) - } else { - return UIColor.lokiDarkestGray().withAlphaComponent(0.4) - } - } else if isIncoming { - return bubbleColorOutgoingSent.withAlphaComponent(0.25) + if isIncoming { + return UIColor(rgbHex: 0x3F4146) // Colors.sentMessageBackgroundColor } else { - return ConversationStyle.defaultBubbleColorIncoming.withAlphaComponent(0.75) + return UIColor(rgbHex: 0x222325) // Colors.receivedMessageBackgroundColor } } @objc public func quotedReplyStripeColor(isIncoming: Bool) -> UIColor { - if Theme.isDarkThemeEnabled { - if isIncoming { - return UIColor.lokiGreen() - } else { - return UIColor.lokiDarkestGray() - } - } else if isIncoming { - return bubbleColorOutgoingSent - } else { - return UIColor.white - } + return UIColor(rgbHex: 0x00F782) // Colors.accent } @objc public func quotingSelfHighlightColor() -> UIColor { // TODO: - return UIColor.init(rgbHex: 0xB5B5B5) + return UIColor.init(rgbHex: 0xFF0000) } @objc public func quotedReplyAuthorColor() -> UIColor { - return quotedReplyTextColor() + return UIColor(rgbHex: 0xFFFFFF) // Colors.text } @objc public func quotedReplyTextColor() -> UIColor { - if Theme.isDarkThemeEnabled { - return UIColor.ows_gray05 - } else { - return UIColor.ows_gray90 - } + return UIColor(rgbHex: 0xFFFFFF) // Colors.text } @objc public func quotedReplyAttachmentColor() -> UIColor { - // TODO: - return UIColor.white + return UIColor(rgbHex: 0xFFFFFF) // Colors.text } }