Merge branch 'charlesmchen/tweakColors'

pull/1/head
Matthew Chen 7 years ago
commit 1a7cc3acb4

@ -77,7 +77,7 @@
344F248A20069F0600CFB4F4 /* ViewControllerUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 344F248820069F0600CFB4F4 /* ViewControllerUtils.h */; settings = {ATTRIBUTES = (Public, ); }; };
344F248B20069F0600CFB4F4 /* ViewControllerUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 344F248920069F0600CFB4F4 /* ViewControllerUtils.m */; };
344F248D2007CCD600CFB4F4 /* DisplayableText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 344F248C2007CCD600CFB4F4 /* DisplayableText.swift */; };
344F248F2007D7F200CFB4F4 /* OWSMessagesBubbleImageFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 344F248E2007D7F200CFB4F4 /* OWSMessagesBubbleImageFactory.swift */; };
344F248F2007D7F200CFB4F4 /* OWSMessagesBubbleColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 344F248E2007D7F200CFB4F4 /* OWSMessagesBubbleColors.swift */; };
344F2499200FD03300CFB4F4 /* SharingThreadPickerViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 344F2495200FD03200CFB4F4 /* SharingThreadPickerViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
344F249A200FD03300CFB4F4 /* MessageApprovalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 344F2496200FD03200CFB4F4 /* MessageApprovalViewController.swift */; };
344F249B200FD03300CFB4F4 /* SharingThreadPickerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 344F2497200FD03200CFB4F4 /* SharingThreadPickerViewController.m */; };
@ -681,7 +681,7 @@
344F248820069F0600CFB4F4 /* ViewControllerUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ViewControllerUtils.h; path = SignalMessaging/contacts/ViewControllerUtils.h; sourceTree = SOURCE_ROOT; };
344F248920069F0600CFB4F4 /* ViewControllerUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ViewControllerUtils.m; path = SignalMessaging/contacts/ViewControllerUtils.m; sourceTree = SOURCE_ROOT; };
344F248C2007CCD600CFB4F4 /* DisplayableText.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DisplayableText.swift; sourceTree = "<group>"; };
344F248E2007D7F200CFB4F4 /* OWSMessagesBubbleImageFactory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OWSMessagesBubbleImageFactory.swift; sourceTree = "<group>"; };
344F248E2007D7F200CFB4F4 /* OWSMessagesBubbleColors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OWSMessagesBubbleColors.swift; sourceTree = "<group>"; };
344F2495200FD03200CFB4F4 /* SharingThreadPickerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SharingThreadPickerViewController.h; path = SignalMessaging/attachments/SharingThreadPickerViewController.h; sourceTree = SOURCE_ROOT; };
344F2496200FD03200CFB4F4 /* MessageApprovalViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MessageApprovalViewController.swift; path = SignalMessaging/attachments/MessageApprovalViewController.swift; sourceTree = SOURCE_ROOT; };
344F2497200FD03200CFB4F4 /* SharingThreadPickerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SharingThreadPickerViewController.m; path = SignalMessaging/attachments/SharingThreadPickerViewController.m; sourceTree = SOURCE_ROOT; };
@ -1449,7 +1449,7 @@
45666EC81D994C0D008FE134 /* OWSGroupAvatarBuilder.m */,
34480B481FD0A60200BC14EF /* OWSMath.h */,
3461293B1FD1D46900532771 /* OWSMath.m */,
344F248E2007D7F200CFB4F4 /* OWSMessagesBubbleImageFactory.swift */,
344F248E2007D7F200CFB4F4 /* OWSMessagesBubbleColors.swift */,
346129371FD1B47200532771 /* OWSPreferences.h */,
346129381FD1B47200532771 /* OWSPreferences.m */,
34641E172088D7E900E2EDE5 /* OWSScreenLock.swift */,
@ -3133,7 +3133,7 @@
4565ED06200EA29900C46DBB /* VideoPlayerView.swift in Sources */,
3461295B1FD1D74C00532771 /* Environment.m in Sources */,
346129D51FD20ADC00532771 /* UIViewController+OWS.m in Sources */,
344F248F2007D7F200CFB4F4 /* OWSMessagesBubbleImageFactory.swift in Sources */,
344F248F2007D7F200CFB4F4 /* OWSMessagesBubbleColors.swift in Sources */,
451F8A431FD714FE005CB9DA /* AvatarImageView.swift in Sources */,
346129C91FD2072E00532771 /* NSString+OWS.m in Sources */,
346129CB1FD2072E00532771 /* Promise+retainUntilComplete.swift in Sources */,

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

