Rework conversation message bubble colors; add "conversation colors" class.

pull/1/head
Matthew Chen 7 years ago
parent 26a2d568de
commit b3ad6e27dc

@ -8,6 +8,7 @@
#import "UIColor+OWS.h" #import "UIColor+OWS.h"
#import "UIFont+OWS.h" #import "UIFont+OWS.h"
#import "UIView+OWS.h" #import "UIView+OWS.h"
#import <SignalMessaging/Theme.h>
#import <SignalServiceKit/OWSSignalService.h> #import <SignalServiceKit/OWSSignalService.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN

@ -82,8 +82,8 @@ class ColorPickerViewController: UIViewController, UIPickerViewDelegate, UIPicke
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
if let colorName = thread.conversationColorName, let colorName = thread.conversationColorName
let index = colorNames.index(of: colorName) { if let index = colorNames.index(of: colorName) {
pickerView.selectRow(index, inComponent: 0, animated: false) pickerView.selectRow(index, inComponent: 0, animated: false)
} }
} }
@ -110,12 +110,11 @@ class ColorPickerViewController: UIViewController, UIPickerViewDelegate, UIPicke
owsFailDebug("color was unexpectedly nil") owsFailDebug("color was unexpectedly nil")
return ColorView(color: .white) return ColorView(color: .white)
} }
guard let color = UIColor.ows_conversationColor(colorName: colorName, guard let colors = UIColor.ows_conversationColors(colorName: colorName) else {
mode: Theme.isDarkThemeEnabled ? .shade : .default) else {
owsFailDebug("unknown color name") owsFailDebug("unknown color name")
return ColorView(color: .white) return ColorView(color: UIColor.ows_defaultConversationColors().themeColor)
} }
return ColorView(color: color) return ColorView(color: colors.themeColor)
} }
// MARK: Actions // MARK: Actions

@ -122,7 +122,7 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3;
- (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 ? self.conversationStyle.bubbleColorOutgoingSent return (isQuotingSelf ? [self.conversationStyle bubbleColorWithIsIncoming:NO]
: [self.conversationStyle quotingSelfHighlightColor]); : [self.conversationStyle quotingSelfHighlightColor]);
} }

@ -6,6 +6,7 @@
#import "UIColor+OWS.h" #import "UIColor+OWS.h"
#import "UIFont+OWS.h" #import "UIFont+OWS.h"
#import "UIView+OWS.h" #import "UIView+OWS.h"
#import <SignalMessaging/Theme.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN

