Merge branch 'charlesmchen/refineTheme'

pull/1/head
Matthew Chen 7 years ago
commit e602cf55a0

@ -148,6 +148,8 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
super.init(nibName: nil, bundle: nil)
allAudioSources = Set(callUIAdapter.audioService.availableInputs)
self.shouldUseTheme = false
}
deinit {

@ -96,6 +96,11 @@ public class ContactsPicker: OWSViewController, UITableViewDelegate, UITableView
override open func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = Theme.backgroundColor
self.tableView.backgroundColor = Theme.backgroundColor
self.searchBar.backgroundColor = Theme.backgroundColor
self.searchBar.barStyle = Theme.barStyle()
searchBar.placeholder = NSLocalizedString("INVITE_FRIENDS_PICKER_SEARCHBAR_PLACEHOLDER", comment: "Search")
// Prevent content from going under the navigation bar
self.edgesForExtendedLayout = []

@ -46,7 +46,6 @@ NS_ASSUME_NONNULL_BEGIN
self.layoutConstraints = @[];
self.titleLabel = [UILabel new];
self.titleLabel.textColor = [UIColor ows_light60Color];
self.titleLabel.text = NSLocalizedString(@"CONVERSATION_VIEW_CONTACTS_OFFER_TITLE",
@"Title for the group of buttons show for unknown contacts offering to add them to contacts, etc.");
self.titleLabel.lineBreakMode = NSLineBreakByTruncatingTail;
@ -98,9 +97,7 @@ NS_ASSUME_NONNULL_BEGIN
{
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:title forState:UIControlStateNormal];
[button setTitleColor:[UIColor ows_signalBlueColor] forState:UIControlStateNormal];
button.titleLabel.textAlignment = NSTextAlignmentCenter;
[button setBackgroundColor:[UIColor ows_light02Color]];
button.layer.cornerRadius = 4.f;
[button addTarget:self action:selector forControlEvents:UIControlEventTouchUpInside];
return button;
@ -118,8 +115,20 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(self.viewItem);
OWSAssert([self.viewItem.interaction isKindOfClass:[OWSContactOffersInteraction class]]);
self.backgroundColor = [Theme backgroundColor];
[self configureFonts];
self.titleLabel.textColor = Theme.secondaryColor;
for (UIButton *button in @[
self.addToContactsButton,
self.addToProfileWhitelistButton,
self.blockButton,
]) {
[button setTitleColor:[UIColor ows_signalBlueColor] forState:UIControlStateNormal];
[button setBackgroundColor:Theme.conversationButtonBackgroundColor];
}
OWSContactOffersInteraction *interaction = (OWSContactOffersInteraction *)self.viewItem.interaction;
OWSAssert(

@ -113,7 +113,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert([OWSContactShareButtonsView hasAnyButton:self.contactShare contactsManager:self.contactsManager]);
self.layoutMargins = UIEdgeInsetsZero;
self.backgroundColor = [UIColor ows_light02Color];
self.backgroundColor = Theme.conversationButtonBackgroundColor;
UILabel *label = [UILabel new];
self.buttonView = label;

@ -510,7 +510,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(buttonsView.backgroundColor);
shadowView.fillColor = buttonsView.backgroundColor;
shadowView.layer.shadowColor = [UIColor blackColor].CGColor;
shadowView.layer.shadowColor = Theme.boldColor.CGColor;
shadowView.layer.shadowOpacity = 0.12f;
shadowView.layer.shadowOffset = CGSizeZero;
shadowView.layer.shadowRadius = 1.f;

@ -53,12 +53,10 @@ const CGFloat OWSMessageHeaderViewDateHeaderVMargin = 23;
[self.strokeView setContentHuggingHigh];
self.titleLabel = [UILabel new];
self.titleLabel.textColor = [UIColor ows_light90Color];
self.titleLabel.textAlignment = NSTextAlignmentCenter;
self.titleLabel.lineBreakMode = NSLineBreakByTruncatingTail;
self.subtitleLabel = [UILabel new];
self.subtitleLabel.textColor = [UIColor ows_light90Color];
// The subtitle may wrap to a second line.
self.subtitleLabel.numberOfLines = 0;
self.subtitleLabel.lineBreakMode = NSLineBreakByWordWrapping;
@ -81,6 +79,9 @@ const CGFloat OWSMessageHeaderViewDateHeaderVMargin = 23;
OWSAssert(conversationStyle);
OWSAssert(viewItem.unreadIndicator || viewItem.shouldShowDate);
self.titleLabel.textColor = Theme.primaryColor;
self.subtitleLabel.textColor = Theme.primaryColor;
[self configureLabelsWithViewItem:viewItem];
CGFloat strokeThickness = [self strokeThicknessWithViewItem:viewItem];
@ -115,9 +116,9 @@ const CGFloat OWSMessageHeaderViewDateHeaderVMargin = 23;
OWSAssert(viewItem);
if (viewItem.unreadIndicator) {
return UIColor.ows_light60Color;
return (Theme.isDarkThemeEnabled ? UIColor.ows_dark60Color : UIColor.ows_light60Color);
} else {
return UIColor.ows_light45Color;
return (Theme.isDarkThemeEnabled ? UIColor.ows_dark30Color : UIColor.ows_light45Color);
}
}

@ -49,6 +49,7 @@ typedef void (^SystemMessageActionBlock)(void);
@property (nonatomic) UILabel *titleLabel;
@property (nonatomic) UIButton *button;
@property (nonatomic) UIStackView *vStackView;
@property (nonatomic) UIView *cellBackgroundView;
@property (nonatomic) OWSMessageHeaderView *headerView;
@property (nonatomic) NSLayoutConstraint *headerViewHeightConstraint;
@property (nonatomic) NSArray<NSLayoutConstraint *> *layoutConstraints;
@ -76,7 +77,6 @@ typedef void (^SystemMessageActionBlock)(void);
self.layoutMargins = UIEdgeInsetsZero;
self.contentView.layoutMargins = UIEdgeInsetsZero;
self.contentView.backgroundColor = UIColor.whiteColor;
self.layoutConstraints = @[];
self.headerView = [OWSMessageHeaderView new];
@ -103,7 +103,6 @@ typedef void (^SystemMessageActionBlock)(void);
self.button = [UIButton buttonWithType:UIButtonTypeCustom];
[self.button setTitleColor:[UIColor ows_darkSkyBlueColor] forState:UIControlStateNormal];
self.button.titleLabel.textAlignment = NSTextAlignmentCenter;
[self.button setBackgroundColor:[UIColor ows_light02Color]];
self.button.layer.cornerRadius = 4.f;
[self.button addTarget:self action:@selector(buttonWasPressed:) forControlEvents:UIControlEventTouchUpInside];
[self.button autoSetDimension:ALDimensionHeight toSize:self.buttonHeight];
@ -117,6 +116,10 @@ typedef void (^SystemMessageActionBlock)(void);
self.vStackView.alignment = UIStackViewAlignmentCenter;
self.vStackView.layoutMarginsRelativeArrangement = YES;
self.cellBackgroundView = [UIView new];
self.cellBackgroundView.layer.cornerRadius = 5.f;
[self.contentView addSubview:self.cellBackgroundView];
UIStackView *cellStackView = [[UIStackView alloc] initWithArrangedSubviews:@[ self.headerView, self.vStackView ]];
cellStackView.axis = UILayoutConstraintAxisVertical;
[self.contentView addSubview:cellStackView];
@ -164,6 +167,10 @@ typedef void (^SystemMessageActionBlock)(void);
OWSAssert(self.viewItem);
OWSAssert(transaction);
self.cellBackgroundView.backgroundColor = [Theme backgroundColor];
[self.button setBackgroundColor:Theme.conversationButtonBackgroundColor];
TSInteraction *interaction = self.viewItem.interaction;
self.action = [self actionForInteraction:interaction];
@ -213,20 +220,28 @@ typedef void (^SystemMessageActionBlock)(void);
self.layoutConstraints = @[
[self.titleLabel autoSetDimension:ALDimensionWidth toSize:titleSize.width],
[self.button autoSetDimension:ALDimensionWidth toSize:buttonSize.width + self.buttonHPadding * 2.f]
[self.button autoSetDimension:ALDimensionWidth toSize:buttonSize.width + self.buttonHPadding * 2.f],
[self.cellBackgroundView autoPinEdge:ALEdgeTop toEdge:ALEdgeTop ofView:self.vStackView],
[self.cellBackgroundView autoPinEdge:ALEdgeBottom toEdge:ALEdgeBottom ofView:self.vStackView],
// Text in vStackView might flow right up to the edges, so only use half the gutter.
[self.cellBackgroundView autoPinEdgeToSuperviewEdge:ALEdgeLeading
withInset:self.conversationStyle.fullWidthGutterLeading * 0.5f],
[self.cellBackgroundView autoPinEdgeToSuperviewEdge:ALEdgeTrailing
withInset:self.conversationStyle.fullWidthGutterTrailing * 0.5f],
];
}
- (UIColor *)textColor
{
return [UIColor ows_light60Color];
return Theme.secondaryColor;
}
- (UIColor *)iconColorForInteraction:(TSInteraction *)interaction
{
// "Phone", "Shield" and "Hourglass" icons have a lot of "ink" so they
// are less dark for balance.
return [UIColor ows_light60Color];
return Theme.secondaryColor;
}
- (nullable UIImage *)iconForInteraction:(TSInteraction *)interaction

