Tweak color palette.

pull/1/head
Matthew Chen 7 years ago
parent ce9a9ec925
commit cbc80abff1

@ -457,7 +457,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert([self.viewItem.interaction isKindOfClass:[TSMessage class]]); OWSAssert([self.viewItem.interaction isKindOfClass:[TSMessage class]]);
TSMessage *message = (TSMessage *)self.viewItem.interaction; TSMessage *message = (TSMessage *)self.viewItem.interaction;
return [self.bubbleFactory bubbleColorWithMessage:message]; return [OWSMessagesBubbleColors bubbleColorWithMessage:message];
} }
- (BOOL)hasBodyMediaWithThumbnail - (BOOL)hasBodyMediaWithThumbnail
@ -1202,11 +1202,6 @@ NS_ASSUME_NONNULL_BEGIN
return outgoingMessage.messageState == TSOutgoingMessageStateSending; return outgoingMessage.messageState == TSOutgoingMessageStateSending;
} }
- (OWSMessagesBubbleImageFactory *)bubbleFactory
{
return [OWSMessagesBubbleImageFactory shared];
}
- (void)prepareForReuse - (void)prepareForReuse
{ {
[NSLayoutConstraint deactivateConstraints:self.viewConstraints]; [NSLayoutConstraint deactivateConstraints:self.viewConstraints];

@ -104,7 +104,7 @@ NS_ASSUME_NONNULL_BEGIN
- (UIColor *)highlightColor - (UIColor *)highlightColor
{ {
BOOL isQuotingSelf = [NSObject isNullableObject:self.quotedMessage.authorId equalTo:TSAccountManager.localNumber]; BOOL isQuotingSelf = [NSObject isNullableObject:self.quotedMessage.authorId equalTo:TSAccountManager.localNumber];
return (isQuotingSelf ? OWSMessagesBubbleImageFactory.bubbleColorOutgoingSent : [UIColor colorWithRGBHex:0xB5B5B5]); return (isQuotingSelf ? OWSMessagesBubbleColors.bubbleColorOutgoingSent : [UIColor colorWithRGBHex:0xB5B5B5]);
} }
#pragma mark - #pragma mark -
@ -120,7 +120,7 @@ NS_ASSUME_NONNULL_BEGIN
self.clipsToBounds = YES; self.clipsToBounds = YES;
self.boundsStrokeView = [OWSBubbleShapeView new]; self.boundsStrokeView = [OWSBubbleShapeView new];
self.boundsStrokeView.strokeColor = OWSMessagesBubbleImageFactory.bubbleColorIncoming; self.boundsStrokeView.strokeColor = OWSMessagesBubbleColors.bubbleColorIncoming;
self.boundsStrokeView.strokeThickness = 1.f; self.boundsStrokeView.strokeThickness = 1.f;
[self addSubview:self.boundsStrokeView]; [self addSubview:self.boundsStrokeView];
[self.boundsStrokeView autoPinToSuperviewEdges]; [self.boundsStrokeView autoPinToSuperviewEdges];

@ -1326,7 +1326,7 @@ NS_ASSUME_NONNULL_BEGIN
[self fakeOutgoingPngAction:thread [self fakeOutgoingPngAction:thread
actionLabel:@"Fake Outgoing 'Outgoing Unsent' Png" actionLabel:@"Fake Outgoing 'Outgoing Unsent' Png"
imageSize:CGSizeMake(200.f, 200.f) imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[OWSMessagesBubbleImageFactory bubbleColorOutgoingUnsent] backgroundColor:[OWSMessagesBubbleColors bubbleColorOutgoingUnsent]
textColor:[UIColor whiteColor] textColor:[UIColor whiteColor]
imageLabel:@"W" imageLabel:@"W"
messageState:TSOutgoingMessageStateFailed messageState:TSOutgoingMessageStateFailed
@ -1334,7 +1334,7 @@ NS_ASSUME_NONNULL_BEGIN
[self fakeOutgoingPngAction:thread [self fakeOutgoingPngAction:thread
actionLabel:@"Fake Outgoing 'Outgoing Unsent' Png" actionLabel:@"Fake Outgoing 'Outgoing Unsent' Png"
imageSize:CGSizeMake(200.f, 200.f) imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[OWSMessagesBubbleImageFactory bubbleColorOutgoingUnsent] backgroundColor:[OWSMessagesBubbleColors bubbleColorOutgoingUnsent]
textColor:[UIColor whiteColor] textColor:[UIColor whiteColor]
imageLabel:@"W" imageLabel:@"W"
messageState:TSOutgoingMessageStateSending messageState:TSOutgoingMessageStateSending
@ -1342,7 +1342,7 @@ NS_ASSUME_NONNULL_BEGIN
[self fakeOutgoingPngAction:thread [self fakeOutgoingPngAction:thread
actionLabel:@"Fake Outgoing 'Outgoing Unsent' Png" actionLabel:@"Fake Outgoing 'Outgoing Unsent' Png"
imageSize:CGSizeMake(200.f, 200.f) imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[OWSMessagesBubbleImageFactory bubbleColorOutgoingUnsent] backgroundColor:[OWSMessagesBubbleColors bubbleColorOutgoingUnsent]
textColor:[UIColor whiteColor] textColor:[UIColor whiteColor]
imageLabel:@"W" imageLabel:@"W"
messageState:TSOutgoingMessageStateSent messageState:TSOutgoingMessageStateSent
@ -1351,7 +1351,7 @@ NS_ASSUME_NONNULL_BEGIN
[self fakeOutgoingPngAction:thread [self fakeOutgoingPngAction:thread
actionLabel:@"Fake Outgoing 'Outgoing Sending' Png" actionLabel:@"Fake Outgoing 'Outgoing Sending' Png"
imageSize:CGSizeMake(200.f, 200.f) imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[OWSMessagesBubbleImageFactory bubbleColorOutgoingSending] backgroundColor:[OWSMessagesBubbleColors bubbleColorOutgoingSending]
textColor:[UIColor whiteColor] textColor:[UIColor whiteColor]
imageLabel:@"W" imageLabel:@"W"
messageState:TSOutgoingMessageStateFailed messageState:TSOutgoingMessageStateFailed
@ -1359,7 +1359,7 @@ NS_ASSUME_NONNULL_BEGIN
[self fakeOutgoingPngAction:thread [self fakeOutgoingPngAction:thread
actionLabel:@"Fake Outgoing 'Outgoing Sending' Png" actionLabel:@"Fake Outgoing 'Outgoing Sending' Png"
imageSize:CGSizeMake(200.f, 200.f) imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[OWSMessagesBubbleImageFactory bubbleColorOutgoingSending] backgroundColor:[OWSMessagesBubbleColors bubbleColorOutgoingSending]
textColor:[UIColor whiteColor] textColor:[UIColor whiteColor]
imageLabel:@"W" imageLabel:@"W"
messageState:TSOutgoingMessageStateSending messageState:TSOutgoingMessageStateSending
@ -1367,7 +1367,7 @@ NS_ASSUME_NONNULL_BEGIN
[self fakeOutgoingPngAction:thread [self fakeOutgoingPngAction:thread
actionLabel:@"Fake Outgoing 'Outgoing Sending' Png" actionLabel:@"Fake Outgoing 'Outgoing Sending' Png"
imageSize:CGSizeMake(200.f, 200.f) imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[OWSMessagesBubbleImageFactory bubbleColorOutgoingSending] backgroundColor:[OWSMessagesBubbleColors bubbleColorOutgoingSending]
textColor:[UIColor whiteColor] textColor:[UIColor whiteColor]
imageLabel:@"W" imageLabel:@"W"
messageState:TSOutgoingMessageStateSent messageState:TSOutgoingMessageStateSent
@ -1376,7 +1376,7 @@ NS_ASSUME_NONNULL_BEGIN
[self fakeOutgoingPngAction:thread [self fakeOutgoingPngAction:thread
actionLabel:@"Fake Outgoing 'Outgoing Sent' Png" actionLabel:@"Fake Outgoing 'Outgoing Sent' Png"
imageSize:CGSizeMake(200.f, 200.f) imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[OWSMessagesBubbleImageFactory bubbleColorOutgoingSent] backgroundColor:[OWSMessagesBubbleColors bubbleColorOutgoingSent]
textColor:[UIColor whiteColor] textColor:[UIColor whiteColor]
imageLabel:@"W" imageLabel:@"W"
messageState:TSOutgoingMessageStateFailed messageState:TSOutgoingMessageStateFailed
@ -1384,7 +1384,7 @@ NS_ASSUME_NONNULL_BEGIN
[self fakeOutgoingPngAction:thread [self fakeOutgoingPngAction:thread
actionLabel:@"Fake Outgoing 'Outgoing Sent' Png" actionLabel:@"Fake Outgoing 'Outgoing Sent' Png"
imageSize:CGSizeMake(200.f, 200.f) imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[OWSMessagesBubbleImageFactory bubbleColorOutgoingSent] backgroundColor:[OWSMessagesBubbleColors bubbleColorOutgoingSent]
textColor:[UIColor whiteColor] textColor:[UIColor whiteColor]
imageLabel:@"W" imageLabel:@"W"
messageState:TSOutgoingMessageStateSending messageState:TSOutgoingMessageStateSending
@ -1392,7 +1392,7 @@ NS_ASSUME_NONNULL_BEGIN
[self fakeOutgoingPngAction:thread [self fakeOutgoingPngAction:thread
actionLabel:@"Fake Outgoing 'Outgoing Sent' Png" actionLabel:@"Fake Outgoing 'Outgoing Sent' Png"
imageSize:CGSizeMake(200.f, 200.f) imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[OWSMessagesBubbleImageFactory bubbleColorOutgoingSent] backgroundColor:[OWSMessagesBubbleColors bubbleColorOutgoingSent]
textColor:[UIColor whiteColor] textColor:[UIColor whiteColor]
imageLabel:@"W" imageLabel:@"W"
messageState:TSOutgoingMessageStateSent messageState:TSOutgoingMessageStateSent
@ -1560,7 +1560,7 @@ NS_ASSUME_NONNULL_BEGIN
[self fakeIncomingPngAction:thread [self fakeIncomingPngAction:thread
actionLabel:@"Fake Incoming 'Incoming' Png" actionLabel:@"Fake Incoming 'Incoming' Png"
imageSize:CGSizeMake(200.f, 200.f) imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[OWSMessagesBubbleImageFactory bubbleColorIncoming] backgroundColor:[OWSMessagesBubbleColors bubbleColorIncoming]
textColor:[UIColor whiteColor] textColor:[UIColor whiteColor]
imageLabel:@"W" imageLabel:@"W"
isAttachmentDownloaded:YES isAttachmentDownloaded:YES
@ -1568,7 +1568,7 @@ NS_ASSUME_NONNULL_BEGIN
[self fakeIncomingPngAction:thread [self fakeIncomingPngAction:thread
actionLabel:@"Fake Incoming 'Incoming' Png" actionLabel:@"Fake Incoming 'Incoming' Png"
imageSize:CGSizeMake(200.f, 200.f) imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[OWSMessagesBubbleImageFactory bubbleColorIncoming] backgroundColor:[OWSMessagesBubbleColors bubbleColorIncoming]
textColor:[UIColor whiteColor] textColor:[UIColor whiteColor]
imageLabel:@"W" imageLabel:@"W"
isAttachmentDownloaded:NO isAttachmentDownloaded:NO

@ -20,7 +20,6 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele
let uiDatabaseConnection: YapDatabaseConnection let uiDatabaseConnection: YapDatabaseConnection
let bubbleFactory = OWSMessagesBubbleImageFactory()
var bubbleView: UIView? var bubbleView: UIView?
let mode: MessageMetadataViewMode let mode: MessageMetadataViewMode

@ -6,16 +6,14 @@ import Foundation
import SignalServiceKit import SignalServiceKit
@objc @objc
public class OWSMessagesBubbleImageFactory: NSObject { public class OWSMessagesBubbleColors: NSObject {
@objc override private init() {
public static let shared = OWSMessagesBubbleImageFactory() super.init()
}
// TODO: UIView is a little bit expensive to instantiate. @objc
// Can we cache this value? public static let shared = OWSMessagesBubbleColors()
private lazy var isRTL: Bool = {
return UIView().isRTL()
}()
@objc @objc
public static let bubbleColorIncoming = UIColor.ows_messageBubbleLightGray public static let bubbleColorIncoming = UIColor.ows_messageBubbleLightGray
@ -27,20 +25,20 @@ public class OWSMessagesBubbleImageFactory: NSObject {
public static let bubbleColorOutgoingSending = UIColor.ows_fadedBlue public static let bubbleColorOutgoingSending = UIColor.ows_fadedBlue
@objc @objc
public static let bubbleColorOutgoingSent = UIColor.ows_materialBlue public static let bubbleColorOutgoingSent = UIColor.ows_light10
@objc @objc
public func bubbleColor(message: TSMessage) -> UIColor { public static func bubbleColor(message: TSMessage) -> UIColor {
if message is TSIncomingMessage { if message is TSIncomingMessage {
return OWSMessagesBubbleImageFactory.bubbleColorIncoming return OWSMessagesBubbleColors.bubbleColorIncoming
} else if let outgoingMessage = message as? TSOutgoingMessage { } else if let outgoingMessage = message as? TSOutgoingMessage {
switch outgoingMessage.messageState { switch outgoingMessage.messageState {
case .failed: case .failed:
return OWSMessagesBubbleImageFactory.bubbleColorOutgoingUnsent return OWSMessagesBubbleColors.bubbleColorOutgoingUnsent
case .sending: case .sending:
return OWSMessagesBubbleImageFactory.bubbleColorOutgoingSending return OWSMessagesBubbleColors.bubbleColorOutgoingSending
default: default:
return OWSMessagesBubbleImageFactory.bubbleColorOutgoingSent return OWSMessagesBubbleColors.bubbleColorOutgoingSent
} }
} else { } else {
owsFail("Unexpected message type: \(message)") owsFail("Unexpected message type: \(message)")

Loading…
Cancel
Save