@ -1342,75 +1342,25 @@ NS_ASSUME_NONNULL_BEGIN
hasCaption:YES], hasCaption:YES],
[self fakeOutgoingPngAction:thread [self fakeOutgoingPngAction:thread
actionLabel:@"Fake Outgoing 'Outgoing Unsent' Png" actionLabel:@"Fake Outgoing 'Outgoing' Png"
imageSize:CGSizeMake(200.f, 200.f) imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[conversationStyle bubbleColorOutgoingFailed] backgroundColor:[conversationStyle bubbleColorWithIsIncoming:NO]
textColor:[UIColor whiteColor] textColor:[UIColor whiteColor]
imageLabel:@"W" imageLabel:@"W"
messageState:TSOutgoingMessageStateFailed messageState:TSOutgoingMessageStateFailed
hasCaption:YES], hasCaption:YES],
[self fakeOutgoingPngAction:thread [self fakeOutgoingPngAction:thread
actionLabel:@"Fake Outgoing 'Outgoing Unsent' Png" actionLabel:@"Fake Outgoing 'Outgoing' Png"
imageSize:CGSizeMake(200.f, 200.f) imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[conversationStyle bubbleColorOutgoingFailed] backgroundColor:[conversationStyle bubbleColorWithIsIncoming:NO]
textColor:[UIColor whiteColor] textColor:[UIColor whiteColor]
imageLabel:@"W" imageLabel:@"W"
messageState:TSOutgoingMessageStateSending messageState:TSOutgoingMessageStateSending
hasCaption:YES], hasCaption:YES],
[self fakeOutgoingPngAction:thread [self fakeOutgoingPngAction:thread
actionLabel:@"Fake Outgoing 'Outgoing Unsent' Png" actionLabel:@"Fake Outgoing 'Outgoing' Png"
imageSize:CGSizeMake(200.f, 200.f) imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[conversationStyle bubbleColorOutgoingFailed] backgroundColor:[conversationStyle bubbleColorWithIsIncoming:NO]
textColor:[UIColor whiteColor]
imageLabel:@"W"
messageState:TSOutgoingMessageStateSent
hasCaption:YES],
[self fakeOutgoingPngAction:thread
actionLabel:@"Fake Outgoing 'Outgoing Sending' Png"
imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[conversationStyle bubbleColorOutgoingSending]
textColor:[UIColor whiteColor]
imageLabel:@"W"
messageState:TSOutgoingMessageStateFailed
hasCaption:YES],
[self fakeOutgoingPngAction:thread
actionLabel:@"Fake Outgoing 'Outgoing Sending' Png"
imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[conversationStyle bubbleColorOutgoingSending]
textColor:[UIColor whiteColor]
imageLabel:@"W"
messageState:TSOutgoingMessageStateSending
hasCaption:YES],
[self fakeOutgoingPngAction:thread
actionLabel:@"Fake Outgoing 'Outgoing Sending' Png"
imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[conversationStyle bubbleColorOutgoingSending]
textColor:[UIColor whiteColor]
imageLabel:@"W"
messageState:TSOutgoingMessageStateSent
hasCaption:YES],
[self fakeOutgoingPngAction:thread
actionLabel:@"Fake Outgoing 'Outgoing Sent' Png"
imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[conversationStyle bubbleColorOutgoingSent]
textColor:[UIColor whiteColor]
imageLabel:@"W"
messageState:TSOutgoingMessageStateFailed
hasCaption:YES],
[self fakeOutgoingPngAction:thread
actionLabel:@"Fake Outgoing 'Outgoing Sent' Png"
imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[conversationStyle bubbleColorOutgoingSent]
textColor:[UIColor whiteColor]
imageLabel:@"W"
messageState:TSOutgoingMessageStateSending
hasCaption:YES],
[self fakeOutgoingPngAction:thread
actionLabel:@"Fake Outgoing 'Outgoing Sent' Png"
imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[conversationStyle bubbleColorOutgoingSent]
textColor:[UIColor whiteColor] textColor:[UIColor whiteColor]
imageLabel:@"W" imageLabel:@"W"
messageState:TSOutgoingMessageStateSent messageState:TSOutgoingMessageStateSent
@ -1578,7 +1528,15 @@ 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:[conversationStyle primaryColor] backgroundColor:[conversationStyle conversationColors].defaultColor
textColor:[UIColor whiteColor]
imageLabel:@"W"
isAttachmentDownloaded:YES
hasCaption:YES],
[self fakeIncomingPngAction:thread
actionLabel:@"Fake Incoming 'Incoming' Png"
imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[conversationStyle conversationColors].shadeColor
textColor:[UIColor whiteColor] textColor:[UIColor whiteColor]
imageLabel:@"W" imageLabel:@"W"
isAttachmentDownloaded:YES isAttachmentDownloaded:YES
@ -1586,7 +1544,15 @@ 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:[conversationStyle primaryColor] backgroundColor:[conversationStyle conversationColors].defaultColor
textColor:[UIColor whiteColor]
imageLabel:@"W"
isAttachmentDownloaded:NO
hasCaption:YES],
[self fakeIncomingPngAction:thread
actionLabel:@"Fake Incoming 'Incoming' Png"
imageSize:CGSizeMake(200.f, 200.f)
backgroundColor:[conversationStyle conversationColors].shadeColor
textColor:[UIColor whiteColor] textColor:[UIColor whiteColor]
imageLabel:@"W" imageLabel:@"W"
isAttachmentDownloaded:NO isAttachmentDownloaded:NO

@ -288,11 +288,8 @@ const CGFloat kIconViewLength = 24;
[mainSection addItem:[OWSTableItem [mainSection addItem:[OWSTableItem
itemWithCustomCellBlock:^{ itemWithCustomCellBlock:^{
NSString *colorName = self.thread.conversationColorName; NSString *colorName = self.thread.conversationColorName;
UIColor *currentColor = [UIColor UIColor *currentColor =
ows_conversationColorForColorName:colorName [UIColor ows_conversationColorsForColorName:colorName].themeColor;
mode:(Theme.isDarkThemeEnabled
? ConversationColorMode_Shade
: ConversationColorMode_Default)];
NSString *title = NSLocalizedString(@"CONVERSATION_SETTINGS_CONVERSATION_COLOR", NSString *title = NSLocalizedString(@"CONVERSATION_SETTINGS_CONVERSATION_COLOR",
@"Label for table cell which leads to picking a new conversation color"); @"Label for table cell which leads to picking a new conversation color");
return [weakSelf disclosureCellWithName:title iconColor:currentColor]; return [weakSelf disclosureCellWithName:title iconColor:currentColor];

@ -5,6 +5,7 @@
#import "CountryCodeViewController.h" #import "CountryCodeViewController.h"
#import "OWSSearchBar.h" #import "OWSSearchBar.h"
#import "PhoneNumberUtil.h" #import "PhoneNumberUtil.h"
#import "Theme.h"
#import "UIColor+OWS.h" #import "UIColor+OWS.h"
#import "UIFont+OWS.h" #import "UIFont+OWS.h"
#import "UIView+OWS.h" #import "UIView+OWS.h"

@ -4,6 +4,7 @@
#import "OWSTableViewController.h" #import "OWSTableViewController.h"
#import "OWSNavigationController.h" #import "OWSNavigationController.h"
#import "Theme.h"
#import "UIColor+OWS.h" #import "UIColor+OWS.h"
#import "UIFont+OWS.h" #import "UIFont+OWS.h"
#import "UIView+OWS.h" #import "UIView+OWS.h"

@ -2,6 +2,7 @@
// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// //
#import "UIColor+OWS.h"
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@ -56,4 +57,12 @@ extern NSString *const ThemeDidChangeNotification;
@end @end
#pragma mark -
@interface OWSConversationColors (Theme)
@property (nonatomic, readonly) UIColor *themeColor;
@end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

@ -162,4 +162,15 @@ NSString *const ThemeKeyThemeEnabled = @"ThemeKeyThemeEnabled";
@end @end
#pragma mark -
@implementation OWSConversationColors (Theme)
- (UIColor *)themeColor
{
return Theme.isDarkThemeEnabled ? self.shadeColor : self.defaultColor;
}
@end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

@ -2,16 +2,23 @@
// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// //
#import "Theme.h"
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, ConversationColorMode) { @interface OWSConversationColors : NSObject
ConversationColorMode_Default,
ConversationColorMode_Shade, @property (nonatomic, readonly) UIColor *defaultColor;
ConversationColorMode_Tint, @property (nonatomic, readonly) UIColor *shadeColor;
}; @property (nonatomic, readonly) UIColor *tintColor;
+ (OWSConversationColors *)conversationColorsWithDefaultColor:(UIColor *)defaultColor
shadeColor:(UIColor *)shadeColor
tintColor:(UIColor *)tintColor;
@end
#pragma mark -
@interface UIColor (OWS) @interface UIColor (OWS)
@ -102,15 +109,18 @@ typedef NS_ENUM(NSUInteger, ConversationColorMode) {
#pragma mark - Conversation Colors #pragma mark - Conversation Colors
+ (nullable UIColor *)ows_conversationColorForColorName:(NSString *)colorName + (nullable OWSConversationColors *)ows_conversationColorsForColorName:(NSString *)colorName
mode:(ConversationColorMode)mode NS_SWIFT_NAME(ows_conversationColors(colorName:));
NS_SWIFT_NAME(ows_conversationColor(colorName:mode:));
@property (class, readonly, nonatomic) NSArray<NSString *> *ows_conversationColorNames; // If the conversation color name is valid, return its colors.
// Otherwise return the "default" conversation colors.
+ (OWSConversationColors *)ows_conversationColorsOrDefaultForColorName:(NSString *)conversationColorName
NS_SWIFT_NAME(ows_conversationColorsOrDefault(colorName:));
+ (nullable UIColor *)ows_conversationTintColorForColorName:(NSString *)colorName; @property (class, readonly, nonatomic) NSArray<NSString *> *ows_conversationColorNames;
+ (NSString *)ows_defaultConversationColorName; + (NSString *)ows_defaultConversationColorName;
+ (OWSConversationColors *)ows_defaultConversationColors;
// TODO: Remove // TODO: Remove
@property (class, readonly, nonatomic) UIColor *ows_darkSkyBlueColor; @property (class, readonly, nonatomic) UIColor *ows_darkSkyBlueColor;

@ -2,12 +2,41 @@
// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// //
#import "UIColor+OWS.h"
#import "OWSMath.h" #import "OWSMath.h"
#import "Theme.h"
#import "UIColor+OWS.h"
#import <SignalServiceKit/Cryptography.h> #import <SignalServiceKit/Cryptography.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface OWSConversationColors ()
@property (nonatomic) UIColor *defaultColor;
@property (nonatomic) UIColor *shadeColor;
@property (nonatomic) UIColor *tintColor;
@end
#pragma mark -
@implementation OWSConversationColors
+ (OWSConversationColors *)conversationColorsWithDefaultColor:(UIColor *)defaultColor
shadeColor:(UIColor *)shadeColor
tintColor:(UIColor *)tintColor
{
OWSConversationColors *instance = [OWSConversationColors new];
instance.defaultColor = defaultColor;
instance.shadeColor = shadeColor;
instance.tintColor = tintColor;
return instance;
}
@end
#pragma mark -
@implementation UIColor (OWS) @implementation UIColor (OWS)
#pragma mark - #pragma mark -
@ -459,30 +488,42 @@ NS_ASSUME_NONNULL_BEGIN
return self.ows_conversationColorMap.allKeys; return self.ows_conversationColorMap.allKeys;
} }
+ (nullable UIColor *)ows_conversationColorForColorName:(NSString *)colorName mode:(ConversationColorMode)mode + (nullable OWSConversationColors *)ows_conversationColorsForColorName:(NSString *)conversationColorName
{ {
OWSAssertDebug(colorName.length > 0); UIColor *_Nullable defaultColor = self.ows_conversationColorMap[conversationColorName];
UIColor *_Nullable shadeColor = self.ows_conversationColorMapShade[conversationColorName];
switch (mode) { UIColor *_Nullable tintColor = self.ows_conversationColorMapTint[conversationColorName];
case ConversationColorMode_Default: if (!defaultColor || !shadeColor || !tintColor) {
return self.ows_conversationColorMap[colorName]; return nil;
case ConversationColorMode_Shade:
return self.ows_conversationColorMapShade[colorName];
case ConversationColorMode_Tint:
return self.ows_conversationColorMapTint[colorName];
} }
OWSAssertDebug(defaultColor);
OWSAssertDebug(shadeColor);
OWSAssertDebug(tintColor);
return [OWSConversationColors conversationColorsWithDefaultColor:defaultColor
shadeColor:shadeColor
tintColor:tintColor];
} }
+ (nullable UIColor *)ows_conversationTintColorForColorName:(NSString *)colorName + (OWSConversationColors *)ows_conversationColorsOrDefaultForColorName:(NSString *)conversationColorName
{ {
OWSAssertDebug(colorName.length > 0); OWSConversationColors *_Nullable conversationColors =
[self ows_conversationColorsForColorName:conversationColorName];
return self.ows_conversationColorMapTint[colorName]; if (conversationColors) {
return conversationColors;
}
return [self ows_defaultConversationColors];
} }
+ (NSString *)ows_defaultConversationColorName + (NSString *)ows_defaultConversationColorName
{ {
return @"teal"; NSString *conversationColorName = @"teal";
OWSAssert([self.ows_conversationColorNames containsObject:conversationColorName]);
return conversationColorName;
}
+ (OWSConversationColors *)ows_defaultConversationColors
{
return [self ows_conversationColorsForColorName:self.ows_defaultConversationColorName];
} }
// TODO: Remove // TODO: Remove

@ -2,9 +2,10 @@
// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// //
#import "UIViewController+OWS.h" #import "Theme.h"
#import "UIColor+OWS.h" #import "UIColor+OWS.h"
#import "UIView+OWS.h" #import "UIView+OWS.h"
#import "UIViewController+OWS.h"
#import <SignalServiceKit/AppContext.h> #import <SignalServiceKit/AppContext.h>
#import <SignalServiceKit/iOSVersions.h> #import <SignalServiceKit/iOSVersions.h>

@ -64,7 +64,7 @@ public class ConversationStyle: NSObject {
public required init(thread: TSThread) { public required init(thread: TSThread) {
self.thread = thread self.thread = thread
self.primaryColor = ConversationStyle.primaryColor(thread: thread) self.conversationColors = ConversationStyle.conversationColors(thread: thread)
super.init() super.init()
@ -126,22 +126,18 @@ public class ConversationStyle: NSObject {
lastTextLineAxis = CGFloat(round(baseFontOffset + messageTextFont.capHeight * 0.5)) lastTextLineAxis = CGFloat(round(baseFontOffset + messageTextFont.capHeight * 0.5))
self.primaryColor = ConversationStyle.primaryColor(thread: thread) self.conversationColors = ConversationStyle.conversationColors(thread: thread)
} }
// MARK: Colors // MARK: Colors
private class func primaryColor(thread: TSThread) -> UIColor { @objc
guard let colorName = thread.conversationColorName else { public var conversationColors: OWSConversationColors
return self.defaultBubbleColorIncoming
}
guard let color = UIColor.ows_conversationColor(colorName: colorName, private class func conversationColors(thread: TSThread) -> OWSConversationColors {
mode: Theme.isDarkThemeEnabled ? .shade : .default) else { let colorName = thread.conversationColorName
return self.defaultBubbleColorIncoming
}
return color return UIColor.ows_conversationColorsOrDefault(colorName: colorName)
} }
@objc @objc
@ -149,37 +145,15 @@ public class ConversationStyle: NSObject {
return Theme.isDarkThemeEnabled ? UIColor.ows_gray75 : UIColor.ows_messageBubbleLightGray return Theme.isDarkThemeEnabled ? UIColor.ows_gray75 : UIColor.ows_messageBubbleLightGray
} }
@objc
public let bubbleColorOutgoingFailed = UIColor.ows_darkSkyBlue
@objc
public let bubbleColorOutgoingSending = UIColor.ows_darkSkyBlue
@objc
public let bubbleColorOutgoingSent = UIColor.ows_darkSkyBlue
@objc @objc
public let dateBreakTextColor = UIColor.ows_gray60 public let dateBreakTextColor = UIColor.ows_gray60
@objc
public var primaryColor: UIColor
@objc @objc
public func bubbleColor(message: TSMessage) -> UIColor { public func bubbleColor(message: TSMessage) -> UIColor {
if message is TSIncomingMessage { if message is TSIncomingMessage {
return ConversationStyle.defaultBubbleColorIncoming return bubbleColor(isIncoming: true)
} else if let outgoingMessage = message as? TSOutgoingMessage {
switch outgoingMessage.messageState {
case .failed:
return bubbleColorOutgoingFailed
case .sending:
return bubbleColorOutgoingSending
default:
return bubbleColorOutgoingSent
}
} else { } else {
owsFailDebug("Unexpected message type: \(message)") return bubbleColor(isIncoming: false)
return bubbleColorOutgoingSent
} }
} }
@ -188,7 +162,7 @@ public class ConversationStyle: NSObject {
if isIncoming { if isIncoming {
return ConversationStyle.defaultBubbleColorIncoming return ConversationStyle.defaultBubbleColorIncoming
} else { } else {
return self.bubbleColorOutgoingSent return conversationColors.themeColor
} }
} }
@ -229,10 +203,9 @@ public class ConversationStyle: NSObject {
@objc @objc
public func quotedReplyBubbleColor(isIncoming: Bool) -> UIColor { public func quotedReplyBubbleColor(isIncoming: Bool) -> UIColor {
if Theme.isDarkThemeEnabled { if Theme.isDarkThemeEnabled {
let alpha: CGFloat = (isIncoming ? 0.6 :0.5) return conversationColors.shadeColor
return UIColor.white.blend(with: bubbleColorOutgoingSent, alpha: alpha)
} else if isIncoming { } else if isIncoming {
return bubbleColorOutgoingSent.withAlphaComponent(0.25) return conversationColors.tintColor
} else { } else {
return ConversationStyle.defaultBubbleColorIncoming.withAlphaComponent(0.75) return ConversationStyle.defaultBubbleColorIncoming.withAlphaComponent(0.75)
} }
@ -241,9 +214,9 @@ public class ConversationStyle: NSObject {
@objc @objc
public func quotedReplyStripeColor(isIncoming: Bool) -> UIColor { public func quotedReplyStripeColor(isIncoming: Bool) -> UIColor {
if isIncoming { if isIncoming {
return bubbleColorOutgoingSent return conversationColors.themeColor
} else { } else {
return UIColor.white return Theme.backgroundColor
} }
} }

@ -7,6 +7,7 @@
#import "OWSGroupAvatarBuilder.h" #import "OWSGroupAvatarBuilder.h"
#import "TSContactThread.h" #import "TSContactThread.h"
#import "TSGroupThread.h" #import "TSGroupThread.h"
#import "Theme.h"
#import "UIColor+OWS.h" #import "UIColor+OWS.h"
#import "UIFont+OWS.h" #import "UIFont+OWS.h"
#import "UIView+OWS.h" #import "UIView+OWS.h"

@ -124,10 +124,7 @@ NS_ASSUME_NONNULL_BEGIN
[initials appendString:@"#"]; [initials appendString:@"#"];
} }
UIColor *color = UIColor *color = [UIColor ows_conversationColorsOrDefaultForColorName:self.colorName].themeColor;
[UIColor ows_conversationColorForColorName:self.colorName
mode:(Theme.isDarkThemeEnabled ? ConversationColorMode_Shade
: ConversationColorMode_Default)];
OWSAssertDebug(color); OWSAssertDebug(color);
UIImage *_Nullable image = UIImage *_Nullable image =

@ -3,6 +3,7 @@
// //
#import "UIUtil.h" #import "UIUtil.h"
#import "Theme.h"
#import "UIColor+OWS.h" #import "UIColor+OWS.h"
#import <SignalServiceKit/AppContext.h> #import <SignalServiceKit/AppContext.h>

@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
*/ */
- (NSString *)name; - (NSString *)name;
@property (readonly, nullable) NSString *conversationColorName; @property (nonatomic, readonly) NSString *conversationColorName;
- (void)updateConversationColorName:(NSString *)colorName transaction:(YapDatabaseReadWriteTransaction *)transaction; - (void)updateConversationColorName:(NSString *)colorName transaction:(YapDatabaseReadWriteTransaction *)transaction;
+ (NSString *)stableConversationColorNameForString:(NSString *)colorSeed; + (NSString *)stableConversationColorNameForString:(NSString *)colorSeed;

@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic) NSDate *creationDate; @property (nonatomic) NSDate *creationDate;
@property (nonatomic, copy, nullable) NSDate *archivalDate; @property (nonatomic, copy, nullable) NSDate *archivalDate;
@property (nonatomic, nullable) NSString *conversationColorName; @property (nonatomic) NSString *conversationColorName;
@property (nonatomic, nullable) NSDate *lastMessageDate; @property (nonatomic, nullable) NSDate *lastMessageDate;
@property (nonatomic, copy, nullable) NSString *messageDraft; @property (nonatomic, copy, nullable) NSString *messageDraft;
@property (atomic, nullable) NSDate *mutedUntilDate; @property (atomic, nullable) NSDate *mutedUntilDate;

Loading…
Cancel
Save