@ -560,14 +560,7 @@ typedef enum : NSUInteger {
[self addNotificationListeners];
[self loadDraftInCompose];
}
- (void)loadView
{
[super loadView];
// make sure toolbar extends below iPhoneX home button.
self.view.backgroundColor = Theme.toolbarBackgroundColor;
[self applyTheme];
}
- (void)createContents
@ -589,7 +582,6 @@ typedef enum : NSUInteger {
self.collectionView.showsVerticalScrollIndicator = YES;
self.collectionView.showsHorizontalScrollIndicator = NO;
self.collectionView.keyboardDismissMode = UIScrollViewKeyboardDismissModeInteractive;
self.collectionView.backgroundColor = [UIColor whiteColor];
[self.view addSubview:self.collectionView];
[self.collectionView autoPinEdgesToSuperviewEdges];
@ -4243,6 +4235,17 @@ typedef enum : NSUInteger {
}
}
- (void)applyTheme
{
OWSAssertIsOnMainThread();
// make sure toolbar extends below iPhoneX home button.
self.view.backgroundColor = Theme.toolbarBackgroundColor;
self.collectionView.backgroundColor = Theme.backgroundColor;
[self updateNavigationBarSubtitleLabel];
}
- (void)attachmentApproval:(AttachmentApprovalViewController *)attachmentApproval didApproveAttachment:(SignalAttachment * _Nonnull)attachment
{
[self sendMessageAttachment:attachment];

@ -48,6 +48,8 @@ class ConversationSearchViewController: UITableViewController {
var blockedPhoneNumberSet = Set<String>()
private var hasThemeChanged = false
// MARK: View Lifecycle
override func viewDidLoad() {
@ -67,6 +69,28 @@ class ConversationSearchViewController: UITableViewController {
selector: #selector(yapDatabaseModified),
name: NSNotification.Name.YapDatabaseModified,
object: OWSPrimaryStorage.shared().dbNotificationObject)
NotificationCenter.default.addObserver(self,
selector: #selector(themeDidChange),
name: NSNotification.Name.ThemeDidChange,
object: nil)
applyTheme()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
guard hasThemeChanged else {
return
}
hasThemeChanged = false
applyTheme()
self.tableView.reloadData()
}
deinit {
NotificationCenter.default.removeObserver(self)
}
@objc internal func yapDatabaseModified(notification: NSNotification) {
@ -75,6 +99,22 @@ class ConversationSearchViewController: UITableViewController {
refreshSearchResults()
}
@objc internal func themeDidChange(notification: NSNotification) {
SwiftAssertIsOnMainThread(#function)
applyTheme()
self.tableView.reloadData()
hasThemeChanged = true
}
private func applyTheme() {
SwiftAssertIsOnMainThread(#function)
self.view.backgroundColor = Theme.backgroundColor
self.tableView.backgroundColor = Theme.backgroundColor
}
// MARK: UITableViewDelegate
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
@ -159,6 +199,8 @@ class ConversationSearchViewController: UITableViewController {
return UITableViewCell()
}
OWSTableItem.configureCell(cell)
let searchText = self.searchResultSet.searchText
cell.configure(searchText: searchText)
return cell

@ -65,11 +65,6 @@ NS_ASSUME_NONNULL_BEGIN
_viewConstraints = [NSMutableArray new];
UIView *selectedBackgroundView = [UIView new];
selectedBackgroundView.backgroundColor = [Theme.cellSelectedColor colorWithAlphaComponent:0.08f];
self.selectedBackgroundView = selectedBackgroundView;
self.avatarView = [[AvatarImageView alloc] init];
[self.contentView addSubview:self.avatarView];
[self.avatarView autoSetDimension:ALDimensionWidth toSize:self.avatarSize];
@ -199,6 +194,8 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(contactsManager);
OWSAssert(blockedPhoneNumberSet);
[OWSTableItem configureCell:self];
self.thread = thread;
self.contactsManager = contactsManager;

@ -84,6 +84,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
@property (nonatomic) TSThread *lastThread;
@property (nonatomic) BOOL hasArchivedThreadsRow;
@property (nonatomic) BOOL hasThemeChanged;
@end
@ -174,7 +175,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(themeDidChange:)
name:NSNotificationNameThemeDidChange
name:ThemeDidChangeNotification
object:nil];
}
@ -223,14 +224,20 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
[self applyTheme];
[self.tableView reloadData];
self.hasThemeChanged = YES;
}
- (void)applyTheme
{
OWSAssertIsOnMainThread();
OWSAssert(self.tableView);
OWSAssert(self.searchBar);
self.view.backgroundColor = Theme.backgroundColor;
self.tableView.backgroundColor = Theme.backgroundColor;
self.searchBar.backgroundColor = Theme.backgroundColor;
self.searchBar.barStyle = Theme.barStyle;
}
#pragma mark - View Life Cycle
@ -328,8 +335,6 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
[self.tableView insertSubview:pullToRefreshView atIndex:0];
[self updateReminderViews];
[self applyTheme];
}
- (void)updateReminderViews
@ -383,9 +388,6 @@ 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 = Theme.backgroundColor;
searchBar.barStyle = Theme.barStyle;
searchBar.delegate = self;
[searchBar sizeToFit];
@ -404,6 +406,8 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
searchResultsController.view.hidden = YES;
[self updateBarButtonItems];
[self applyTheme];
}
- (void)applyDefaultBackButton
@ -435,6 +439,20 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
[self displayAnyUnseenUpgradeExperience];
[self applyDefaultBackButton];
if (self.hasThemeChanged) {
[self.tableView reloadData];
self.hasThemeChanged = NO;
}
[self.searchResultsController viewDidAppear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
[self.searchResultsController viewDidDisappear:animated];
}
- (void)updateBarButtonItems
@ -567,6 +585,8 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
if ([self updateHasArchivedThreadsRow]) {
[self.tableView reloadData];
}
[self.searchResultsController viewWillAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
@ -574,6 +594,8 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
[super viewWillDisappear:animated];
self.isViewVisible = NO;
[self.searchResultsController viewWillDisappear:animated];
}
- (void)setIsViewVisible:(BOOL)isViewVisible

