diff --git a/Signal/src/OWSMessagesBubbleImageFactory.swift b/Signal/src/OWSMessagesBubbleImageFactory.swift index 80c9481f9..b49764f81 100644 --- a/Signal/src/OWSMessagesBubbleImageFactory.swift +++ b/Signal/src/OWSMessagesBubbleImageFactory.swift @@ -26,12 +26,12 @@ class OWSMessagesBubbleImageFactory: NSObject { }() public lazy var outgoing: JSQMessagesBubbleImage = { - let color = UIColor.ows_materialBlue() + let color = UIColor.ows_materialBlue return self.outgoing(color: color) }() public lazy var currentlyOutgoing: JSQMessagesBubbleImage = { - let color = UIColor.ows_fadedBlue() + let color = UIColor.ows_fadedBlue return self.outgoing(color: color) }() diff --git a/Signal/src/ViewControllers/CallViewController.swift b/Signal/src/ViewControllers/CallViewController.swift index f170ebb39..0971fdd98 100644 --- a/Signal/src/ViewControllers/CallViewController.swift +++ b/Signal/src/ViewControllers/CallViewController.swift @@ -307,7 +307,7 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver { comment: "Label for button that shows the privacy settings."), font:OWSFlatButton.fontForHeight(buttonHeight), titleColor:UIColor.white, - backgroundColor:UIColor.ows_signalBrandBlue(), + backgroundColor:UIColor.ows_signalBrandBlue, target:self, selector:#selector(didPressShowCallSettings)) viewStack.addSubview(callSettingsButton) @@ -319,7 +319,7 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver { comment: "Label for button that dismiss the call view's settings nag."), font:OWSFlatButton.fontForHeight(buttonHeight), titleColor:UIColor.white, - backgroundColor:UIColor.ows_signalBrandBlue(), + backgroundColor:UIColor.ows_signalBrandBlue, target:self, selector:#selector(didPressDismissNag)) viewStack.addSubview(notNowButton) diff --git a/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift b/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift index db17209fc..b4b42e5d8 100644 --- a/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift +++ b/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift @@ -94,7 +94,7 @@ private class IntroductingReadReceiptsExperienceUpgradeViewController: Experienc let button = MultiLineButton() view.addSubview(button) button.setTitle(title, for: .normal) - button.setTitleColor(UIColor.ows_signalBrandBlue(), for: .normal) + button.setTitleColor(UIColor.ows_signalBrandBlue, for: .normal) button.isUserInteractionEnabled = true button.addTarget(self, action:#selector(didTapButton), for: .touchUpInside) button.contentEdgeInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10) @@ -198,7 +198,7 @@ private class IntroductingProfilesExperienceUpgradeViewController: ExperienceUpg let buttonTitle = NSLocalizedString("UPGRADE_EXPERIENCE_INTRODUCING_PROFILES_BUTTON", comment: "button label shown one time, after user upgrades app") button.setTitle(buttonTitle, for: .normal) button.setTitleColor(UIColor.white, for: .normal) - button.backgroundColor = UIColor.ows_materialBlue() + button.backgroundColor = UIColor.ows_materialBlue button.isUserInteractionEnabled = true button.addTarget(self, action:#selector(didTapButton), for: .touchUpInside) @@ -259,7 +259,7 @@ private class CallKitExperienceUpgradeViewController: ExperienceUpgradeViewContr view.addSubview(privacySettingsButton) let privacyTitle = NSLocalizedString("UPGRADE_EXPERIENCE_CALLKIT_PRIVACY_SETTINGS_BUTTON", comment: "button label shown once when when user upgrades app, in context of call kit") privacySettingsButton.setTitle(privacyTitle, for: .normal) - privacySettingsButton.setTitleColor(UIColor.ows_signalBrandBlue(), for: .normal) + privacySettingsButton.setTitleColor(UIColor.ows_signalBrandBlue, for: .normal) privacySettingsButton.isUserInteractionEnabled = true privacySettingsButton.addTarget(self, action:#selector(didTapPrivacySettingsButton), for: .touchUpInside) privacySettingsButton.titleLabel?.font = bodyLabel.font @@ -368,7 +368,7 @@ func setPageControlAppearance() { if #available(iOS 9.0, *) { let pageControl = UIPageControl.appearance(whenContainedInInstancesOf: [UIPageViewController.self]) pageControl.pageIndicatorTintColor = UIColor.lightGray - pageControl.currentPageIndicatorTintColor = UIColor.ows_materialBlue() + pageControl.currentPageIndicatorTintColor = UIColor.ows_materialBlue } else { // iOS8 won't see the page controls =( } @@ -429,13 +429,13 @@ class ExperienceUpgradesPageViewController: OWSViewController, UIPageViewControl // Header Background let headerBackgroundView = UIView() view.addSubview(headerBackgroundView) - headerBackgroundView.backgroundColor = UIColor.ows_materialBlue() + headerBackgroundView.backgroundColor = UIColor.ows_materialBlue // Dismiss button let dismissButton = UIButton() view.addSubview(dismissButton) dismissButton.setTitle(CommonStrings.dismissButton, for: .normal) - dismissButton.setTitleColor(UIColor.ows_signalBrandBlue(), for: .normal) + dismissButton.setTitleColor(UIColor.ows_signalBrandBlue, for: .normal) dismissButton.isUserInteractionEnabled = true dismissButton.addTarget(self, action:#selector(didTapDismissButton), for: .touchUpInside) dismissButton.titleLabel?.font = UIFont.ows_mediumFont(withSize: ScaleFromIPhone5(16)) diff --git a/Signal/src/ViewControllers/MessageDetailViewController.swift b/Signal/src/ViewControllers/MessageDetailViewController.swift index c62f0baf8..7d03bfb44 100644 --- a/Signal/src/ViewControllers/MessageDetailViewController.swift +++ b/Signal/src/ViewControllers/MessageDetailViewController.swift @@ -150,7 +150,7 @@ class MessageDetailViewController: OWSViewController, UIScrollViewDelegate { if hasMediaAttachment { let footer = UIToolbar() - footer.barTintColor = UIColor.ows_materialBlue() + footer.barTintColor = UIColor.ows_materialBlue view.addSubview(footer) footer.autoPinWidthToSuperview(withMargin: 0) footer.autoPinEdge(.top, to: .bottom, of: scrollView) @@ -239,7 +239,7 @@ class MessageDetailViewController: OWSViewController, UIScrollViewDelegate { cell.configure(withRecipientId: recipientId, contactsManager: self.contactsManager) let statusLabel = UILabel() statusLabel.text = statusMessage - statusLabel.textColor = UIColor.ows_darkGray() + statusLabel.textColor = UIColor.ows_darkGray statusLabel.font = UIFont.ows_footnote() statusLabel.sizeToFit() cell.accessoryView = statusLabel @@ -530,7 +530,7 @@ class MessageDetailViewController: OWSViewController, UIScrollViewDelegate { if subtitle.count > 0 { let subtitleLabel = self.valueLabel(text: subtitle) - subtitleLabel.textColor = UIColor.ows_darkGray() + subtitleLabel.textColor = UIColor.ows_darkGray row.addSubview(subtitleLabel) subtitleLabel.autoPinTrailingToSuperview() subtitleLabel.autoPinLeading(toTrailingOf: nameLabel, margin: 10) diff --git a/Signal/src/ViewControllers/ModalActivityIndicatorViewController.swift b/Signal/src/ViewControllers/ModalActivityIndicatorViewController.swift index 5f095ca45..e6ca10146 100644 --- a/Signal/src/ViewControllers/ModalActivityIndicatorViewController.swift +++ b/Signal/src/ViewControllers/ModalActivityIndicatorViewController.swift @@ -79,7 +79,7 @@ class ModalActivityIndicatorViewController: OWSViewController { let cancelButton = UIButton(type:.custom) cancelButton.setTitle(CommonStrings.cancelButton, for: .normal) cancelButton.setTitleColor(UIColor.white, for: .normal) - cancelButton.backgroundColor = UIColor.ows_darkGray() + cancelButton.backgroundColor = UIColor.ows_darkGray cancelButton.titleLabel?.font = UIFont.ows_mediumFont(withSize:ScaleFromIPhone5To7Plus(18, 22)) cancelButton.layer.cornerRadius = ScaleFromIPhone5To7Plus(4, 5) cancelButton.clipsToBounds = true diff --git a/Signal/src/views/GroupTableViewCell.swift b/Signal/src/views/GroupTableViewCell.swift index 2172e8b45..b860dfaad 100644 --- a/Signal/src/views/GroupTableViewCell.swift +++ b/Signal/src/views/GroupTableViewCell.swift @@ -26,7 +26,7 @@ import SignalServiceKit // Font config nameLabel.font = UIFont.ows_dynamicTypeBody() subtitleLabel.font = UIFont.ows_footnote() - subtitleLabel.textColor = UIColor.ows_darkGray() + subtitleLabel.textColor = UIColor.ows_darkGray // Listen to notifications... // TODO avatar, group name change, group membership change, group member name change diff --git a/Signal/src/views/ReminderView.swift b/Signal/src/views/ReminderView.swift index bc4838740..098cd498e 100644 --- a/Signal/src/views/ReminderView.swift +++ b/Signal/src/views/ReminderView.swift @@ -48,7 +48,7 @@ class ReminderView: UIView { } func setupSubviews() { - self.backgroundColor = UIColor.ows_reminderYellow() + self.backgroundColor = UIColor.ows_reminderYellow self.clipsToBounds = true let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap(gestureRecognizer:))) diff --git a/SignalMessaging/attachments/AttachmentApprovalViewController.swift b/SignalMessaging/attachments/AttachmentApprovalViewController.swift index 6df18cf4c..0d2856c6c 100644 --- a/SignalMessaging/attachments/AttachmentApprovalViewController.swift +++ b/SignalMessaging/attachments/AttachmentApprovalViewController.swift @@ -366,6 +366,7 @@ class CaptioningToolbar: UIView, UITextViewDelegate { } } + let kSendButtonShadowOffset: CGFloat = 1 init() { self.textView = MessageTextView() self.sendButton = UIButton(type: .system) @@ -389,9 +390,16 @@ class CaptioningToolbar: UIView, UITextViewDelegate { sendButton.titleLabel?.font = UIFont.ows_mediumFont(withSize: 16) sendButton.titleLabel?.textAlignment = .center sendButton.tintColor = UIColor.white - sendButton.backgroundColor = UIColor.ows_materialBlue() + sendButton.backgroundColor = UIColor.ows_systemPrimaryButton sendButton.layer.cornerRadius = 4 + // Send Button Shadow - without this the send button bottom doesn't align with the toolbar. + sendButton.layer.shadowColor = UIColor.darkGray.cgColor + sendButton.layer.shadowOffset = CGSize(width: 0, height: kSendButtonShadowOffset) + sendButton.layer.shadowOpacity = 0.8 + sendButton.layer.shadowRadius = 0.0 + sendButton.layer.masksToBounds = false + // Increase hit area of send button sendButton.contentEdgeInsets = UIEdgeInsets(top: 6, left: 8, bottom: 6, right: 8) @@ -438,7 +446,7 @@ class CaptioningToolbar: UIView, UITextViewDelegate { // position in bottom right corner let sendButtonX = frame.size.width - kToolbarMargin - sendButton.frame.size.width - let sendButtonY = frame.size.height - kToolbarMargin - sendButton.frame.size.height + let sendButtonY = frame.size.height - kToolbarMargin - sendButton.frame.size.height - kSendButtonShadowOffset sendButton.frame = CGRect(origin: CGPoint(x: sendButtonX, y: sendButtonY), size: sendButton.frame.size) Logger.debug("After layout >>> self: \(self.frame) textView: \(self.textView.frame), sendButton:\(sendButton.frame)") diff --git a/SignalMessaging/attachments/MediaMessageView.swift b/SignalMessaging/attachments/MediaMessageView.swift index 62dd4377c..71211fb89 100644 --- a/SignalMessaging/attachments/MediaMessageView.swift +++ b/SignalMessaging/attachments/MediaMessageView.swift @@ -348,7 +348,7 @@ public class MediaMessageView: UIView, OWSAudioAttachmentPlayerDelegate { private var controlTintColor: UIColor { switch mode { case .small, .large: - return UIColor.ows_materialBlue() + return UIColor.ows_materialBlue case .attachmentApproval: return UIColor.white } diff --git a/SignalMessaging/categories/UIColor+OWS.h b/SignalMessaging/categories/UIColor+OWS.h index b80bde873..ac5c5263a 100644 --- a/SignalMessaging/categories/UIColor+OWS.h +++ b/SignalMessaging/categories/UIColor+OWS.h @@ -8,21 +8,23 @@ NS_ASSUME_NONNULL_BEGIN @interface UIColor (OWS) -+ (UIColor *)ows_signalBrandBlueColor; -+ (UIColor *)ows_materialBlueColor; -+ (UIColor *)ows_destructiveRedColor; -+ (UIColor *)ows_fadedBlueColor; -+ (UIColor *)ows_darkBackgroundColor; -+ (UIColor *)ows_darkGrayColor; -+ (UIColor *)ows_yellowColor; -+ (UIColor *)ows_reminderYellowColor; -+ (UIColor *)ows_reminderDarkYellowColor; -+ (UIColor *)ows_greenColor; -+ (UIColor *)ows_redColor; -+ (UIColor *)ows_blackColor; -+ (UIColor *)ows_errorMessageBorderColor; -+ (UIColor *)ows_infoMessageBorderColor; -+ (UIColor *)ows_inputToolbarBackgroundColor; +@property (class, readonly, nonatomic) UIColor *ows_systemPrimaryButtonColor; +@property (class, readonly, nonatomic) UIColor *ows_signalBrandBlueColor; +@property (class, readonly, nonatomic) UIColor *ows_materialBlueColor; +@property (class, readonly, nonatomic) UIColor *ows_destructiveRedColor; +@property (class, readonly, nonatomic) UIColor *ows_fadedBlueColor; +@property (class, readonly, nonatomic) UIColor *ows_darkBackgroundColor; +@property (class, readonly, nonatomic) UIColor *ows_darkGrayColor; +@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_errorMessageBorderColor; +@property (class, readonly, nonatomic) UIColor *ows_infoMessageBorderColor; +@property (class, readonly, nonatomic) UIColor *ows_inputToolbarBackgroundColor; + + (UIColor *)backgroundColorForContact:(NSString *)contactIdentifier; + (UIColor *)colorWithRGBHex:(unsigned long)value; diff --git a/SignalMessaging/categories/UIColor+OWS.m b/SignalMessaging/categories/UIColor+OWS.m index 57e4f4061..a6736c3e9 100644 --- a/SignalMessaging/categories/UIColor+OWS.m +++ b/SignalMessaging/categories/UIColor+OWS.m @@ -96,6 +96,16 @@ NS_ASSUME_NONNULL_BEGIN return [UIColor colorWithRed:242.f / 255.f green:242.f / 255.f blue:242.f / 255.f alpha:1.f]; } ++ (UIColor *)ows_systemPrimaryButtonColor +{ + static UIColor *sharedColor; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^(void) { + sharedColor = [UIView new].tintColor; + }); + return sharedColor; +} + + (UIColor *)backgroundColorForContact:(NSString *)contactIdentifier { NSArray *colors = @[ diff --git a/SignalShareExtension/SAEFailedViewController.swift b/SignalShareExtension/SAEFailedViewController.swift index 418f709d1..0ac738033 100644 --- a/SignalShareExtension/SAEFailedViewController.swift +++ b/SignalShareExtension/SAEFailedViewController.swift @@ -40,7 +40,7 @@ class SAEFailedViewController: UIViewController { action: #selector(cancelPressed)) self.navigationItem.title = "Signal" - self.view.backgroundColor = UIColor.ows_signalBrandBlue() + self.view.backgroundColor = UIColor.ows_signalBrandBlue let logoImage = UIImage(named: "logoSignal") let logoImageView = UIImageView(image: logoImage) diff --git a/SignalShareExtension/SAELoadViewController.swift b/SignalShareExtension/SAELoadViewController.swift index 651b85733..539d946e8 100644 --- a/SignalShareExtension/SAELoadViewController.swift +++ b/SignalShareExtension/SAELoadViewController.swift @@ -61,7 +61,7 @@ class SAELoadViewController: UIViewController { action: #selector(cancelPressed)) self.navigationItem.title = "Signal" - self.view.backgroundColor = UIColor.ows_signalBrandBlue() + self.view.backgroundColor = UIColor.ows_signalBrandBlue let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle:.whiteLarge) self.activityIndicator = activityIndicator