Respond to CR.

pull/1/head
Matthew Chen 7 years ago
parent b2b95597cc
commit 48975eaac8

@ -194,6 +194,8 @@
34C6B0AB1FA0E46F00D35993 /* test-mp3.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 34C6B0A71FA0E46F00D35993 /* test-mp3.mp3 */; };
34C6B0AC1FA0E46F00D35993 /* test-mp4.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 34C6B0A81FA0E46F00D35993 /* test-mp4.mp4 */; };
34C6B0AE1FA0E4AA00D35993 /* test-jpg.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 34C6B0AD1FA0E4AA00D35993 /* test-jpg.jpg */; };
34C82E5120F8E1F300E9688D /* Theme.h in Headers */ = {isa = PBXBuildFile; fileRef = 34C82E4F20F8E1F000E9688D /* Theme.h */; settings = {ATTRIBUTES = (Public, ); }; };
34C82E5220F8E1F300E9688D /* Theme.m in Sources */ = {isa = PBXBuildFile; fileRef = 34C82E5020F8E1F100E9688D /* Theme.m */; };
34CA631B2097806F00E526A0 /* OWSContactShareView.m in Sources */ = {isa = PBXBuildFile; fileRef = 34CA631A2097806E00E526A0 /* OWSContactShareView.m */; };
34CCAF381F0C0599004084F4 /* AppUpdateNag.m in Sources */ = {isa = PBXBuildFile; fileRef = 34CCAF371F0C0599004084F4 /* AppUpdateNag.m */; };
34CE88E71F2FB9A10098030F /* ProfileViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34CE88E61F2FB9A10098030F /* ProfileViewController.m */; };
@ -835,6 +837,8 @@
34C6B0A71FA0E46F00D35993 /* test-mp3.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = "test-mp3.mp3"; sourceTree = "<group>"; };
34C6B0A81FA0E46F00D35993 /* test-mp4.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = "test-mp4.mp4"; sourceTree = "<group>"; };
34C6B0AD1FA0E4AA00D35993 /* test-jpg.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "test-jpg.jpg"; sourceTree = "<group>"; };
34C82E4F20F8E1F000E9688D /* Theme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Theme.h; sourceTree = "<group>"; };
34C82E5020F8E1F100E9688D /* Theme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Theme.m; sourceTree = "<group>"; };
34CA1C261F7156F300E51C51 /* MessageDetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageDetailViewController.swift; sourceTree = "<group>"; };
34CA1C281F7164F700E51C51 /* MediaMessageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaMessageView.swift; sourceTree = "<group>"; };
34CA63192097806E00E526A0 /* OWSContactShareView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSContactShareView.h; sourceTree = "<group>"; };
@ -1496,22 +1500,24 @@
34480B5C1FD0A98800BC14EF /* categories */ = {
isa = PBXGroup;
children = (
45BB93371E688E14001E3939 /* UIDevice+featureSupport.swift */,
4551DB59205C562300C8AE75 /* Collection+OWS.swift */,
346129C51FD2072D00532771 /* NSAttributedString+OWS.h */,
346129C11FD2072D00532771 /* NSAttributedString+OWS.m */,
346129C01FD2072C00532771 /* NSString+OWS.h */,
346129C21FD2072D00532771 /* NSString+OWS.m */,
346129C41FD2072D00532771 /* Promise+retainUntilComplete.swift */,
452D1AF220810B6F00A67F7F /* String+OWS.swift */,
34C82E4F20F8E1F000E9688D /* Theme.h */,
34C82E5020F8E1F100E9688D /* Theme.m */,
34480B5D1FD0A98800BC14EF /* UIColor+OWS.h */,
34480B5E1FD0A98800BC14EF /* UIColor+OWS.m */,
45BB93371E688E14001E3939 /* UIDevice+featureSupport.swift */,
34480B661FD0AA9400BC14EF /* UIFont+OWS.h */,
34480B651FD0AA9400BC14EF /* UIFont+OWS.m */,
34480B5F1FD0A98800BC14EF /* UIView+OWS.h */,
34480B601FD0A98800BC14EF /* UIView+OWS.m */,
346129D41FD20ADC00532771 /* UIViewController+OWS.h */,
346129D31FD20ADB00532771 /* UIViewController+OWS.m */,
452D1AF220810B6F00A67F7F /* String+OWS.swift */,
);
path = categories;
sourceTree = "<group>";
@ -2450,6 +2456,7 @@
344F248420069E9C00CFB4F4 /* CountryCodeViewController.h in Headers */,
4503F1C4204711D300CEE724 /* OWS107LegacySounds.h in Headers */,
346129711FD1D74C00532771 /* SignalKeyingStorage.h in Headers */,
34C82E5120F8E1F300E9688D /* Theme.h in Headers */,
34612A011FD5F31400532771 /* OWS104CreateRecipientIdentities.h in Headers */,
450998691FD8C10200D89EB3 /* AttachmentSharing.h in Headers */,
346129C71FD2072E00532771 /* NSString+OWS.h in Headers */,
@ -3160,6 +3167,7 @@
454A965B1FD601BF008D2A0E /* MediaMessageView.swift in Sources */,
45BC829D1FD9C4B400011CF3 /* ShareViewDelegate.swift in Sources */,
4565ED06200EA29900C46DBB /* VideoPlayerView.swift in Sources */,
34C82E5220F8E1F300E9688D /* Theme.m in Sources */,
3461295B1FD1D74C00532771 /* Environment.m in Sources */,
346129D51FD20ADC00532771 /* UIViewController+OWS.m in Sources */,
451F8A431FD714FE005CB9DA /* AvatarImageView.swift in Sources */,

@ -71,7 +71,7 @@
UILabel *copyrightLabel = [UILabel new];
copyrightLabel.text = NSLocalizedString(@"SETTINGS_COPYRIGHT", @"");
copyrightLabel.textColor = [UIColor ows_themeSecondaryColor];
copyrightLabel.textColor = [Theme secondaryColor];
copyrightLabel.font = [UIFont ows_regularFontWithSize:15.0f];
copyrightLabel.numberOfLines = 2;
copyrightLabel.lineBreakMode = NSLineBreakByWordWrapping;

@ -199,7 +199,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSTableSection *themeSection = [OWSTableSection new];
themeSection.headerTitle = NSLocalizedString(@"THEME_SECTION", nil);
[themeSection addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_ADVANCED_THEME", @"")
isOn:[UIColor isThemeEnabled]
isOn:[Theme isDarkThemeEnabled]
target:weakSelf
selector:@selector(didToggleThemeSwitch:)]];
[contents addSection:themeSection];
@ -287,7 +287,7 @@ NS_ASSUME_NONNULL_BEGIN
#ifdef THEME_ENABLED
- (void)didToggleThemeSwitch:(UISwitch *)sender
{
[UIColor setIsThemeEnabled:sender.isOn];
[Theme setIsDarkThemeEnabled:sender.isOn];
// TODO: Notify and refresh.
}

