Merge branch 'charlesmchen/darkThemeReminders'

pull/1/head
Matthew Chen 7 years ago
commit 4b5021d8fd

@ -157,7 +157,10 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
#pragma GCC diagnostic ignored "-Wunused-result" #pragma GCC diagnostic ignored "-Wunused-result"
[ExperienceUpgradeFinder sharedManager]; [ExperienceUpgradeFinder sharedManager];
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
}
- (void)observeNotifications
{
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(signalAccountsDidChange:) selector:@selector(signalAccountsDidChange:)
name:OWSContactsManagerSignalAccountsDidChangeNotification name:OWSContactsManagerSignalAccountsDidChangeNotification
@ -332,8 +335,6 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
action:@selector(pullToRefreshPerformed:) action:@selector(pullToRefreshPerformed:)
forControlEvents:UIControlEventValueChanged]; forControlEvents:UIControlEventValueChanged];
[self.tableView insertSubview:pullToRefreshView atIndex:0]; [self.tableView insertSubview:pullToRefreshView atIndex:0];
[self updateReminderViews];
} }
- (void)updateReminderViews - (void)updateReminderViews
@ -349,6 +350,16 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
|| !self.deregisteredView.isHidden || !self.outageView.isHidden; || !self.deregisteredView.isHidden || !self.outageView.isHidden;
} }
- (void)setHasVisibleReminders:(BOOL)hasVisibleReminders
{
if (_hasVisibleReminders == hasVisibleReminders) {
return;
}
_hasVisibleReminders = hasVisibleReminders;
// If the reminders show/hide, reload the table.
[self.tableView reloadData];
}
- (void)viewDidLoad - (void)viewDidLoad
{ {
[super viewDidLoad]; [super viewDidLoad];
@ -361,6 +372,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
[self updateMappings]; [self updateMappings];
[self checkIfEmptyView]; [self checkIfEmptyView];
[self updateReminderViews]; [self updateReminderViews];
[self observeNotifications];
// because this uses the table data source, `tableViewSetup` must happen // because this uses the table data source, `tableViewSetup` must happen
// after mappings have been set up in `showInboxGrouping` // after mappings have been set up in `showInboxGrouping`
@ -411,6 +423,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
} }
searchResultsController.view.hidden = YES; searchResultsController.view.hidden = YES;
[self updateReminderViews];
[self updateBarButtonItems]; [self updateBarButtonItems];
[self applyTheme]; [self applyTheme];
@ -802,6 +815,8 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
HomeViewControllerSection section = (HomeViewControllerSection)indexPath.section; HomeViewControllerSection section = (HomeViewControllerSection)indexPath.section;
switch (section) { switch (section) {
case HomeViewControllerSectionReminders: { case HomeViewControllerSectionReminders: {
OWSAssert(self.reminderStackView);
return self.reminderViewCell; return self.reminderViewCell;
} }
case HomeViewControllerSectionConversations: { case HomeViewControllerSectionConversations: {

@ -61,12 +61,18 @@ class ReminderView: UIView {
} }
func setupSubviews() { func setupSubviews() {
let textColor: UIColor
let iconColor: UIColor
switch (mode) { switch (mode) {
case .nag: case .nag:
self.backgroundColor = UIColor.ows_reminderYellow self.backgroundColor = UIColor.ows_reminderYellow
textColor = UIColor.ows_gray90
iconColor = UIColor.ows_gray60
case .explanation: case .explanation:
// TODO: Theme, review with design. // TODO: Theme, review with design.
self.backgroundColor = Theme.offBackgroundColor self.backgroundColor = Theme.offBackgroundColor
textColor = Theme.primaryColor
iconColor = Theme.secondaryColor
} }
self.clipsToBounds = true self.clipsToBounds = true
@ -85,7 +91,7 @@ class ReminderView: UIView {
// Label // Label
label.font = UIFont.ows_dynamicTypeSubheadline label.font = UIFont.ows_dynamicTypeSubheadline
container.addArrangedSubview(label) container.addArrangedSubview(label)
label.textColor = Theme.primaryColor label.textColor = textColor
label.numberOfLines = 0 label.numberOfLines = 0
label.lineBreakMode = .byWordWrapping label.lineBreakMode = .byWordWrapping
@ -99,7 +105,7 @@ class ReminderView: UIView {
} }
let iconView = UIImageView(image: iconImage.withRenderingMode(.alwaysTemplate)) let iconView = UIImageView(image: iconImage.withRenderingMode(.alwaysTemplate))
iconView.contentMode = .scaleAspectFit iconView.contentMode = .scaleAspectFit
iconView.tintColor = Theme.secondaryColor iconView.tintColor = iconColor
iconView.autoSetDimension(.width, toSize: 13) iconView.autoSetDimension(.width, toSize: 13)
container.addArrangedSubview(iconView) container.addArrangedSubview(iconView)
} }

Loading…
Cancel
Save