From 6715e3d1ad0c5ce9d784beb9972a43e5362c5ce8 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Thu, 27 Sep 2018 09:28:16 -0400 Subject: [PATCH] Respond to CR. --- .../ViewControllers/DebugUI/DebugUIMessages.m | 4 ++-- .../OWSConversationSettingsViewController.m | 2 +- SignalMessaging/categories/UIColor+OWS.h | 4 ++-- SignalMessaging/categories/UIColor+OWS.m | 16 ++++++++-------- SignalMessaging/utils/ConversationStyle.swift | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m index bd045002e..8c0d83dec 100644 --- a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m +++ b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m @@ -1528,7 +1528,7 @@ NS_ASSUME_NONNULL_BEGIN [self fakeIncomingPngAction:thread actionLabel:@"Fake Incoming 'Incoming' Png" imageSize:CGSizeMake(200.f, 200.f) - backgroundColor:[conversationStyle conversationColor].defaultColor + backgroundColor:[conversationStyle conversationColor].primaryColor textColor:[UIColor whiteColor] imageLabel:@"W" isAttachmentDownloaded:YES @@ -1544,7 +1544,7 @@ NS_ASSUME_NONNULL_BEGIN [self fakeIncomingPngAction:thread actionLabel:@"Fake Incoming 'Incoming' Png" imageSize:CGSizeMake(200.f, 200.f) - backgroundColor:[conversationStyle conversationColor].defaultColor + backgroundColor:[conversationStyle conversationColor].primaryColor textColor:[UIColor whiteColor] imageLabel:@"W" isAttachmentDownloaded:NO diff --git a/Signal/src/ViewControllers/ThreadSettings/OWSConversationSettingsViewController.m b/Signal/src/ViewControllers/ThreadSettings/OWSConversationSettingsViewController.m index ff43e3e18..9377b8960 100644 --- a/Signal/src/ViewControllers/ThreadSettings/OWSConversationSettingsViewController.m +++ b/Signal/src/ViewControllers/ThreadSettings/OWSConversationSettingsViewController.m @@ -289,7 +289,7 @@ const CGFloat kIconViewLength = 24; itemWithCustomCellBlock:^{ NSString *colorName = self.thread.conversationColorName; UIColor *currentColor = - [UIColor ows_conversationColorForColorName:colorName].themeColor; + [UIColor ows_conversationColorOrDefaultForColorName:colorName].themeColor; NSString *title = NSLocalizedString(@"CONVERSATION_SETTINGS_CONVERSATION_COLOR", @"Label for table cell which leads to picking a new conversation color"); return [weakSelf disclosureCellWithName:title iconColor:currentColor]; diff --git a/SignalMessaging/categories/UIColor+OWS.h b/SignalMessaging/categories/UIColor+OWS.h index 2ab582027..b058d8f6c 100644 --- a/SignalMessaging/categories/UIColor+OWS.h +++ b/SignalMessaging/categories/UIColor+OWS.h @@ -8,13 +8,13 @@ NS_ASSUME_NONNULL_BEGIN @interface OWSConversationColor : NSObject -@property (nonatomic, readonly) UIColor *defaultColor; +@property (nonatomic, readonly) UIColor *primaryColor; @property (nonatomic, readonly) UIColor *shadeColor; @property (nonatomic, readonly) UIColor *tintColor; @property (nonatomic, readonly) UIColor *themeColor; -+ (OWSConversationColor *)conversationColorWithDefaultColor:(UIColor *)defaultColor ++ (OWSConversationColor *)conversationColorWithPrimaryColor:(UIColor *)primaryColor shadeColor:(UIColor *)shadeColor tintColor:(UIColor *)tintColor; diff --git a/SignalMessaging/categories/UIColor+OWS.m b/SignalMessaging/categories/UIColor+OWS.m index 0300f919d..a0547025e 100644 --- a/SignalMessaging/categories/UIColor+OWS.m +++ b/SignalMessaging/categories/UIColor+OWS.m @@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN @interface OWSConversationColor () -@property (nonatomic) UIColor *defaultColor; +@property (nonatomic) UIColor *primaryColor; @property (nonatomic) UIColor *shadeColor; @property (nonatomic) UIColor *tintColor; @@ -22,12 +22,12 @@ NS_ASSUME_NONNULL_BEGIN @implementation OWSConversationColor -+ (OWSConversationColor *)conversationColorWithDefaultColor:(UIColor *)defaultColor ++ (OWSConversationColor *)conversationColorWithPrimaryColor:(UIColor *)primaryColor shadeColor:(UIColor *)shadeColor tintColor:(UIColor *)tintColor { OWSConversationColor *instance = [OWSConversationColor new]; - instance.defaultColor = defaultColor; + instance.primaryColor = primaryColor; instance.shadeColor = shadeColor; instance.tintColor = tintColor; return instance; @@ -35,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN - (UIColor *)themeColor { - return Theme.isDarkThemeEnabled ? self.shadeColor : self.defaultColor; + return Theme.isDarkThemeEnabled ? self.shadeColor : self.primaryColor; } @end @@ -495,17 +495,17 @@ NS_ASSUME_NONNULL_BEGIN + (nullable OWSConversationColor *)ows_conversationColorForColorName:(NSString *)conversationColorName { - UIColor *_Nullable defaultColor = self.ows_conversationColorMap[conversationColorName]; + UIColor *_Nullable primaryColor = self.ows_conversationColorMap[conversationColorName]; UIColor *_Nullable shadeColor = self.ows_conversationColorMapShade[conversationColorName]; UIColor *_Nullable tintColor = self.ows_conversationColorMapTint[conversationColorName]; - if (!defaultColor || !shadeColor || !tintColor) { + if (!primaryColor || !shadeColor || !tintColor) { return nil; } - OWSAssertDebug(defaultColor); + OWSAssertDebug(primaryColor); OWSAssertDebug(shadeColor); OWSAssertDebug(tintColor); return - [OWSConversationColor conversationColorWithDefaultColor:defaultColor shadeColor:shadeColor tintColor:tintColor]; + [OWSConversationColor conversationColorWithPrimaryColor:primaryColor shadeColor:shadeColor tintColor:tintColor]; } + (OWSConversationColor *)ows_conversationColorOrDefaultForColorName:(NSString *)conversationColorName diff --git a/SignalMessaging/utils/ConversationStyle.swift b/SignalMessaging/utils/ConversationStyle.swift index ab780b01b..de31b033f 100644 --- a/SignalMessaging/utils/ConversationStyle.swift +++ b/SignalMessaging/utils/ConversationStyle.swift @@ -162,7 +162,7 @@ public class ConversationStyle: NSObject { if isIncoming { return ConversationStyle.defaultBubbleColorIncoming } else { - return conversationColor.defaultColor + return conversationColor.primaryColor } } @@ -212,7 +212,7 @@ public class ConversationStyle: NSObject { @objc public func quotedReplyStripeColor(isIncoming: Bool) -> UIColor { if isIncoming { - return conversationColor.defaultColor + return conversationColor.primaryColor } else { return Theme.backgroundColor }