@ -104,7 +104,7 @@ NS_ASSUME_NONNULL_BEGIN
- (UIColor *)highlightColor
{
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 -
@ -120,7 +120,7 @@ NS_ASSUME_NONNULL_BEGIN
self.clipsToBounds = YES;
self.boundsStrokeView = [OWSBubbleShapeView new];
self.boundsStrokeView.strokeColor = OWSMessagesBubbleImageFactory.bubbleColorIncoming;
self.boundsStrokeView.strokeColor = OWSMessagesBubbleColors.bubbleColorIncoming;
self.boundsStrokeView.strokeThickness = 1.f;
[self addSubview:self.boundsStrokeView];
[self.boundsStrokeView autoPinToSuperviewEdges];

@ -34,7 +34,6 @@ public class ConversationStyle: NSObject {
@objc public var contentWidth: CGFloat = 0
// viewWidth - (gutterfullWidthGutterLeadingLeading + fullWidthGutterTrailing)
// TODO: Is this necessary?
@objc public var fullWidthContentWidth: CGFloat = 0
@objc public var maxMessageWidth: CGFloat = 0

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

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

@ -18,9 +18,6 @@ NS_ASSUME_NONNULL_BEGIN
@property (class, readonly, nonatomic) UIColor *ows_yellowColor;
@property (class, readonly, nonatomic) UIColor *ows_reminderYellowColor;
@property (class, readonly, nonatomic) UIColor *ows_reminderDarkYellowColor;
@property (class, readonly, nonatomic) UIColor *ows_greenColor;
@property (class, readonly, nonatomic) UIColor *ows_redColor;
@property (class, readonly, nonatomic) UIColor *ows_blackColor;
@property (class, readonly, nonatomic) UIColor *ows_darkIconColor;
@property (class, readonly, nonatomic) UIColor *ows_errorMessageBorderColor;
@property (class, readonly, nonatomic) UIColor *ows_infoMessageBorderColor;
@ -32,6 +29,37 @@ NS_ASSUME_NONNULL_BEGIN
- (UIColor *)blendWithColor:(UIColor *)otherColor alpha:(CGFloat)alpha;
#pragma mark -
@property (class, readonly, nonatomic) UIColor *ows_signalBlueColor;
@property (class, readonly, nonatomic) UIColor *ows_greenColor;
@property (class, readonly, nonatomic) UIColor *ows_redColor;
@property (class, readonly, nonatomic) UIColor *ows_whiteColor;
@property (class, readonly, nonatomic) UIColor *ows_light02Color;
@property (class, readonly, nonatomic) UIColor *ows_light10Color;
@property (class, readonly, nonatomic) UIColor *ows_light35Color;
@property (class, readonly, nonatomic) UIColor *ows_light45Color;
@property (class, readonly, nonatomic) UIColor *ows_light60Color;
@property (class, readonly, nonatomic) UIColor *ows_light90Color;
@property (class, readonly, nonatomic) UIColor *ows_dark05Color;
@property (class, readonly, nonatomic) UIColor *ows_dark30Color;
@property (class, readonly, nonatomic) UIColor *ows_dark55Color;
@property (class, readonly, nonatomic) UIColor *ows_dark60Color;
@property (class, readonly, nonatomic) UIColor *ows_dark70Color;
@property (class, readonly, nonatomic) UIColor *ows_dark85Color;
@property (class, readonly, nonatomic) UIColor *ows_dark95Color;
@property (class, readonly, nonatomic) UIColor *ows_blackColor;
@property (class, readonly, nonatomic) UIColor *ows_red700Color;
@property (class, readonly, nonatomic) UIColor *ows_pink600Color;
@property (class, readonly, nonatomic) UIColor *ows_purple600Color;
@property (class, readonly, nonatomic) UIColor *ows_indigo600Color;
@property (class, readonly, nonatomic) UIColor *ows_blue700Color;
@property (class, readonly, nonatomic) UIColor *ows_cyan800Color;
@property (class, readonly, nonatomic) UIColor *ows_teal700Color;
@property (class, readonly, nonatomic) UIColor *ows_green800Color;
@property (class, readonly, nonatomic) UIColor *ows_deepOrange900Color;
@property (class, readonly, nonatomic) UIColor *ows_grey600Color;
@end
NS_ASSUME_NONNULL_END

@ -21,12 +21,6 @@ NS_ASSUME_NONNULL_BEGIN
return [UIColor colorWithRed:32.f / 255.f green:144.f / 255.f blue:234.f / 255.f alpha:1.f];
}
+ (UIColor *)ows_blackColor
{
// black: #080A00
return [UIColor colorWithRed:8.f / 255.f green:10.f / 255.f blue:0. / 255.f alpha:1.f];
}
+ (UIColor *)ows_darkIconColor
{
return [UIColor colorWithRGBHex:0x505050];
@ -64,18 +58,6 @@ NS_ASSUME_NONNULL_BEGIN
return [UIColor colorWithRGBHex:0xFCDA91];
}
+ (UIColor *)ows_greenColor
{
// green: #BF4240
return [UIColor colorWithRed:66.f / 255.f green:191.f / 255.f blue:64.f / 255.f alpha:1.f];
}
+ (UIColor *)ows_redColor
{
// red: #FF3867
return [UIColor colorWithRed:255. / 255.f green:56.f / 255.f blue:103.f / 255.f alpha:1.f];
}
+ (UIColor *)ows_destructiveRedColor
{
return [UIColor colorWithRed:0.98639106750488281 green:0.10408364236354828 blue:0.33135244250297546 alpha:1.f];
@ -180,6 +162,148 @@ NS_ASSUME_NONNULL_BEGIN
alpha:CGFloatLerp(a0, a1, alpha)];
}
#pragma mark - New Colors
+ (UIColor *)ows_signalBlueColor
{
return [UIColor colorWithRGBHex:0x2090EA];
}
+ (UIColor *)ows_greenColor
{
return [UIColor colorWithRGBHex:0x4caf50];
}
+ (UIColor *)ows_redColor
{
return [UIColor colorWithRGBHex:0xf44336];
}
+ (UIColor *)ows_whiteColor
{
return [UIColor colorWithRGBHex:0xFFFFFF];
}
+ (UIColor *)ows_light02Color
{
return [UIColor colorWithRGBHex:0xF9FAFA];
}
+ (UIColor *)ows_light10Color
{
return [UIColor colorWithRGBHex:0xEEEFEF];
}
+ (UIColor *)ows_light35Color
{
return [UIColor colorWithRGBHex:0xA4A6A9];
}
+ (UIColor *)ows_light45Color
{
return [UIColor colorWithRGBHex:0x8B8E91];
}
+ (UIColor *)ows_light60Color
{
return [UIColor colorWithRGBHex:0x62656A];
}
+ (UIColor *)ows_light90Color
{
return [UIColor colorWithRGBHex:0x070C14];
}
+ (UIColor *)ows_dark05Color
{
return [UIColor colorWithRGBHex:0xEFEFEF];
}
+ (UIColor *)ows_dark30Color
{
return [UIColor colorWithRGBHex:0xA8A9AA];
}
+ (UIColor *)ows_dark55Color
{
return [UIColor colorWithRGBHex:0x88898C];
}
+ (UIColor *)ows_dark60Color
{
return [UIColor colorWithRGBHex:0x797A7C];
}
+ (UIColor *)ows_dark70Color
{
return [UIColor colorWithRGBHex:0x414347];
}
+ (UIColor *)ows_dark85Color
{
return [UIColor colorWithRGBHex:0x1A1C20];
}
+ (UIColor *)ows_dark95Color
{
return [UIColor colorWithRGBHex:0x0A0C11];
}
+ (UIColor *)ows_blackColor
{
return [UIColor colorWithRGBHex:0x000000];
}
+ (UIColor *)ows_red700Color
{
return [UIColor colorWithRGBHex:0xd32f2f];
}
+ (UIColor *)ows_pink600Color
{
return [UIColor colorWithRGBHex:0xd81b60];
}
+ (UIColor *)ows_purple600Color
{
return [UIColor colorWithRGBHex:0x8e24aa];
}
+ (UIColor *)ows_indigo600Color
{
return [UIColor colorWithRGBHex:0x3949ab];
}
+ (UIColor *)ows_blue700Color
{
return [UIColor colorWithRGBHex:0x1976d2];
}
+ (UIColor *)ows_cyan800Color
{
return [UIColor colorWithRGBHex:0x00838f];
}
+ (UIColor *)ows_teal700Color
{
return [UIColor colorWithRGBHex:0x00796b];
}
+ (UIColor *)ows_green800Color
{
return [UIColor colorWithRGBHex:0x2e7d32];
}
+ (UIColor *)ows_deepOrange900Color
{
return [UIColor colorWithRGBHex:0xbf360c];
}
+ (UIColor *)ows_grey600Color
{
return [UIColor colorWithRGBHex:0x757575];
}
@end
NS_ASSUME_NONNULL_END

