diff --git a/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m b/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m index 2ed47ddf8..225fb3bf1 100644 --- a/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m +++ b/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m @@ -137,39 +137,38 @@ [weakSelf showAdvanced]; }]]; } else { - [section addItem:[OWSTableItem itemWithCustomCellBlock:^{ - UITableViewCell *cell = [UITableViewCell new]; - cell.textLabel.text = NSLocalizedString(@"NETWORK_STATUS_HEADER", @""); - cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f]; - cell.textLabel.textColor = [UIColor blackColor]; - cell.selectionStyle = UITableViewCellSelectionStyleNone; - UILabel *accessoryLabel = [UILabel new]; - accessoryLabel.font = [UIFont ows_regularFontWithSize:18.f]; - if (TSAccountManager.sharedInstance.isDeregistered) { - accessoryLabel.text = NSLocalizedString( - @"NETWORK_STATUS_DEREGISTERED", @"Error indicating that this device is no longer registered."); - accessoryLabel.textColor = [UIColor ows_redColor]; - } else { - switch ([TSSocketManager sharedManager].state) { - case SocketManagerStateClosed: - accessoryLabel.text = NSLocalizedString(@"NETWORK_STATUS_OFFLINE", @""); - accessoryLabel.textColor = [UIColor ows_redColor]; - break; - case SocketManagerStateConnecting: - accessoryLabel.text = NSLocalizedString(@"NETWORK_STATUS_CONNECTING", @""); - accessoryLabel.textColor = [UIColor ows_yellowColor]; - break; - case SocketManagerStateOpen: - accessoryLabel.text = NSLocalizedString(@"NETWORK_STATUS_CONNECTED", @""); - accessoryLabel.textColor = [UIColor ows_greenColor]; - break; - } - } - [accessoryLabel sizeToFit]; - cell.accessoryView = accessoryLabel; - return cell; - } - actionBlock:nil]]; + [section addItem:[OWSTableItem + itemWithCustomCellBlock:^{ + UITableViewCell *cell = [OWSTableItem newCell]; + cell.textLabel.text = NSLocalizedString(@"NETWORK_STATUS_HEADER", @""); + cell.selectionStyle = UITableViewCellSelectionStyleNone; + UILabel *accessoryLabel = [UILabel new]; + accessoryLabel.font = [UIFont ows_regularFontWithSize:18.f]; + if (TSAccountManager.sharedInstance.isDeregistered) { + accessoryLabel.text = NSLocalizedString(@"NETWORK_STATUS_DEREGISTERED", + @"Error indicating that this device is no longer registered."); + accessoryLabel.textColor = [UIColor ows_redColor]; + } else { + switch ([TSSocketManager sharedManager].state) { + case SocketManagerStateClosed: + accessoryLabel.text = NSLocalizedString(@"NETWORK_STATUS_OFFLINE", @""); + accessoryLabel.textColor = [UIColor ows_redColor]; + break; + case SocketManagerStateConnecting: + accessoryLabel.text = NSLocalizedString(@"NETWORK_STATUS_CONNECTING", @""); + accessoryLabel.textColor = [UIColor ows_yellowColor]; + break; + case SocketManagerStateOpen: + accessoryLabel.text = NSLocalizedString(@"NETWORK_STATUS_CONNECTED", @""); + accessoryLabel.textColor = [UIColor ows_greenColor]; + break; + } + } + [accessoryLabel sizeToFit]; + cell.accessoryView = accessoryLabel; + return cell; + } + actionBlock:nil]]; } [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_INVITE_TITLE", @@ -251,7 +250,7 @@ { return [OWSTableItem itemWithCustomCellBlock:^{ - UITableViewCell *cell = [UITableViewCell new]; + UITableViewCell *cell = [OWSTableItem newCell]; cell.preservesSuperviewLayoutMargins = YES; cell.contentView.preservesSuperviewLayoutMargins = YES; cell.selectionStyle = UITableViewCellSelectionStyleNone; @@ -276,7 +275,7 @@ - (UITableViewCell *)profileHeaderCell { - UITableViewCell *cell = [UITableViewCell new]; + UITableViewCell *cell = [OWSTableItem newCell]; cell.preservesSuperviewLayoutMargins = YES; cell.contentView.preservesSuperviewLayoutMargins = YES; cell.selectionStyle = UITableViewCellSelectionStyleNone; @@ -316,7 +315,7 @@ NSString *_Nullable localProfileName = [OWSProfileManager.sharedManager localProfileName]; if (localProfileName.length > 0) { titleLabel.text = localProfileName; - titleLabel.textColor = [UIColor blackColor]; + titleLabel.textColor = [UIColor ows_themeForegroundColor]; titleLabel.font = [UIFont ows_dynamicTypeTitle2Font]; } else { titleLabel.text = NSLocalizedString( @@ -331,7 +330,7 @@ const CGFloat kSubtitlePointSize = 12.f; UILabel *subtitleLabel = [UILabel new]; - subtitleLabel.textColor = [UIColor ows_darkGrayColor]; + subtitleLabel.textColor = [UIColor ows_themeSecondaryColor]; subtitleLabel.font = [UIFont ows_regularFontWithSize:kSubtitlePointSize]; subtitleLabel.attributedText = [[NSAttributedString alloc] initWithString:[PhoneNumber bestEffortFormatPartialUserSpecifiedTextToLookLikeAPhoneNumber:[TSAccountManager diff --git a/Signal/src/ViewControllers/HomeView/HomeViewCell.m b/Signal/src/ViewControllers/HomeView/HomeViewCell.m index 40f3f4545..5dc1246e8 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewCell.m +++ b/Signal/src/ViewControllers/HomeView/HomeViewCell.m @@ -61,12 +61,13 @@ NS_ASSUME_NONNULL_BEGIN { OWSAssert(!self.avatarView); - self.backgroundColor = [UIColor whiteColor]; + self.backgroundColor = UIColor.ows_themeBackgroundColor; _viewConstraints = [NSMutableArray new]; UIView *selectedBackgroundView = [UIView new]; - selectedBackgroundView.backgroundColor = [[UIColor colorWithRGBHex:0x000000] colorWithAlphaComponent:0.08]; + selectedBackgroundView.backgroundColor = + [(UIColor.isThemeEnabled ? [UIColor ows_whiteColor] : [UIColor ows_blackColor]) colorWithAlphaComponent:0.08]; self.selectedBackgroundView = selectedBackgroundView; @@ -225,9 +226,9 @@ NS_ASSUME_NONNULL_BEGIN self.dateTimeLabel.text = (overrideDate ? [self stringForDate:overrideDate] : [self stringForDate:thread.lastMessageDate]); - UIColor *textColor = [UIColor ows_light60Color]; + UIColor *textColor = [UIColor ows_themeSecondaryColor]; if (hasUnreadMessages && overrideSnippet == nil) { - textColor = [UIColor ows_light90Color]; + textColor = [UIColor ows_themeForegroundColor]; self.dateTimeLabel.font = self.dateTimeFont.ows_mediumWeight; } else { self.dateTimeLabel.font = self.dateTimeFont; @@ -273,7 +274,9 @@ NS_ASSUME_NONNULL_BEGIN }]; } else { UIImage *_Nullable statusIndicatorImage = nil; - UIColor *messageStatusViewTintColor = [UIColor ows_light35Color]; + // TODO: Theme, Review with design. + UIColor *messageStatusViewTintColor + = (UIColor.isThemeEnabled ? [UIColor ows_dark30Color] : [UIColor ows_light35Color]); BOOL shouldAnimateStatusIcon = NO; if ([self.thread.lastMessageForInbox isKindOfClass:[TSOutgoingMessage class]]) { TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)self.thread.lastMessageForInbox; @@ -363,7 +366,7 @@ NS_ASSUME_NONNULL_BEGIN @"A label for conversations with blocked users.") attributes:@{ NSFontAttributeName : self.snippetFont.ows_mediumWeight, - NSForegroundColorAttributeName : [UIColor ows_light90Color], + NSForegroundColorAttributeName : [UIColor ows_themeForegroundColor], }]]; } else { if ([thread isMuted]) { @@ -371,9 +374,9 @@ NS_ASSUME_NONNULL_BEGIN initWithString:@"\ue067 " attributes:@{ NSFontAttributeName : [UIFont ows_elegantIconsFont:9.f], - NSForegroundColorAttributeName : (hasUnreadMessages - ? [UIColor colorWithWhite:0.1f alpha:1.f] - : [UIColor ows_light60Color]), + NSForegroundColorAttributeName : + (hasUnreadMessages ? [UIColor ows_themeForegroundColor] + : [UIColor ows_themeSecondaryColor]), }]]; } NSString *displayableText = thread.lastMessageText; @@ -385,8 +388,8 @@ NS_ASSUME_NONNULL_BEGIN (hasUnreadMessages ? self.snippetFont.ows_mediumWeight : self.snippetFont), NSForegroundColorAttributeName : - (hasUnreadMessages ? [UIColor ows_light90Color] - : [UIColor ows_light60Color]), + (hasUnreadMessages ? [UIColor ows_themeForegroundColor] + : [UIColor ows_themeSecondaryColor]), }]]; } } @@ -488,6 +491,7 @@ NS_ASSUME_NONNULL_BEGIN OWSAssertIsOnMainThread(); self.nameLabel.font = self.nameFont; + self.nameLabel.textColor = [UIColor ows_themeForegroundColor]; ThreadViewModel *thread = self.thread; if (thread == nil) { diff --git a/Signal/src/ViewControllers/HomeView/HomeViewController.m b/Signal/src/ViewControllers/HomeView/HomeViewController.m index c2dbe5e0d..2d2fe06c6 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewController.m +++ b/Signal/src/ViewControllers/HomeView/HomeViewController.m @@ -172,6 +172,10 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations selector:@selector(outageStateDidChange:) name:OutageDetection.outageStateDidChange object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(themeDidChange:) + name:NSNotificationNameThemeDidChange + object:nil]; } - (void)dealloc @@ -211,14 +215,30 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations [self updateReminderViews]; } +#pragma mark - Theme + +- (void)themeDidChange:(id)notification +{ + OWSAssertIsOnMainThread(); + + [self applyTheme]; + [self.tableView reloadData]; +} + +- (void)applyTheme +{ + OWSAssertIsOnMainThread(); + + self.view.backgroundColor = UIColor.ows_themeBackgroundColor; + self.tableView.backgroundColor = UIColor.ows_themeBackgroundColor; +} + #pragma mark - View Life Cycle - (void)loadView { [super loadView]; - self.view.backgroundColor = [UIColor whiteColor]; - // TODO: Remove this. if (self.homeViewMode == HomeViewMode_Inbox) { [SignalApp.sharedApp setHomeViewController:self]; @@ -308,6 +328,8 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations [self.tableView insertSubview:pullToRefreshView atIndex:0]; [self updateReminderViews]; + + [self applyTheme]; } - (void)updateReminderViews @@ -359,7 +381,13 @@ 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 whiteColor]; + searchBar.backgroundColor = UIColor.ows_themeBackgroundColor; + if (UIColor.isThemeEnabled) { + searchBar.barStyle = UIBarStyleBlack; + } else { + searchBar.barStyle = UIBarStyleDefault; + } + searchBar.delegate = self; [searchBar sizeToFit]; @@ -808,7 +836,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations [subview removeFromSuperview]; } - cell.backgroundColor = [UIColor whiteColor]; + cell.backgroundColor = UIColor.ows_themeBackgroundColor; UIImage *disclosureImage = [UIImage imageNamed:(CurrentAppContext().isRTL ? @"NavBarBack" : @"NavBarBackRTL")]; OWSAssert(disclosureImage); @@ -822,7 +850,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 blackColor]; + label.textColor = UIColor.ows_themeForegroundColor; UIStackView *stackView = [UIStackView new]; stackView.axis = UILayoutConstraintAxisHorizontal; @@ -1411,6 +1439,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations - (void)updateEmptyBoxText { + // TODO: Theme, review with design. _emptyBoxLabel.textColor = [UIColor grayColor]; _emptyBoxLabel.font = [UIFont ows_regularFontWithSize:18.f]; _emptyBoxLabel.textAlignment = NSTextAlignmentCenter; @@ -1448,10 +1477,11 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations value:[UIFont ows_regularFontWithSize:14.f] range:NSMakeRange(firstLine.length + 1, secondLine.length)]; [fullLabelString addAttribute:NSForegroundColorAttributeName - value:[UIColor blackColor] + value:UIColor.ows_themeForegroundColor range:NSMakeRange(0, firstLine.length)]; + // TODO: Theme, Review with design. [fullLabelString addAttribute:NSForegroundColorAttributeName - value:[UIColor ows_darkGrayColor] + value:UIColor.ows_themeSecondaryColor range:NSMakeRange(firstLine.length + 1, secondLine.length)]; _emptyBoxLabel.attributedText = fullLabelString; } diff --git a/SignalMessaging/ViewControllers/OWSNavigationController.m b/SignalMessaging/ViewControllers/OWSNavigationController.m index 7f3fe0d28..bd38547ee 100644 --- a/SignalMessaging/ViewControllers/OWSNavigationController.m +++ b/SignalMessaging/ViewControllers/OWSNavigationController.m @@ -121,7 +121,7 @@ NS_ASSUME_NONNULL_BEGIN // Status bar is overlaying the green "call banner" return UIStatusBarStyleLightContent; } else { - return super.preferredStatusBarStyle; + return (UIColor.isThemeEnabled ? UIStatusBarStyleLightContent : super.preferredStatusBarStyle); } } diff --git a/SignalMessaging/ViewControllers/OWSTableViewController.h b/SignalMessaging/ViewControllers/OWSTableViewController.h index 85d8b31dc..0aa07dd34 100644 --- a/SignalMessaging/ViewControllers/OWSTableViewController.h +++ b/SignalMessaging/ViewControllers/OWSTableViewController.h @@ -52,6 +52,8 @@ typedef UITableViewCell *_Nonnull (^OWSTableCustomCellBlock)(void); @property (nonatomic, weak) UIViewController *tableViewController; ++ (UITableViewCell *)newCell; + + (OWSTableItem *)itemWithTitle:(NSString *)title actionBlock:(nullable OWSTableActionBlock)actionBlock; + (OWSTableItem *)itemWithCustomCell:(UITableViewCell *)customCell diff --git a/SignalMessaging/ViewControllers/OWSTableViewController.m b/SignalMessaging/ViewControllers/OWSTableViewController.m index 624160eb9..ae43fb1ec 100644 --- a/SignalMessaging/ViewControllers/OWSTableViewController.m +++ b/SignalMessaging/ViewControllers/OWSTableViewController.m @@ -4,6 +4,7 @@ #import "OWSTableViewController.h" #import "OWSNavigationController.h" +#import "UIColor+OWS.h" #import "UIFont+OWS.h" #import "UIView+OWS.h" @@ -97,6 +98,15 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f; @implementation OWSTableItem ++ (UITableViewCell *)newCell +{ + UITableViewCell *cell = [UITableViewCell new]; + cell.backgroundColor = [UIColor ows_themeBackgroundColor]; + cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f]; + cell.textLabel.textColor = [UIColor ows_themeForegroundColor]; + return cell; +} + + (OWSTableItem *)itemWithTitle:(NSString *)title actionBlock:(nullable OWSTableActionBlock)actionBlock { OWSAssert(title.length > 0); @@ -163,10 +173,8 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f; OWSTableItem *item = [OWSTableItem new]; item.actionBlock = actionBlock; item.customCellBlock = ^{ - UITableViewCell *cell = [UITableViewCell new]; + UITableViewCell *cell = [OWSTableItem newCell]; cell.textLabel.text = text; - cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f]; - cell.textLabel.textColor = [UIColor blackColor]; cell.accessoryType = accessoryType; return cell; }; @@ -198,7 +206,7 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f; reuseIdentifier:@"UITableViewCellStyleValue1"]; cell.textLabel.text = text; cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f]; - cell.textLabel.textColor = [UIColor blackColor]; + cell.textLabel.textColor = [UIColor ows_themeForegroundColor]; cell.detailTextLabel.text = detailText; [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator]; return cell; @@ -223,10 +231,8 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f; } }; item.customCellBlock = ^{ - UITableViewCell *cell = [UITableViewCell new]; + UITableViewCell *cell = [OWSTableItem newCell]; cell.textLabel.text = text; - cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f]; - cell.textLabel.textColor = [UIColor blackColor]; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; return cell; }; @@ -252,10 +258,8 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f; OWSTableItem *item = [OWSTableItem new]; item.actionBlock = actionBlock; item.customCellBlock = ^{ - UITableViewCell *cell = [UITableViewCell new]; + UITableViewCell *cell = [OWSTableItem newCell]; cell.textLabel.text = text; - cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f]; - cell.textLabel.textColor = [UIColor blackColor]; return cell; }; return item; @@ -267,13 +271,14 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f; OWSTableItem *item = [OWSTableItem new]; item.customCellBlock = ^{ - UITableViewCell *cell = [UITableViewCell new]; + UITableViewCell *cell = [OWSTableItem newCell]; cell.textLabel.text = text; // These cells look quite different. // // Smaller font. cell.textLabel.font = [UIFont ows_regularFontWithSize:15.f]; // Soft color. + // TODO: Theme, review with design. cell.textLabel.textColor = [UIColor colorWithWhite:0.5f alpha:1.f]; // Centered. cell.textLabel.textAlignment = NSTextAlignmentCenter; @@ -298,10 +303,8 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f; OWSTableItem *item = [OWSTableItem new]; item.customCellBlock = ^{ - UITableViewCell *cell = [UITableViewCell new]; + UITableViewCell *cell = [OWSTableItem newCell]; cell.textLabel.text = text; - cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f]; - cell.textLabel.textColor = [UIColor blackColor]; cell.userInteractionEnabled = NO; return cell; }; @@ -315,14 +318,12 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f; OWSTableItem *item = [OWSTableItem new]; item.customCellBlock = ^{ - UITableViewCell *cell = [UITableViewCell new]; + UITableViewCell *cell = [OWSTableItem newCell]; cell.textLabel.text = text; - cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f]; - cell.textLabel.textColor = [UIColor blackColor]; UILabel *accessoryLabel = [UILabel new]; accessoryLabel.text = accessoryText; - accessoryLabel.textColor = [UIColor lightGrayColor]; + accessoryLabel.textColor = [UIColor ows_themeSecondaryColor]; accessoryLabel.font = [UIFont ows_regularFontWithSize:16.0f]; accessoryLabel.textAlignment = NSTextAlignmentRight; [accessoryLabel sizeToFit]; @@ -352,10 +353,8 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f; OWSTableItem *item = [OWSTableItem new]; __weak id weakTarget = target; item.customCellBlock = ^{ - UITableViewCell *cell = [UITableViewCell new]; + UITableViewCell *cell = [OWSTableItem newCell]; cell.textLabel.text = text; - cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f]; - cell.textLabel.textColor = [UIColor blackColor]; UISwitch *cellSwitch = [UISwitch new]; cell.accessoryView = cellSwitch; @@ -460,6 +459,18 @@ NSString *const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier"; [self.tableView autoPinEdgesToSuperviewEdges]; [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kOWSTableCellIdentifier]; + + [self applyTheme]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(themeDidChange:) + name:NSNotificationNameThemeDidChange + object:nil]; +} + +- (void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; } - (void)viewWillAppear:(BOOL)animated @@ -672,6 +683,24 @@ NSString *const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier"; [self.delegate tableViewWillBeginDragging]; } +#pragma mark - Theme + +- (void)themeDidChange:(id)notification +{ + OWSAssertIsOnMainThread(); + + [self applyTheme]; + [self.tableView reloadData]; +} + +- (void)applyTheme +{ + OWSAssertIsOnMainThread(); + + self.view.backgroundColor = UIColor.ows_themeBackgroundColor; + self.tableView.backgroundColor = UIColor.ows_themeBackgroundColor; +} + @end NS_ASSUME_NONNULL_END diff --git a/SignalMessaging/categories/UIColor+OWS.h b/SignalMessaging/categories/UIColor+OWS.h index c51cf85b7..236aad6e5 100644 --- a/SignalMessaging/categories/UIColor+OWS.h +++ b/SignalMessaging/categories/UIColor+OWS.h @@ -10,6 +10,8 @@ NS_ASSUME_NONNULL_BEGIN #define THEME_ENABLED #endif +extern NSString *const NSNotificationNameThemeDidChange; + @interface UIColor (OWS) #pragma mark - Global App Colors @@ -88,6 +90,10 @@ NS_ASSUME_NONNULL_BEGIN + (void)setIsThemeEnabled:(BOOL)value; #endif ++ (UIColor *)ows_themeBackgroundColor; ++ (UIColor *)ows_themeForegroundColor; ++ (UIColor *)ows_themeSecondaryColor; + @end NS_ASSUME_NONNULL_END diff --git a/SignalMessaging/categories/UIColor+OWS.m b/SignalMessaging/categories/UIColor+OWS.m index 3b6e0e7da..6f92a6fa4 100644 --- a/SignalMessaging/categories/UIColor+OWS.m +++ b/SignalMessaging/categories/UIColor+OWS.m @@ -4,12 +4,16 @@ #import "OWSMath.h" #import "UIColor+OWS.h" +#import "UIUtil.h" #import +#import #import #import NS_ASSUME_NONNULL_BEGIN +NSString *const NSNotificationNameThemeDidChange = @"NSNotificationNameThemeDidChange"; + NSString *const UIColorCollection = @"UIColorCollection"; NSString *const UIColorKeyThemeEnabled = @"UIColorKeyThemeEnabled"; @@ -19,17 +23,19 @@ NSString *const UIColorKeyThemeEnabled = @"UIColorKeyThemeEnabled"; + (UIColor *)ows_navbarBackgroundColor { - return UIColor.ows_whiteColor; + return (UIColor.isThemeEnabled ? UIColor.ows_blackColor : UIColor.ows_whiteColor); } + (UIColor *)ows_navbarIconColor { - return UIColor.ows_light60Color; + // TODO: Theme, Review with design. + return (UIColor.isThemeEnabled ? UIColor.ows_dark60Color : UIColor.ows_light60Color); } + (UIColor *)ows_navbarTitleColor { - return UIColor.ows_light90Color; + // TODO: Theme, Review with design. + return (UIColor.isThemeEnabled ? UIColor.ows_dark60Color : UIColor.ows_light60Color); } #pragma mark - @@ -361,6 +367,29 @@ NSString *const UIColorKeyThemeEnabled = @"UIColorKeyThemeEnabled"; [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_themeForegroundColor +{ + // 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); } @end diff --git a/SignalServiceKit/src/Messages/OWSBlockingManager.m b/SignalServiceKit/src/Messages/OWSBlockingManager.m index ed96ae7ba..18151ae82 100644 --- a/SignalServiceKit/src/Messages/OWSBlockingManager.m +++ b/SignalServiceKit/src/Messages/OWSBlockingManager.m @@ -15,7 +15,6 @@ NS_ASSUME_NONNULL_BEGIN NSString *const kNSNotificationName_BlockedPhoneNumbersDidChange = @"kNSNotificationName_BlockedPhoneNumbersDidChange"; -extern NSString *const kNSNotificationName_BlockedPhoneNumbersDidChange; NSString *const kOWSBlockingManager_BlockedPhoneNumbersCollection = @"kOWSBlockingManager_BlockedPhoneNumbersCollection"; // This key is used to persist the current "blocked phone numbers" state.