diff --git a/Signal/src/ViewControllers/HomeView/HomeViewCell.m b/Signal/src/ViewControllers/HomeView/HomeViewCell.m index 0f8326378..bde7dd8ba 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewCell.m +++ b/Signal/src/ViewControllers/HomeView/HomeViewCell.m @@ -66,8 +66,7 @@ NS_ASSUME_NONNULL_BEGIN _viewConstraints = [NSMutableArray new]; UIView *selectedBackgroundView = [UIView new]; - selectedBackgroundView.backgroundColor = [( - Theme.isDarkThemeEnabled ? [UIColor ows_whiteColor] : [UIColor ows_blackColor]) colorWithAlphaComponent:0.08f]; + selectedBackgroundView.backgroundColor = [Theme.cellSelectedColor colorWithAlphaComponent:0.08f]; self.selectedBackgroundView = selectedBackgroundView; diff --git a/Signal/src/ViewControllers/HomeView/HomeViewController.m b/Signal/src/ViewControllers/HomeView/HomeViewController.m index a7a9f2aee..81719972c 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewController.m +++ b/Signal/src/ViewControllers/HomeView/HomeViewController.m @@ -384,11 +384,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations searchBar.placeholder = NSLocalizedString(@"HOME_VIEW_CONVERSATION_SEARCHBAR_PLACEHOLDER", @"Placeholder text for search bar which filters conversations."); searchBar.backgroundColor = Theme.backgroundColor; - if (Theme.isDarkThemeEnabled) { - searchBar.barStyle = UIBarStyleBlack; - } else { - searchBar.barStyle = UIBarStyleDefault; - } + searchBar.barStyle = Theme.barStyle; searchBar.delegate = self; [searchBar sizeToFit]; diff --git a/Signal/src/ViewControllers/NewContactThreadViewController.m b/Signal/src/ViewControllers/NewContactThreadViewController.m index 1eb2636f4..d7c53557f 100644 --- a/Signal/src/ViewControllers/NewContactThreadViewController.m +++ b/Signal/src/ViewControllers/NewContactThreadViewController.m @@ -103,11 +103,7 @@ NS_ASSUME_NONNULL_BEGIN searchBar.delegate = self; searchBar.placeholder = NSLocalizedString(@"SEARCH_BYNAMEORNUMBER_PLACEHOLDER_TEXT", @""); searchBar.backgroundColor = [Theme backgroundColor]; - if (Theme.isDarkThemeEnabled) { - searchBar.barStyle = UIBarStyleBlack; - } else { - searchBar.barStyle = UIBarStyleDefault; - } + searchBar.barStyle = Theme.barStyle; [searchBar sizeToFit]; _tableViewController = [OWSTableViewController new]; diff --git a/SignalMessaging/ViewControllers/OWSTableViewController.m b/SignalMessaging/ViewControllers/OWSTableViewController.m index fc3cee347..ab193480c 100644 --- a/SignalMessaging/ViewControllers/OWSTableViewController.m +++ b/SignalMessaging/ViewControllers/OWSTableViewController.m @@ -112,8 +112,7 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f; cell.textLabel.textColor = [Theme primaryColor]; UIView *selectedBackgroundView = [UIView new]; - selectedBackgroundView.backgroundColor = - [(Theme.isDarkThemeEnabled ? [UIColor ows_whiteColor] : [UIColor ows_blackColor]) colorWithAlphaComponent:0.08]; + selectedBackgroundView.backgroundColor = [Theme.cellSelectedColor colorWithAlphaComponent:0.08]; cell.selectedBackgroundView = selectedBackgroundView; } diff --git a/SignalMessaging/categories/Theme.h b/SignalMessaging/categories/Theme.h index 02f92ff50..6b88777e4 100644 --- a/SignalMessaging/categories/Theme.h +++ b/SignalMessaging/categories/Theme.h @@ -34,6 +34,12 @@ extern NSString *const NSNotificationNameThemeDidChange; @property (class, readonly, nonatomic) UIColor *toolbarBackgroundColor; ++ (UIColor *)cellSelectedColor; + +#pragma mark - + ++ (UIBarStyle)barStyle; + @end NS_ASSUME_NONNULL_END diff --git a/SignalMessaging/categories/Theme.m b/SignalMessaging/categories/Theme.m index 492dece68..9a2fb9eb9 100644 --- a/SignalMessaging/categories/Theme.m +++ b/SignalMessaging/categories/Theme.m @@ -93,6 +93,21 @@ NSString *const ThemeKeyThemeEnabled = @"ThemeKeyThemeEnabled"; return self.navbarBackgroundColor; } ++ (UIColor *)cellSelectedColor +{ + return (Theme.isDarkThemeEnabled ? UIColor.ows_whiteColor : UIColor.ows_blackColor); +} + +#pragma mark - + ++ (UIBarStyle)barStyle +{ + if (Theme.isDarkThemeEnabled) { + return UIBarStyleBlack; + } else { + return UIBarStyleDefault; + } +} @end NS_ASSUME_NONNULL_END