@ -0,0 +1,71 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
import Foundation
import SignalServiceKit
// TODO: Possibly pull this into Conversation Style.
@objc
public class OWSMessagesBubbleColors: NSObject {
override private init() {
super.init()
}
@objc
public static let shared = OWSMessagesBubbleColors()
// TODO: Remove this! Incoming bubble colors are now dynamic.
@objc
public static let bubbleColorIncoming = UIColor.ows_messageBubbleLightGray
// TODO:
@objc
public static let bubbleColorOutgoingUnsent = UIColor.ows_red
// TODO:
@objc
public static let bubbleColorOutgoingSending = UIColor.ows_light35
@objc
public static let bubbleColorOutgoingSent = UIColor.ows_light10
@objc
public static func bubbleColor(message: TSMessage) -> UIColor {
if message is TSIncomingMessage {
return OWSMessagesBubbleColors.bubbleColorIncoming
} else if let outgoingMessage = message as? TSOutgoingMessage {
switch outgoingMessage.messageState {
case .failed:
return OWSMessagesBubbleColors.bubbleColorOutgoingUnsent
case .sending:
return OWSMessagesBubbleColors.bubbleColorOutgoingSending
default:
return OWSMessagesBubbleColors.bubbleColorOutgoingSent
}
} else {
owsFail("Unexpected message type: \(message)")
return UIColor.ows_materialBlue
}
}
@objc
public static func bubbleTextColor(message: TSMessage) -> UIColor {
if message is TSIncomingMessage {
return UIColor.ows_white
} else if let outgoingMessage = message as? TSOutgoingMessage {
switch outgoingMessage.messageState {
case .failed:
return UIColor.ows_black
case .sending:
return UIColor.ows_black
default:
return UIColor.ows_black
}
} else {
owsFail("Unexpected message type: \(message)")
return UIColor.ows_materialBlue
}
}
}