@ -75,7 +75,6 @@ NS_ASSUME_NONNULL_BEGIN
{
[super loadView];
self.view.backgroundColor = Theme.backgroundColor;
_contactsViewHelper = [[ContactsViewHelper alloc] initWithDelegate:self];
_conversationSearcher = [ConversationSearcher shared];
_nonContactAccountSet = [NSMutableSet set];
@ -145,7 +144,7 @@ NS_ASSUME_NONNULL_BEGIN
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(themeDidChange:)
name:NSNotificationNameThemeDidChange
name:ThemeDidChangeNotification
object:nil];
}

@ -68,6 +68,8 @@ NS_ASSUME_NONNULL_BEGIN
{
[super viewDidLoad];
self.shouldUseTheme = NO;
[self createViews];
[self initializeKeyboardHandlers];

@ -47,6 +47,8 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
{
[super loadView];
self.shouldUseTheme = NO;
[self createViews];
// Do any additional setup after loading the view.

@ -71,9 +71,15 @@ class ContactCell: UITableViewCell {
}
func configure(contact: Contact, subtitleType: SubtitleCellValue, showsWhenSelected: Bool, contactsManager: OWSContactsManager) {
OWSTableItem.configureCell(self)
self.contact = contact
self.showsWhenSelected = showsWhenSelected
self.titleLabel.textColor = Theme.primaryColor
self.subtitleLabel.textColor = Theme.secondaryColor
let cnContact = contactsManager.cnContact(withId: contact.cnContactId)
titleLabel.attributedText = cnContact?.formattedFullName(font: titleLabel.font)
updateSubtitle(subtitleType: subtitleType, contact: contact)

@ -108,6 +108,7 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
+ (void)configureCell:(UITableViewCell *)cell
{
cell.backgroundColor = [Theme backgroundColor];
cell.contentView.backgroundColor = [Theme backgroundColor];
cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f];
cell.textLabel.textColor = [Theme primaryColor];
@ -483,7 +484,7 @@ NSString *const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier";
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(themeDidChange:)
name:NSNotificationNameThemeDidChange
name:ThemeDidChangeNotification
object:nil];
}

@ -10,6 +10,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic) BOOL shouldIgnoreKeyboardChanges;
@property (nonatomic) BOOL shouldUseTheme;
// We often want to pin one view to the bottom of a view controller
// BUT adjust its location upward if the keyboard appears.
- (void)autoPinViewToBottomOfViewControllerOrKeyboard:(UIView *)view;

