diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m index b136c856d..0bfe0440c 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m @@ -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 diff --git a/Signal/src/ViewControllers/ConversationView/ConversationStyle.swift b/Signal/src/ViewControllers/ConversationView/ConversationStyle.swift index f752dfb0e..9e22b30ee 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationStyle.swift +++ b/Signal/src/ViewControllers/ConversationView/ConversationStyle.swift @@ -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 diff --git a/SignalMessaging/utils/OWSMessagesBubbleImageFactory.swift b/SignalMessaging/utils/OWSMessagesBubbleImageFactory.swift index 1421581b4..89feaae58 100644 --- a/SignalMessaging/utils/OWSMessagesBubbleImageFactory.swift +++ b/SignalMessaging/utils/OWSMessagesBubbleImageFactory.swift @@ -5,6 +5,7 @@ import Foundation import SignalServiceKit +// TODO: Possibly pull this into Conversation Style. @objc public class OWSMessagesBubbleColors: NSObject { @@ -15,14 +16,17 @@ public class OWSMessagesBubbleColors: NSObject { @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.gray + public static let bubbleColorOutgoingUnsent = UIColor.ows_red + // TODO: @objc - public static let bubbleColorOutgoingSending = UIColor.ows_fadedBlue + public static let bubbleColorOutgoingSending = UIColor.ows_light35 @objc public static let bubbleColorOutgoingSent = UIColor.ows_light10 @@ -45,4 +49,23 @@ public class OWSMessagesBubbleColors: NSObject { 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 + } + } }