@ -316,7 +316,7 @@
NSString *_Nullable localProfileName = [OWSProfileManager.sharedManager localProfileName];
if (localProfileName.length > 0) {
titleLabel.text = localProfileName;
titleLabel.textColor = [UIColor ows_themePrimaryColor];
titleLabel.textColor = [Theme primaryColor];
titleLabel.font = [UIFont ows_dynamicTypeTitle2Font];
} else {
titleLabel.text = NSLocalizedString(
@ -331,7 +331,7 @@
const CGFloat kSubtitlePointSize = 12.f;
UILabel *subtitleLabel = [UILabel new];
subtitleLabel.textColor = [UIColor ows_themeSecondaryColor];
subtitleLabel.textColor = [Theme secondaryColor];
subtitleLabel.font = [UIFont ows_regularFontWithSize:kSubtitlePointSize];
subtitleLabel.attributedText = [[NSAttributedString alloc]
initWithString:[PhoneNumber bestEffortFormatPartialUserSpecifiedTextToLookLikeAPhoneNumber:[TSAccountManager

@ -345,8 +345,8 @@ NS_ASSUME_NONNULL_BEGIN
OWSBubbleShapeView *strokeView = [OWSBubbleShapeView bubbleDrawView];
strokeView.strokeThickness = CGHairlineWidth();
strokeView.strokeColor = (UIColor.isThemeEnabled ? [UIColor colorWithWhite:1.f alpha:0.2f]
: [UIColor colorWithWhite:0.f alpha:0.2f]);
strokeView.strokeColor = (Theme.isDarkThemeEnabled ? [UIColor colorWithWhite:1.f alpha:0.2f]
: [UIColor colorWithWhite:0.f alpha:0.2f]);
[bodyMediaView addSubview:strokeView];
[self.bubbleView addPartnerView:strokeView];
[self.viewConstraints addObjectsFromArray:[strokeView ows_autoPinToSuperviewEdges]];

@ -64,13 +64,13 @@ public class ConversationHeaderView: UIStackView {
avatarView.layer.borderWidth = 0
titleLabel = UILabel()
titleLabel.textColor = .ows_navbarTitle
titleLabel.textColor = Theme.navbarTitleColor
titleLabel.lineBreakMode = .byTruncatingTail
titleLabel.font = titlePrimaryFont
titleLabel.setContentHuggingHigh()
subtitleLabel = UILabel()
subtitleLabel.textColor = .ows_navbarTitle
subtitleLabel.textColor = Theme.navbarTitleColor
subtitleLabel.lineBreakMode = .byTruncatingTail
subtitleLabel.font = subtitleFont
subtitleLabel.setContentHuggingHigh()

@ -87,10 +87,10 @@ const CGFloat kMaxTextViewHeight = 98;
self.layoutMargins = UIEdgeInsetsZero;
if (UIAccessibilityIsReduceTransparencyEnabled()) {
self.backgroundColor = [UIColor ows_toolbarBackgroundColor];
self.backgroundColor = Theme.toolbarBackgroundColor;
} else {
CGFloat alpha = OWSNavigationBar.backgroundBlurMutingFactor;
self.backgroundColor = [[UIColor ows_toolbarBackgroundColor] colorWithAlphaComponent:alpha];
self.backgroundColor = [Theme.toolbarBackgroundColor colorWithAlphaComponent:alpha];
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
@ -119,7 +119,7 @@ const CGFloat kMaxTextViewHeight = 98;
UIImage *attachmentImage = [UIImage imageNamed:@"ic_circled_plus"];
[self.attachmentButton setImage:[attachmentImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]
forState:UIControlStateNormal];
self.attachmentButton.tintColor = UIColor.ows_navbarIconColor;
self.attachmentButton.tintColor = Theme.navbarIconColor;
[self.attachmentButton autoSetDimensionsToSize:CGSizeMake(40, kMinTextViewHeight)];
_sendButton = [UIButton buttonWithType:UIButtonTypeCustom];
@ -138,7 +138,7 @@ const CGFloat kMaxTextViewHeight = 98;
_voiceMemoButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.voiceMemoButton setImage:[voiceMemoIcon imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]
forState:UIControlStateNormal];
self.voiceMemoButton.imageView.tintColor = UIColor.ows_navbarIconColor;
self.voiceMemoButton.imageView.tintColor = Theme.navbarIconColor;
[self.voiceMemoButton autoSetDimensionsToSize:CGSizeMake(40, kMinTextViewHeight)];
// We want to be permissive about the voice message gesture, so we hang

@ -571,7 +571,7 @@ typedef enum : NSUInteger {
[super loadView];
// make sure toolbar extends below iPhoneX home button.
self.view.backgroundColor = [UIColor ows_toolbarBackgroundColor];
self.view.backgroundColor = Theme.toolbarBackgroundColor;
}
- (void)createContents
@ -1355,11 +1355,11 @@ typedef enum : NSUInteger {
if (OWSWindowManager.sharedManager.hasCall) {
callButton.enabled = NO;
callButton.userInteractionEnabled = NO;
callButton.tintColor = [UIColor.ows_navbarIconColor colorWithAlphaComponent:0.7];
callButton.tintColor = [Theme.navbarIconColor colorWithAlphaComponent:0.7];
} else {
callButton.enabled = YES;
callButton.userInteractionEnabled = YES;
callButton.tintColor = UIColor.ows_navbarIconColor;
callButton.tintColor = Theme.navbarIconColor;
}
UIEdgeInsets imageEdgeInsets = UIEdgeInsetsZero;
@ -1387,7 +1387,7 @@ typedef enum : NSUInteger {
DisappearingTimerConfigurationView *timerView = [[DisappearingTimerConfigurationView alloc]
initWithDurationSeconds:self.disappearingMessagesConfiguration.durationSeconds];
timerView.delegate = self;
timerView.tintColor = UIColor.ows_navbarIconColor;
timerView.tintColor = Theme.navbarIconColor;
// As of iOS11, we can size barButton item custom views with autoLayout.
// Before that, though we can still use autoLayout *within* the customView,
@ -1409,7 +1409,7 @@ typedef enum : NSUInteger {
{
NSMutableAttributedString *subtitleText = [NSMutableAttributedString new];
UIColor *subtitleColor = [UIColor.ows_navbarTitleColor colorWithAlphaComponent:(CGFloat)0.9];
UIColor *subtitleColor = [Theme.navbarTitleColor colorWithAlphaComponent:(CGFloat)0.9];
if (self.thread.isMuted) {
// Show a "mute" icon before the navigation bar subtitle if this thread is muted.
[subtitleText appendAttributedString:[[NSAttributedString alloc]

@ -61,13 +61,13 @@ NS_ASSUME_NONNULL_BEGIN
{
OWSAssert(!self.avatarView);
self.backgroundColor = UIColor.ows_themeBackgroundColor;
self.backgroundColor = Theme.backgroundColor;
_viewConstraints = [NSMutableArray new];
UIView *selectedBackgroundView = [UIView new];
selectedBackgroundView.backgroundColor =
[(UIColor.isThemeEnabled ? [UIColor ows_whiteColor] : [UIColor ows_blackColor]) colorWithAlphaComponent:0.08f];
selectedBackgroundView.backgroundColor = [(
Theme.isDarkThemeEnabled ? [UIColor ows_whiteColor] : [UIColor ows_blackColor]) colorWithAlphaComponent:0.08f];
self.selectedBackgroundView = selectedBackgroundView;
@ -226,9 +226,9 @@ NS_ASSUME_NONNULL_BEGIN
self.dateTimeLabel.text
= (overrideDate ? [self stringForDate:overrideDate] : [self stringForDate:thread.lastMessageDate]);
UIColor *textColor = [UIColor ows_themeSecondaryColor];
UIColor *textColor = [Theme secondaryColor];
if (hasUnreadMessages && overrideSnippet == nil) {
textColor = [UIColor ows_themePrimaryColor];
textColor = [Theme primaryColor];
self.dateTimeLabel.font = self.dateTimeFont.ows_mediumWeight;
} else {
self.dateTimeLabel.font = self.dateTimeFont;
@ -276,7 +276,7 @@ NS_ASSUME_NONNULL_BEGIN
UIImage *_Nullable statusIndicatorImage = nil;
// TODO: Theme, Review with design.
UIColor *messageStatusViewTintColor
= (UIColor.isThemeEnabled ? [UIColor ows_dark30Color] : [UIColor ows_light35Color]);
= (Theme.isDarkThemeEnabled ? [UIColor ows_dark30Color] : [UIColor ows_light35Color]);
BOOL shouldAnimateStatusIcon = NO;
if ([self.thread.lastMessageForInbox isKindOfClass:[TSOutgoingMessage class]]) {
TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)self.thread.lastMessageForInbox;
@ -366,7 +366,7 @@ NS_ASSUME_NONNULL_BEGIN
@"A label for conversations with blocked users.")
attributes:@{
NSFontAttributeName : self.snippetFont.ows_mediumWeight,
NSForegroundColorAttributeName : [UIColor ows_themePrimaryColor],
NSForegroundColorAttributeName : [Theme primaryColor],
}]];
} else {
if ([thread isMuted]) {
@ -375,8 +375,8 @@ NS_ASSUME_NONNULL_BEGIN
attributes:@{
NSFontAttributeName : [UIFont ows_elegantIconsFont:9.f],
NSForegroundColorAttributeName :
(hasUnreadMessages ? [UIColor ows_themePrimaryColor]
: [UIColor ows_themeSecondaryColor]),
(hasUnreadMessages ? [Theme primaryColor]
: [Theme secondaryColor]),
}]];
}
NSString *displayableText = thread.lastMessageText;
@ -388,8 +388,8 @@ NS_ASSUME_NONNULL_BEGIN
(hasUnreadMessages ? self.snippetFont.ows_mediumWeight
: self.snippetFont),
NSForegroundColorAttributeName :
(hasUnreadMessages ? [UIColor ows_themePrimaryColor]
: [UIColor ows_themeSecondaryColor]),
(hasUnreadMessages ? [Theme primaryColor]
: [Theme secondaryColor]),
}]];
}
}
@ -491,7 +491,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssertIsOnMainThread();
self.nameLabel.font = self.nameFont;
self.nameLabel.textColor = [UIColor ows_themePrimaryColor];
self.nameLabel.textColor = [Theme primaryColor];
ThreadViewModel *thread = self.thread;
if (thread == nil) {

@ -229,8 +229,8 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
{
OWSAssertIsOnMainThread();
self.view.backgroundColor = UIColor.ows_themeBackgroundColor;
self.tableView.backgroundColor = UIColor.ows_themeBackgroundColor;
self.view.backgroundColor = Theme.backgroundColor;
self.tableView.backgroundColor = Theme.backgroundColor;
}
#pragma mark - View Life Cycle
@ -383,8 +383,8 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
searchBar.searchBarStyle = UISearchBarStyleMinimal;
searchBar.placeholder = NSLocalizedString(@"HOME_VIEW_CONVERSATION_SEARCHBAR_PLACEHOLDER",
@"Placeholder text for search bar which filters conversations.");
searchBar.backgroundColor = UIColor.ows_themeBackgroundColor;
if (UIColor.isThemeEnabled) {
searchBar.backgroundColor = Theme.backgroundColor;
if (Theme.isDarkThemeEnabled) {
searchBar.barStyle = UIBarStyleBlack;
} else {
searchBar.barStyle = UIBarStyleDefault;
@ -448,6 +448,8 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
}
// Settings button.
//
// TODO: Theme
UIImage *image = [UIImage imageNamed:@"button_settings_white"];
UIBarButtonItem *settingsButton = [[UIBarButtonItem alloc] initWithImage:image style:UIBarButtonItemStylePlain target:self action:@selector(settingsButtonPressed:)];
settingsButton.accessibilityLabel = CommonStrings.openSettingsButton;
@ -808,7 +810,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
[subview removeFromSuperview];
}
cell.backgroundColor = UIColor.ows_themeBackgroundColor;
cell.backgroundColor = Theme.backgroundColor;
UIImage *disclosureImage = [UIImage imageNamed:(CurrentAppContext().isRTL ? @"NavBarBack" : @"NavBarBackRTL")];
OWSAssert(disclosureImage);
@ -822,7 +824,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
label.text = NSLocalizedString(@"HOME_VIEW_ARCHIVED_CONVERSATIONS", @"Label for 'archived conversations' button.");
label.textAlignment = NSTextAlignmentCenter;
label.font = [UIFont ows_dynamicTypeBodyFont];
label.textColor = UIColor.ows_themePrimaryColor;
label.textColor = Theme.primaryColor;
UIStackView *stackView = [UIStackView new];
stackView.axis = UILayoutConstraintAxisHorizontal;
@ -1449,11 +1451,11 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
value:[UIFont ows_regularFontWithSize:14.f]
range:NSMakeRange(firstLine.length + 1, secondLine.length)];
[fullLabelString addAttribute:NSForegroundColorAttributeName
value:UIColor.ows_themePrimaryColor
value:Theme.primaryColor
range:NSMakeRange(0, firstLine.length)];
// TODO: Theme, Review with design.
[fullLabelString addAttribute:NSForegroundColorAttributeName
value:UIColor.ows_themeSecondaryColor
value:Theme.secondaryColor
range:NSMakeRange(firstLine.length + 1, secondLine.length)];
_emptyBoxLabel.attributedText = fullLabelString;
}

@ -587,7 +587,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
lazy private var headerNameLabel: UILabel = {
let label = UILabel()
label.textColor = .ows_navbarTitle
label.textColor = Theme.navbarTitleColor
label.font = UIFont.ows_regularFont(withSize: 17)
label.textAlignment = .center
label.adjustsFontSizeToFitWidth = true
@ -598,7 +598,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
lazy private var headerDateLabel: UILabel = {
let label = UILabel()
label.textColor = .ows_navbarTitle
label.textColor = Theme.navbarTitleColor
label.font = UIFont.ows_regularFont(withSize: 12)
label.textAlignment = .center
label.adjustsFontSizeToFitWidth = true

@ -75,7 +75,7 @@ NS_ASSUME_NONNULL_BEGIN
{
[super loadView];
self.view.backgroundColor = UIColor.ows_themeBackgroundColor;
self.view.backgroundColor = Theme.backgroundColor;
_contactsViewHelper = [[ContactsViewHelper alloc] initWithDelegate:self];
_conversationSearcher = [ConversationSearcher shared];
_nonContactAccountSet = [NSMutableSet set];
@ -102,8 +102,8 @@ NS_ASSUME_NONNULL_BEGIN
searchBar.searchBarStyle = UISearchBarStyleMinimal;
searchBar.delegate = self;
searchBar.placeholder = NSLocalizedString(@"SEARCH_BYNAMEORNUMBER_PLACEHOLDER_TEXT", @"");
searchBar.backgroundColor = [UIColor ows_themeBackgroundColor];
if (UIColor.isThemeEnabled) {
searchBar.backgroundColor = [Theme backgroundColor];
if (Theme.isDarkThemeEnabled) {
searchBar.barStyle = UIBarStyleBlack;
} else {
searchBar.barStyle = UIBarStyleDefault;
@ -183,7 +183,7 @@ NS_ASSUME_NONNULL_BEGIN
- (UIView *)createNoSignalContactsView
{
UIView *view = [UIView new];
view.backgroundColor = [UIColor ows_themeBackgroundColor];
view.backgroundColor = [Theme backgroundColor];
UIView *contents = [UIView new];
[view addSubview:contents];
@ -205,7 +205,7 @@ NS_ASSUME_NONNULL_BEGIN
UILabel *titleLabel = [UILabel new];
titleLabel.text = NSLocalizedString(
@"EMPTY_CONTACTS_LABEL_LINE1", "Full width label displayed when attempting to compose message");
titleLabel.textColor = [UIColor ows_themePrimaryColor];
titleLabel.textColor = [Theme primaryColor];
titleLabel.font = [UIFont ows_mediumFontWithSize:ScaleFromIPhone5To7Plus(17.f, 20.f)];
titleLabel.textAlignment = NSTextAlignmentCenter;
titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
@ -218,7 +218,7 @@ NS_ASSUME_NONNULL_BEGIN
UILabel *subtitleLabel = [UILabel new];
subtitleLabel.text = NSLocalizedString(
@"EMPTY_CONTACTS_LABEL_LINE2", "Full width label displayed when attempting to compose message");
subtitleLabel.textColor = [UIColor ows_themeSecondaryColor];
subtitleLabel.textColor = [Theme secondaryColor];
subtitleLabel.font = [UIFont ows_regularFontWithSize:ScaleFromIPhone5To7Plus(12.f, 14.f)];
subtitleLabel.textAlignment = NSTextAlignmentCenter;
subtitleLabel.lineBreakMode = NSLineBreakByWordWrapping;
@ -1023,7 +1023,7 @@ NS_ASSUME_NONNULL_BEGIN
{
OWSAssertIsOnMainThread();
self.view.backgroundColor = UIColor.ows_themeBackgroundColor;
self.view.backgroundColor = Theme.backgroundColor;
}
@end

@ -137,7 +137,7 @@ const NSUInteger kNewGroupViewControllerAvatarWidth = 68;
firstSectionHeader.userInteractionEnabled = YES;
[firstSectionHeader
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(headerWasTapped:)]];
firstSectionHeader.backgroundColor = [UIColor ows_themeBackgroundColor];
firstSectionHeader.backgroundColor = [Theme backgroundColor];
UIView *threadInfoView = [UIView new];
[firstSectionHeader addSubview:threadInfoView];
[threadInfoView autoPinWidthToSuperviewWithMargin:16.f];
@ -155,7 +155,7 @@ const NSUInteger kNewGroupViewControllerAvatarWidth = 68;
UITextField *groupNameTextField = [UITextField new];
_groupNameTextField = groupNameTextField;
groupNameTextField.textColor = [UIColor ows_themePrimaryColor];
groupNameTextField.textColor = [Theme primaryColor];
groupNameTextField.font = [UIFont ows_dynamicTypeTitle2Font];
groupNameTextField.placeholder
= NSLocalizedString(@"NEW_GROUP_NAMEGROUP_REQUEST_DEFAULT", @"Placeholder text for group name field");

@ -63,7 +63,7 @@ NS_ASSUME_NONNULL_BEGIN
self.title = NSLocalizedString(@"REGISTRATION_ENTER_LOCK_PIN_NAV_TITLE",
@"Navigation title shown when user is re-registering after having enabled registration lock");
self.view.backgroundColor = [UIColor ows_themeBackgroundColor];
self.view.backgroundColor = [Theme backgroundColor];
PinEntryView *entryView = [PinEntryView new];
self.entryView = entryView;

@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
{
[super viewDidLoad];
self.view.backgroundColor = [UIColor ows_themeBackgroundColor];
self.view.backgroundColor = [Theme backgroundColor];
self.title = NSLocalizedString(@"ENABLE_2FA_VIEW_TITLE", @"Title for the 'enable two factor auth PIN' views.");
@ -99,7 +99,7 @@ NS_ASSUME_NONNULL_BEGIN
- (UILabel *)createLabelWithText:(NSString *)text
{
UILabel *label = [UILabel new];
label.textColor = [UIColor ows_themePrimaryColor];
label.textColor = [Theme primaryColor];
label.text = text;
label.font = [UIFont ows_regularFontWithSize:ScaleFromIPhone5To7Plus(14.f, 16.f)];
label.numberOfLines = 0;
@ -112,7 +112,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)createPinTextfield
{
self.pinTextfield = [UITextField new];
self.pinTextfield.textColor = [UIColor ows_themePrimaryColor];
self.pinTextfield.textColor = [Theme primaryColor];
self.pinTextfield.font = [UIFont ows_mediumFontWithSize:ScaleFromIPhone5To7Plus(30.f, 36.f)];
self.pinTextfield.textAlignment = NSTextAlignmentCenter;
self.pinTextfield.keyboardType = UIKeyboardTypeNumberPad;

@ -383,7 +383,7 @@ const CGFloat kIconViewLength = 24;
UILabel *rowLabel = [UILabel new];
rowLabel.text = NSLocalizedString(
@"DISAPPEARING_MESSAGES", @"table cell label in conversation settings");
rowLabel.textColor = [UIColor ows_themePrimaryColor];
rowLabel.textColor = [Theme primaryColor];
rowLabel.font = [UIFont ows_dynamicTypeBodyFont];
rowLabel.lineBreakMode = NSLineBreakByTruncatingTail;
@ -403,7 +403,7 @@ const CGFloat kIconViewLength = 24;
UILabel *subtitleLabel = [UILabel new];
subtitleLabel.text = NSLocalizedString(
@"DISAPPEARING_MESSAGES_DESCRIPTION", @"subheading in conversation settings");
subtitleLabel.textColor = [UIColor ows_themePrimaryColor];
subtitleLabel.textColor = [Theme primaryColor];
subtitleLabel.font = [UIFont ows_dynamicTypeCaption1Font];
subtitleLabel.numberOfLines = 0;
subtitleLabel.lineBreakMode = NSLineBreakByWordWrapping;
@ -433,7 +433,7 @@ const CGFloat kIconViewLength = 24;
UILabel *rowLabel = strongSelf.disappearingMessagesDurationLabel;
[strongSelf updateDisappearingMessagesDurationLabel];
rowLabel.textColor = [UIColor ows_themePrimaryColor];
rowLabel.textColor = [Theme primaryColor];
rowLabel.font = [UIFont ows_dynamicTypeBodyFont];
// don't truncate useful duration info which is in the tail
rowLabel.lineBreakMode = NSLineBreakByTruncatingHead;
@ -526,7 +526,7 @@ const CGFloat kIconViewLength = 24;
UILabel *rowLabel = [UILabel new];
rowLabel.text = NSLocalizedString(@"SETTINGS_ITEM_NOTIFICATION_SOUND",
@"Label for settings view that allows user to change the notification sound.");
rowLabel.textColor = [UIColor ows_themePrimaryColor];
rowLabel.textColor = [Theme primaryColor];
rowLabel.font = [UIFont ows_dynamicTypeBodyFont];
rowLabel.lineBreakMode = NSLineBreakByTruncatingTail;
@ -565,7 +565,7 @@ const CGFloat kIconViewLength = 24;
UILabel *rowLabel = [UILabel new];
rowLabel.text = NSLocalizedString(@"CONVERSATION_SETTINGS_MUTE_LABEL",
@"label for 'mute thread' cell in conversation settings");
rowLabel.textColor = [UIColor ows_themePrimaryColor];
rowLabel.textColor = [Theme primaryColor];
rowLabel.font = [UIFont ows_dynamicTypeBodyFont];
rowLabel.lineBreakMode = NSLineBreakByTruncatingTail;
@ -688,7 +688,7 @@ const CGFloat kIconViewLength = 24;
UILabel *rowLabel = [UILabel new];
rowLabel.text = name;
rowLabel.textColor = [UIColor ows_themePrimaryColor];
rowLabel.textColor = [Theme primaryColor];
rowLabel.font = [UIFont ows_dynamicTypeBodyFont];
rowLabel.lineBreakMode = NSLineBreakByTruncatingTail;
@ -744,7 +744,7 @@ const CGFloat kIconViewLength = 24;
UILabel *threadTitleLabel = [UILabel new];
threadTitleLabel.text = self.threadName;
threadTitleLabel.textColor = [UIColor ows_themePrimaryColor];
threadTitleLabel.textColor = [Theme primaryColor];
threadTitleLabel.font = [UIFont ows_dynamicTypeTitle2Font];
threadTitleLabel.lineBreakMode = NSLineBreakByTruncatingTail;
[threadNameView addSubview:threadTitleLabel];
@ -757,7 +757,7 @@ const CGFloat kIconViewLength = 24;
const CGFloat kSubtitlePointSize = 12.f;
void (^addSubtitle)(NSAttributedString *) = ^(NSAttributedString *subtitle) {
UILabel *subtitleLabel = [UILabel new];
subtitleLabel.textColor = [UIColor ows_themeSecondaryColor];
subtitleLabel.textColor = [Theme secondaryColor];
subtitleLabel.font = [UIFont ows_regularFontWithSize:kSubtitlePointSize];
subtitleLabel.attributedText = subtitle;
subtitleLabel.lineBreakMode = NSLineBreakByTruncatingTail;
@ -835,7 +835,7 @@ const CGFloat kIconViewLength = 24;
OWSAssert(icon);
UIImageView *iconView = [UIImageView new];
iconView.image = [icon imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
iconView.tintColor = [UIColor ows_themeSecondaryColor];
iconView.tintColor = [Theme secondaryColor];
iconView.contentMode = UIViewContentModeScaleAspectFit;
iconView.layer.minificationFilter = kCAFilterTrilinear;
iconView.layer.magnificationFilter = kCAFilterTrilinear;

@ -172,7 +172,7 @@ NS_ASSUME_NONNULL_BEGIN
firstSectionHeader.userInteractionEnabled = YES;
[firstSectionHeader
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(headerWasTapped:)]];
firstSectionHeader.backgroundColor = [UIColor ows_themeBackgroundColor];
firstSectionHeader.backgroundColor = [Theme backgroundColor];
UIView *threadInfoView = [UIView new];
[firstSectionHeader addSubview:threadInfoView];
[threadInfoView autoPinWidthToSuperviewWithMargin:16.f];
@ -193,7 +193,7 @@ NS_ASSUME_NONNULL_BEGIN
UITextField *groupNameTextField = [UITextField new];
_groupNameTextField = groupNameTextField;
self.groupNameTextField.text = [self.thread.groupModel.groupName ows_stripped];
groupNameTextField.textColor = [UIColor ows_themePrimaryColor];
groupNameTextField.textColor = [Theme primaryColor];
groupNameTextField.font = [UIFont ows_dynamicTypeTitle2Font];
groupNameTextField.placeholder
= NSLocalizedString(@"NEW_GROUP_NAMEGROUP_REQUEST_DEFAULT", @"Placeholder text for group name field");

@ -23,7 +23,7 @@ class DismissInputBar: UIToolbar {
self.items = [spacer, dismissButton]
self.isTranslucent = false
self.isOpaque = true
self.barTintColor = UIColor.ows_toolbarBackground
self.barTintColor = Theme.toolbarBackgroundColor
self.autoresizingMask = .flexibleHeight
self.translatesAutoresizingMaskIntoConstraints = false

@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN
- (UILabel *)createLabelWithText:(nullable NSString *)text
{
UILabel *label = [UILabel new];
label.textColor = [UIColor ows_themePrimaryColor];
label.textColor = [Theme primaryColor];
label.text = text;
label.font = self.labelFont;
label.numberOfLines = 0;
@ -65,7 +65,7 @@ NS_ASSUME_NONNULL_BEGIN
self.pinTextfield = [UITextField new];
}
self.pinTextfield.textColor = [UIColor ows_themePrimaryColor];
self.pinTextfield.textColor = [Theme primaryColor];
self.pinTextfield.font = [UIFont ows_mediumFontWithSize:ScaleFromIPhone5To7Plus(30.f, 36.f)];
self.pinTextfield.textAlignment = NSTextAlignmentCenter;
self.pinTextfield.keyboardType = UIKeyboardTypeNumberPad;

@ -67,7 +67,7 @@ class ReminderView: UIView {
self.backgroundColor = UIColor.ows_reminderYellow
case .explanation:
// TODO: Theme, review with design.
self.backgroundColor = (UIColor.isThemeEnabled()
self.backgroundColor = (Theme.isDarkThemeEnabled()
? UIColor(rgbHex: 0x202020)
: UIColor(rgbHex: 0xf5f5f5))
}
@ -88,7 +88,7 @@ class ReminderView: UIView {
// Label
label.font = UIFont.ows_dynamicTypeSubheadline
container.addArrangedSubview(label)
label.textColor = UIColor.ows_themePrimary
label.textColor = Theme.primaryColor
label.numberOfLines = 0
label.lineBreakMode = .byWordWrapping
@ -102,7 +102,7 @@ class ReminderView: UIView {
}
let iconView = UIImageView(image: iconImage.withRenderingMode(.alwaysTemplate))
iconView.contentMode = .scaleAspectFit
iconView.tintColor = UIColor.ows_themeSecondary
iconView.tintColor = Theme.secondaryColor
iconView.autoSetDimension(.width, toSize: 13)
container.addArrangedSubview(iconView)
}

@ -42,6 +42,7 @@ FOUNDATION_EXPORT const unsigned char SignalMessagingVersionString[];
#import <SignalMessaging/SharingThreadPickerViewController.h>
#import <SignalMessaging/SignalKeyingStorage.h>
#import <SignalMessaging/TSUnreadIndicatorInteraction.h>
#import <SignalMessaging/Theme.h>
#import <SignalMessaging/ThreadUtil.h>
#import <SignalMessaging/ThreadViewHelper.h>
#import <SignalMessaging/UIColor+OWS.h>

@ -121,7 +121,7 @@ NS_ASSUME_NONNULL_BEGIN
// Status bar is overlaying the green "call banner"
return UIStatusBarStyleLightContent;
} else {
return (UIColor.isThemeEnabled ? UIStatusBarStyleLightContent : super.preferredStatusBarStyle);
return (Theme.isDarkThemeEnabled ? UIStatusBarStyleLightContent : super.preferredStatusBarStyle);
}
}

@ -107,13 +107,13 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
+ (void)configureCell:(UITableViewCell *)cell
{
cell.backgroundColor = [UIColor ows_themeBackgroundColor];
cell.backgroundColor = [Theme backgroundColor];
cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f];
cell.textLabel.textColor = [UIColor ows_themePrimaryColor];
cell.textLabel.textColor = [Theme primaryColor];
UIView *selectedBackgroundView = [UIView new];
selectedBackgroundView.backgroundColor =
[(UIColor.isThemeEnabled ? [UIColor ows_whiteColor] : [UIColor ows_blackColor]) colorWithAlphaComponent:0.08];
[(Theme.isDarkThemeEnabled ? [UIColor ows_whiteColor] : [UIColor ows_blackColor]) colorWithAlphaComponent:0.08];
cell.selectedBackgroundView = selectedBackgroundView;
}
@ -332,7 +332,7 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
UILabel *accessoryLabel = [UILabel new];
accessoryLabel.text = accessoryText;
accessoryLabel.textColor = [UIColor ows_themeSecondaryColor];
accessoryLabel.textColor = [Theme secondaryColor];
accessoryLabel.font = [UIFont ows_regularFontWithSize:16.0f];
accessoryLabel.textAlignment = NSTextAlignmentRight;
[accessoryLabel sizeToFit];
@ -717,8 +717,8 @@ NSString *const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier";
{
OWSAssertIsOnMainThread();
self.view.backgroundColor = UIColor.ows_themeBackgroundColor;
self.tableView.backgroundColor = UIColor.ows_themeBackgroundColor;
self.view.backgroundColor = Theme.backgroundColor;
self.tableView.backgroundColor = Theme.backgroundColor;
}
@end

@ -97,9 +97,9 @@ const CGFloat kContactCellAvatarTextMargin = 12;
self.subtitleLabel.font = [UIFont ows_regularFontWithSize:11.f];
self.accessoryLabel.font = [UIFont ows_mediumFontWithSize:13.f];
self.nameLabel.textColor = [UIColor ows_themePrimaryColor];
self.profileNameLabel.textColor = [UIColor ows_themeSecondaryColor];
self.subtitleLabel.textColor = [UIColor ows_themeSecondaryColor];
self.nameLabel.textColor = [Theme primaryColor];
self.profileNameLabel.textColor = [Theme secondaryColor];
self.subtitleLabel.textColor = [Theme secondaryColor];
self.accessoryLabel.textColor = [UIColor colorWithWhite:0.5f alpha:1.f];
}
@ -156,7 +156,7 @@ const CGFloat kContactCellAvatarTextMargin = 12;
NSAttributedString *attributedText =
[[NSAttributedString alloc] initWithString:threadName
attributes:@{
NSForegroundColorAttributeName : [UIColor ows_themePrimaryColor],
NSForegroundColorAttributeName : [Theme primaryColor],
}];
self.nameLabel.attributedText = attributedText;

@ -47,7 +47,7 @@ public class OWSNavigationBar: UINavigationBar {
if !UIAccessibilityIsReduceTransparencyEnabled() {
// Make navbar more translucent than default. Navbars remove alpha from any assigned backgroundColor, so
// to achieve transparency, we have to assign a transparent image.
let color = UIColor.ows_navbarBackground.withAlphaComponent(OWSNavigationBar.backgroundBlurMutingFactor)
let color = Theme.navbarBackgroundColor.withAlphaComponent(OWSNavigationBar.backgroundBlurMutingFactor)
let backgroundImage = UIImage(color: color)
self.setBackgroundImage(backgroundImage, for: .default)
let blurEffect = UIBlurEffect(style: .light)

@ -99,7 +99,7 @@ public class MessageApprovalViewController: OWSViewController, UITextViewDelegat
private func createRecipientRow() -> UIView {
let recipientRow = UIView.container()
recipientRow.backgroundColor = UIColor.ows_toolbarBackground
recipientRow.backgroundColor = Theme.toolbarBackgroundColor
// Hairline borders should be 1 pixel, not 1 point.
let borderThickness = 1.0 / UIScreen.main.scale

@ -0,0 +1,39 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
#define THEME_ENABLED
#endif
extern NSString *const NSNotificationNameThemeDidChange;
@interface Theme : NSObject
- (instancetype)init NS_UNAVAILABLE;
+ (BOOL)isDarkThemeEnabled;
#ifdef THEME_ENABLED
+ (void)setIsDarkThemeEnabled:(BOOL)value;
#endif
@property (class, readonly, nonatomic) UIColor *backgroundColor;
@property (class, readonly, nonatomic) UIColor *primaryColor;
@property (class, readonly, nonatomic) UIColor *secondaryColor;
@property (class, readonly, nonatomic) UIColor *boldColor;
#pragma mark - Global App Colors
@property (class, readonly, nonatomic) UIColor *navbarBackgroundColor;
@property (class, readonly, nonatomic) UIColor *navbarIconColor;
@property (class, readonly, nonatomic) UIColor *navbarTitleColor;
@property (class, readonly, nonatomic) UIColor *toolbarBackgroundColor;
@end
NS_ASSUME_NONNULL_END

@ -0,0 +1,98 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "Theme.h"
#import "UIColor+OWS.h"
#import "UIUtil.h"
#import <SignalServiceKit/NSNotificationCenter+OWS.h>
#import <SignalServiceKit/OWSPrimaryStorage.h>
#import <SignalServiceKit/YapDatabaseConnection+OWS.h>
NS_ASSUME_NONNULL_BEGIN
NSString *const NSNotificationNameThemeDidChange = @"NSNotificationNameThemeDidChange";
NSString *const ThemeCollection = @"ThemeCollection";
NSString *const ThemeKeyThemeEnabled = @"ThemeKeyThemeEnabled";
@implementation Theme
+ (BOOL)isDarkThemeEnabled
{
OWSAssertIsOnMainThread();
#ifndef THEME_ENABLED
return NO;
#else
return [OWSPrimaryStorage.sharedManager.dbReadConnection boolForKey:ThemeKeyThemeEnabled
inCollection:ThemeCollection
defaultValue:NO];
#endif
}
+ (void)setIsDarkThemeEnabled:(BOOL)value
{
OWSAssertIsOnMainThread();
[OWSPrimaryStorage.sharedManager.dbReadWriteConnection setBool:value
forKey:ThemeKeyThemeEnabled
inCollection:ThemeCollection];
[UIUtil setupSignalAppearence];
[[NSNotificationCenter defaultCenter] postNotificationNameAsync:NSNotificationNameThemeDidChange
object:nil
userInfo:nil];
}
+ (UIColor *)backgroundColor
{
return (Theme.isDarkThemeEnabled ? UIColor.ows_blackColor : UIColor.ows_whiteColor);
}
+ (UIColor *)primaryColor
{
// TODO: Theme, Review with design.
return (Theme.isDarkThemeEnabled ? UIColor.ows_whiteColor : UIColor.ows_light90Color);
}
+ (UIColor *)secondaryColor
{
// TODO: Theme, Review with design.
return (Theme.isDarkThemeEnabled ? UIColor.ows_dark60Color : UIColor.ows_light60Color);
}
+ (UIColor *)boldColor
{
// TODO: Review with design.
return (Theme.isDarkThemeEnabled ? UIColor.ows_whiteColor : UIColor.blackColor);
}
#pragma mark - Global App Colors
+ (UIColor *)navbarBackgroundColor
{
return (Theme.isDarkThemeEnabled ? UIColor.ows_blackColor : UIColor.ows_whiteColor);
}
+ (UIColor *)navbarIconColor
{
// TODO: Theme, Review with design.
return (Theme.isDarkThemeEnabled ? UIColor.ows_dark60Color : UIColor.ows_light60Color);
}
+ (UIColor *)navbarTitleColor
{
// TODO: Theme, Review with design.
return (Theme.isDarkThemeEnabled ? UIColor.ows_dark60Color : UIColor.ows_light60Color);
}
+ (UIColor *)toolbarBackgroundColor
{
return self.navbarBackgroundColor;
}
@end
NS_ASSUME_NONNULL_END

@ -2,24 +2,13 @@
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "Theme.h"
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
#define THEME_ENABLED
#endif
extern NSString *const NSNotificationNameThemeDidChange;
@interface UIColor (OWS)
#pragma mark - Global App Colors
@property (class, readonly, nonatomic) UIColor *ows_navbarBackgroundColor;
@property (class, readonly, nonatomic) UIColor *ows_navbarIconColor;
@property (class, readonly, nonatomic) UIColor *ows_navbarTitleColor;
#pragma mark -
@property (class, readonly, nonatomic) UIColor *ows_systemPrimaryButtonColor;
@ -35,7 +24,6 @@ extern NSString *const NSNotificationNameThemeDidChange;
@property (class, readonly, nonatomic) UIColor *ows_darkIconColor;
@property (class, readonly, nonatomic) UIColor *ows_errorMessageBorderColor;
@property (class, readonly, nonatomic) UIColor *ows_infoMessageBorderColor;
@property (class, readonly, nonatomic) UIColor *ows_toolbarBackgroundColor;
@property (class, readonly, nonatomic) UIColor *ows_messageBubbleLightGrayColor;
+ (UIColor *)colorWithRGBHex:(unsigned long)value;
@ -83,18 +71,6 @@ extern NSString *const NSNotificationNameThemeDidChange;
@property (class, readonly, nonatomic) UIColor *ows_grey600Color;
@property (class, readonly, nonatomic) UIColor *ows_darkSkyBlueColor;
#pragma mark - Theme
+ (BOOL)isThemeEnabled;
#ifdef THEME_ENABLED
+ (void)setIsThemeEnabled:(BOOL)value;
#endif
@property (class, readonly, nonatomic) UIColor *ows_themeBackgroundColor;
@property (class, readonly, nonatomic) UIColor *ows_themePrimaryColor;
@property (class, readonly, nonatomic) UIColor *ows_themeSecondaryColor;
@property (class, readonly, nonatomic) UIColor *ows_themeBoldColor;
@end
NS_ASSUME_NONNULL_END

@ -4,40 +4,12 @@
#import "UIColor+OWS.h"
#import "OWSMath.h"
#import "UIUtil.h"
#import <SignalServiceKit/Cryptography.h>
#import <SignalServiceKit/NSNotificationCenter+OWS.h>
#import <SignalServiceKit/OWSPrimaryStorage.h>
#import <SignalServiceKit/YapDatabaseConnection+OWS.h>
NS_ASSUME_NONNULL_BEGIN
NSString *const NSNotificationNameThemeDidChange = @"NSNotificationNameThemeDidChange";
NSString *const UIColorCollection = @"UIColorCollection";
NSString *const UIColorKeyThemeEnabled = @"UIColorKeyThemeEnabled";
@implementation UIColor (OWS)
#pragma mark - Global App Colors
+ (UIColor *)ows_navbarBackgroundColor
{
return (UIColor.isThemeEnabled ? UIColor.ows_blackColor : UIColor.ows_whiteColor);
}
+ (UIColor *)ows_navbarIconColor
{
// TODO: Theme, Review with design.
return (UIColor.isThemeEnabled ? UIColor.ows_dark60Color : UIColor.ows_light60Color);
}
+ (UIColor *)ows_navbarTitleColor
{
// TODO: Theme, Review with design.
return (UIColor.isThemeEnabled ? UIColor.ows_dark60Color : UIColor.ows_light60Color);
}
#pragma mark -
+ (UIColor *)ows_signalBrandBlueColor
@ -103,11 +75,6 @@ NSString *const UIColorKeyThemeEnabled = @"UIColorKeyThemeEnabled";
return [UIColor colorWithRed:239.f / 255.f green:189.f / 255.f blue:88.f / 255.f alpha:1.0f];
}
+ (UIColor *)ows_toolbarBackgroundColor
{
return self.ows_navbarBackgroundColor;
}
+ (UIColor *)ows_lightBackgroundColor
{
return [UIColor colorWithRed:242.f / 255.f green:242.f / 255.f blue:242.f / 255.f alpha:1.f];
@ -349,59 +316,6 @@ NSString *const UIColorKeyThemeEnabled = @"UIColorKeyThemeEnabled";
return [self.ows_conversationColorMap allKeysForObject:color].firstObject;
}
#pragma mark - Theme
+ (BOOL)isThemeEnabled
{
OWSAssertIsOnMainThread();
#ifdef THEME_ENABLED
return NO;
#else
return [OWSPrimaryStorage.sharedManager.dbReadConnection boolForKey:UIColorKeyThemeEnabled
inCollection:UIColorCollection
defaultValue:NO];
#endif
}
+ (void)setIsThemeEnabled:(BOOL)value
{
OWSAssertIsOnMainThread();
[OWSPrimaryStorage.sharedManager.dbReadWriteConnection setBool:value
forKey:UIColorKeyThemeEnabled
inCollection:UIColorCollection];
[UIUtil setupSignalAppearence];
[[NSNotificationCenter defaultCenter] postNotificationNameAsync:NSNotificationNameThemeDidChange
object:nil
userInfo:nil];
}
+ (UIColor *)ows_themeBackgroundColor
{
return (UIColor.isThemeEnabled ? UIColor.ows_blackColor : UIColor.ows_whiteColor);
}
+ (UIColor *)ows_themePrimaryColor
{
// TODO: Theme, Review with design.
return (UIColor.isThemeEnabled ? UIColor.ows_whiteColor : UIColor.ows_light90Color);
}
+ (UIColor *)ows_themeSecondaryColor
{
// TODO: Theme, Review with design.
return (UIColor.isThemeEnabled ? UIColor.ows_dark60Color : UIColor.ows_light60Color);
}
+ (UIColor *)ows_themeBoldColor
{
// TODO: Review with design.
return (UIColor.isThemeEnabled ? UIColor.ows_whiteColor : UIColor.blackColor);
}
@end
NS_ASSUME_NONNULL_END

@ -76,7 +76,7 @@ NS_ASSUME_NONNULL_BEGIN
UIImage *backImage = [[UIImage imageNamed:(isRTL ? @"NavBarBackRTL" : @"NavBarBack")] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
OWSAssert(backImage);
[backButton setImage:backImage forState:UIControlStateNormal];
backButton.tintColor = UIColor.ows_navbarIconColor;
backButton.tintColor = Theme.navbarIconColor;
backButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;

@ -762,9 +762,9 @@ NSString *const OWSContactsManagerKeyNextFullIntersectionDate = @"OWSContactsMan
UIFont *boldFont = [UIFont ows_mediumFontWithSize:font.pointSize];
NSDictionary<NSString *, id> *boldFontAttributes =
@{ NSFontAttributeName : boldFont, NSForegroundColorAttributeName : [UIColor ows_themeBoldColor] };
@{ NSFontAttributeName : boldFont, NSForegroundColorAttributeName : [Theme boldColor] };
NSDictionary<NSString *, id> *normalFontAttributes =
@{ NSFontAttributeName : font, NSForegroundColorAttributeName : [UIColor ows_themePrimaryColor] };
@{ NSFontAttributeName : font, NSForegroundColorAttributeName : [Theme primaryColor] };
NSDictionary<NSString *, id> *firstNameAttributes
= (self.shouldSortByGivenName ? boldFontAttributes : normalFontAttributes);
NSDictionary<NSString *, id> *lastNameAttributes

@ -55,7 +55,7 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
{
[super loadView];
self.view.backgroundColor = [UIColor ows_themeBackgroundColor];
self.view.backgroundColor = [Theme backgroundColor];
_contactsViewHelper = [[ContactsViewHelper alloc] initWithDelegate:self];
@ -97,7 +97,7 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
[_tableViewController.view autoPinEdgeToSuperviewEdge:ALEdgeBottom];
self.tableViewController.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableViewController.tableView.estimatedRowHeight = 60;
_tableViewController.view.backgroundColor = [UIColor ows_themeBackgroundColor];
_tableViewController.view.backgroundColor = [Theme backgroundColor];
[self updateTableContents];
@ -108,7 +108,7 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
{
UILabel *countryCodeLabel = [UILabel new];
countryCodeLabel.font = [UIFont ows_mediumFontWithSize:18.f];
countryCodeLabel.textColor = [UIColor ows_themePrimaryColor];
countryCodeLabel.textColor = [Theme primaryColor];
countryCodeLabel.text
= NSLocalizedString(@"REGISTRATION_DEFAULT_COUNTRY_NAME", @"Label for the country code field");
return countryCodeLabel;
@ -133,7 +133,7 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
{
UILabel *phoneNumberLabel = [UILabel new];
phoneNumberLabel.font = [UIFont ows_mediumFontWithSize:18.f];
phoneNumberLabel.textColor = [UIColor ows_themePrimaryColor];
phoneNumberLabel.textColor = [Theme primaryColor];
phoneNumberLabel.text
= NSLocalizedString(@"REGISTRATION_PHONENUMBER_BUTTON", @"Label for the phone number textfield");
return phoneNumberLabel;
@ -149,7 +149,7 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
if (!_examplePhoneNumberLabel) {
_examplePhoneNumberLabel = [UILabel new];
_examplePhoneNumberLabel.font = [self examplePhoneNumberFont];
_examplePhoneNumberLabel.textColor = [UIColor ows_themeSecondaryColor];
_examplePhoneNumberLabel.textColor = [Theme secondaryColor];
}
return _examplePhoneNumberLabel;
@ -392,8 +392,8 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
{
BOOL isEnabled = [self hasValidPhoneNumber];
self.phoneNumberButton.enabled = isEnabled;
[self.phoneNumberButton setBackgroundColorsWithUpColor:(isEnabled ? [UIColor ows_signalBrandBlueColor]
: [UIColor ows_themeSecondaryColor])];
[self.phoneNumberButton
setBackgroundColorsWithUpColor:(isEnabled ? [UIColor ows_signalBrandBlueColor] : [Theme secondaryColor])];
}
#pragma mark - CountryCodeViewControllerDelegate

@ -26,12 +26,12 @@
+ (void)setupSignalAppearence
{
UINavigationBar.appearance.barTintColor = UIColor.ows_navbarBackgroundColor;
UINavigationBar.appearance.tintColor = UIColor.ows_navbarIconColor;
UIToolbar.appearance.barTintColor = UIColor.ows_navbarBackgroundColor;
UIToolbar.appearance.tintColor = UIColor.ows_navbarIconColor;
UINavigationBar.appearance.barTintColor = Theme.navbarBackgroundColor;
UINavigationBar.appearance.tintColor = Theme.navbarIconColor;
UIToolbar.appearance.barTintColor = Theme.navbarBackgroundColor;
UIToolbar.appearance.tintColor = Theme.navbarIconColor;
UIBarButtonItem.appearance.tintColor = UIColor.ows_navbarIconColor;
UIBarButtonItem.appearance.tintColor = Theme.navbarIconColor;
// [[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil] setTintColor:[UIColor
// ows_materialBlueColor]];
@ -40,7 +40,7 @@
[[UIToolbar appearance] setTintColor:[UIColor ows_materialBlueColor]];
// If we set NSShadowAttributeName, the NSForegroundColorAttributeName value is ignored.
UINavigationBar.appearance.titleTextAttributes = @{ NSForegroundColorAttributeName : UIColor.ows_navbarTitleColor };
UINavigationBar.appearance.titleTextAttributes = @{ NSForegroundColorAttributeName : Theme.navbarTitleColor };
}
@end

Loading…
Cancel
Save