@ -1,50 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
import Foundation
import SignalServiceKit
@objc
public class OWSMessagesBubbleImageFactory: NSObject {
@objc
public static let shared = OWSMessagesBubbleImageFactory()
// TODO: UIView is a little bit expensive to instantiate.
// Can we cache this value?
private lazy var isRTL: Bool = {
return UIView().isRTL()
}()
@objc
public static let bubbleColorIncoming = UIColor.ows_messageBubbleLightGray
@objc
public static let bubbleColorOutgoingUnsent = UIColor.gray
@objc
public static let bubbleColorOutgoingSending = UIColor.ows_fadedBlue
@objc
public static let bubbleColorOutgoingSent = UIColor.ows_materialBlue
@objc
public func bubbleColor(message: TSMessage) -> UIColor {
if message is TSIncomingMessage {
return OWSMessagesBubbleImageFactory.bubbleColorIncoming
} else if let outgoingMessage = message as? TSOutgoingMessage {
switch outgoingMessage.messageState {
case .failed:
return OWSMessagesBubbleImageFactory.bubbleColorOutgoingUnsent
case .sending:
return OWSMessagesBubbleImageFactory.bubbleColorOutgoingSending
default:
return OWSMessagesBubbleImageFactory.bubbleColorOutgoingSent
}
} else {
owsFail("Unexpected message type: \(message)")
return UIColor.ows_materialBlue
}
}
}
Loading…
Cancel
Save