@ -4,6 +4,7 @@
#import "OWSViewController.h"
#import "UIView+OWS.h"
#import <SignalMessaging/Theme.h>
NS_ASSUME_NONNULL_BEGIN
@ -30,6 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (!self) {
self.shouldUseTheme = YES;
return self;
}
@ -42,6 +44,7 @@ NS_ASSUME_NONNULL_BEGIN
{
self = [super initWithCoder:aDecoder];
if (!self) {
self.shouldUseTheme = YES;
return self;
}
@ -50,6 +53,15 @@ NS_ASSUME_NONNULL_BEGIN
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
if (self.shouldUseTheme) {
self.view.backgroundColor = Theme.backgroundColor;
}
}
- (void)autoPinViewToBottomOfViewControllerOrKeyboard:(UIView *)view
{
OWSAssert(view);

@ -46,7 +46,6 @@ NS_ASSUME_NONNULL_BEGIN
self.preservesSuperviewLayoutMargins = YES;
self.contentView.preservesSuperviewLayoutMargins = YES;
[OWSTableItem configureCell:self];
self.cellView = [ContactCellView new];
[self.contentView addSubview:self.cellView];
@ -56,11 +55,13 @@ NS_ASSUME_NONNULL_BEGIN
- (void)configureWithSignalAccount:(SignalAccount *)signalAccount contactsManager:(OWSContactsManager *)contactsManager
{
[self.cellView configureWithRecipientId:signalAccount.recipientId contactsManager:contactsManager];
[self configureWithRecipientId:signalAccount.recipientId contactsManager:contactsManager];
}
- (void)configureWithRecipientId:(NSString *)recipientId contactsManager:(OWSContactsManager *)contactsManager
{
[OWSTableItem configureCell:self];
[self.cellView configureWithRecipientId:recipientId contactsManager:contactsManager];
// Force layout, since imageView isn't being initally rendered on App Store optimized build.
@ -71,6 +72,8 @@ NS_ASSUME_NONNULL_BEGIN
{
OWSAssert(thread);
[OWSTableItem configureCell:self];
[self.cellView configureWithThread:thread contactsManager:contactsManager];
// Force layout, since imageView isn't being initally rendered on App Store optimized build.

@ -30,7 +30,7 @@ public class ContactFieldView: UIView {
return
}
let row = UIView()
row.backgroundColor = UIColor(rgbHex: 0xdedee1)
row.backgroundColor = Theme.secondaryColor
self.addSubview(row)
row.autoSetDimension(.height, toSize: 1)
row.autoPinLeadingToSuperviewMargin(withInset: hMargin)
@ -118,14 +118,14 @@ public class ContactFieldView: UIView {
let nameLabel = UILabel()
nameLabel.text = name.lowercased()
nameLabel.font = UIFont.ows_dynamicTypeSubheadline
nameLabel.textColor = UIColor.black
nameLabel.textColor = Theme.secondaryColor
nameLabel.lineBreakMode = .byTruncatingTail
stackView.addArrangedSubview(nameLabel)
let valueLabel = UILabel()
valueLabel.text = value
valueLabel.font = UIFont.ows_dynamicTypeBody
valueLabel.textColor = UIColor.ows_materialBlue
valueLabel.textColor = Theme.primaryColor
valueLabel.lineBreakMode = .byTruncatingTail
stackView.addArrangedSubview(valueLabel)
@ -148,7 +148,7 @@ public class ContactFieldView: UIView {
let nameLabel = UILabel()
nameLabel.text = address.localizedLabel()
nameLabel.font = UIFont.ows_dynamicTypeSubheadline
nameLabel.textColor = UIColor.black
nameLabel.textColor = Theme.secondaryColor
nameLabel.lineBreakMode = .byTruncatingTail
stackView.addArrangedSubview(nameLabel)
@ -169,7 +169,7 @@ public class ContactFieldView: UIView {
let nameLabel = UILabel()
nameLabel.text = propertyName
nameLabel.font = UIFont.ows_dynamicTypeBody
nameLabel.textColor = UIColor.black
nameLabel.textColor = Theme.secondaryColor
nameLabel.lineBreakMode = .byTruncatingTail
row.addArrangedSubview(nameLabel)
nameLabel.setContentHuggingHigh()
@ -178,7 +178,7 @@ public class ContactFieldView: UIView {
let valueLabel = UILabel()
valueLabel.text = propertyValue
valueLabel.font = UIFont.ows_dynamicTypeBody
valueLabel.textColor = UIColor.ows_materialBlue
valueLabel.textColor = Theme.primaryColor
valueLabel.lineBreakMode = .byTruncatingTail
row.addArrangedSubview(valueLabel)

@ -324,7 +324,7 @@ public class ContactShareApprovalViewController: OWSViewController, EditContactS
self.navigationItem.title = NSLocalizedString("CONTACT_SHARE_APPROVAL_VIEW_TITLE",
comment: "Title for the 'Approve contact share' view.")
self.view.backgroundColor = UIColor.white
self.view.backgroundColor = Theme.backgroundColor
updateContent()
@ -416,7 +416,7 @@ public class ContactShareApprovalViewController: OWSViewController, EditContactS
self.nameLabel = nameLabel
nameLabel.text = contactShare.name.displayName
nameLabel.font = UIFont.ows_dynamicTypeBody.ows_mediumWeight()
nameLabel.textColor = UIColor.black
nameLabel.textColor = Theme.primaryColor
nameLabel.lineBreakMode = .byTruncatingTail
stackView.addArrangedSubview(nameLabel)

@ -10,7 +10,7 @@ NS_ASSUME_NONNULL_BEGIN
#define THEME_ENABLED
#endif
extern NSString *const NSNotificationNameThemeDidChange;
extern NSString *const ThemeDidChangeNotification;
@interface Theme : NSObject
@ -34,7 +34,9 @@ extern NSString *const NSNotificationNameThemeDidChange;
@property (class, readonly, nonatomic) UIColor *toolbarBackgroundColor;
+ (UIColor *)cellSelectedColor;
@property (class, readonly, nonatomic) UIColor *conversationButtonBackgroundColor;
@property (class, readonly, nonatomic) UIColor *cellSelectedColor;
#pragma mark -

@ -11,7 +11,7 @@
NS_ASSUME_NONNULL_BEGIN
NSString *const NSNotificationNameThemeDidChange = @"NSNotificationNameThemeDidChange";
NSString *const ThemeDidChangeNotification = @"ThemeDidChangeNotification";
NSString *const ThemeCollection = @"ThemeCollection";
NSString *const ThemeKeyThemeEnabled = @"ThemeKeyThemeEnabled";
@ -41,9 +41,7 @@ NSString *const ThemeKeyThemeEnabled = @"ThemeKeyThemeEnabled";
[UIUtil setupSignalAppearence];
[[NSNotificationCenter defaultCenter] postNotificationNameAsync:NSNotificationNameThemeDidChange
object:nil
userInfo:nil];
[[NSNotificationCenter defaultCenter] postNotificationNameAsync:ThemeDidChangeNotification object:nil userInfo:nil];
}
+ (UIColor *)backgroundColor
@ -98,6 +96,11 @@ NSString *const ThemeKeyThemeEnabled = @"ThemeKeyThemeEnabled";
return (Theme.isDarkThemeEnabled ? UIColor.ows_whiteColor : UIColor.ows_blackColor);
}
+ (UIColor *)conversationButtonBackgroundColor
{
return (Theme.isDarkThemeEnabled ? UIColor.ows_dark05Color : UIColor.ows_light02Color);
}
#pragma mark -
+ (UIBarStyle)barStyle
@ -108,6 +111,7 @@ NSString *const ThemeKeyThemeEnabled = @"ThemeKeyThemeEnabled";
return UIBarStyleDefault;
}
}
@end
NS_ASSUME_NONNULL_END

@ -143,7 +143,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value);
@interface UIStackView (OWS)
- (void)addBackgroundViewWithBackgroundColor:(UIColor *)backgroundColor;
- (UIView *)addBackgroundViewWithBackgroundColor:(UIColor *)backgroundColor;
@end

@ -538,12 +538,14 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
@implementation UIStackView (OWS)
- (void)addBackgroundViewWithBackgroundColor:(UIColor *)backgroundColor
- (UIView *)addBackgroundViewWithBackgroundColor:(UIColor *)backgroundColor
{
UIView *subview = [UIView new];
subview.backgroundColor = backgroundColor;
[self addSubview:subview];
[subview autoPinEdgesToSuperviewEdges];
[self sendSubviewToBack:subview];
return subview;
}
@end

@ -25,6 +25,8 @@
{
[super loadView];
self.shouldUseTheme = NO;
self.view.backgroundColor = [UIColor whiteColor];
self.title = NSLocalizedString(@"COUNTRYCODE_SELECT_TITLE", @"");

Loading…
Cancel
Save