diff --git a/Signal/src/ViewControllers/AppSettings/AdvancedSettingsTableViewController.m b/Signal/src/ViewControllers/AppSettings/AdvancedSettingsTableViewController.m index 4072b13aa..efd8514a8 100644 --- a/Signal/src/ViewControllers/AppSettings/AdvancedSettingsTableViewController.m +++ b/Signal/src/ViewControllers/AppSettings/AdvancedSettingsTableViewController.m @@ -293,8 +293,6 @@ NS_ASSUME_NONNULL_BEGIN [Theme setIsDarkThemeEnabled:sender.isOn]; [self updateTableContents]; - - // TODO: Notify and refresh. } #endif diff --git a/SignalMessaging/ViewControllers/OWSNavigationController.m b/SignalMessaging/ViewControllers/OWSNavigationController.m index e6233463d..882cd0f93 100644 --- a/SignalMessaging/ViewControllers/OWSNavigationController.m +++ b/SignalMessaging/ViewControllers/OWSNavigationController.m @@ -42,9 +42,28 @@ NS_ASSUME_NONNULL_BEGIN navbar.navBarLayoutDelegate = self; [self updateLayoutForNavbar:navbar]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(themeDidChange:) + name:ThemeDidChangeNotification + object:nil]; + return self; } +- (void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +- (void)themeDidChange:(id)notification +{ + OWSAssertIsOnMainThread(); + + self.navigationBar.barTintColor = [UINavigationBar appearance].barTintColor; + self.navigationBar.tintColor = [UINavigationBar appearance].tintColor; + self.navigationBar.titleTextAttributes = [UINavigationBar appearance].titleTextAttributes; +} + - (void)viewDidLoad { [super viewDidLoad]; diff --git a/SignalMessaging/ViewControllers/SelectThreadViewController.m b/SignalMessaging/ViewControllers/SelectThreadViewController.m index 3fa5ec514..bf7662df0 100644 --- a/SignalMessaging/ViewControllers/SelectThreadViewController.m +++ b/SignalMessaging/ViewControllers/SelectThreadViewController.m @@ -55,7 +55,7 @@ NS_ASSUME_NONNULL_BEGIN target:self action:@selector(dismissPressed:)]; - self.view.backgroundColor = [UIColor whiteColor]; + self.view.backgroundColor = Theme.backgroundColor; _contactsViewHelper = [[ContactsViewHelper alloc] initWithDelegate:self]; _conversationSearcher = ConversationSearcher.shared; @@ -91,7 +91,8 @@ NS_ASSUME_NONNULL_BEGIN searchBar.searchBarStyle = UISearchBarStyleMinimal; searchBar.delegate = self; searchBar.placeholder = NSLocalizedString(@"SEARCH_BYNAMEORNUMBER_PLACEHOLDER_TEXT", @""); - searchBar.backgroundColor = [UIColor whiteColor]; + searchBar.backgroundColor = [Theme backgroundColor]; + searchBar.barStyle = Theme.barStyle; [searchBar sizeToFit]; UIView *header = [self.selectThreadViewDelegate createHeaderWithSearchBar:searchBar]; diff --git a/SignalMessaging/ViewControllers/SharingThreadPickerViewController.m b/SignalMessaging/ViewControllers/SharingThreadPickerViewController.m index 9eb1763b6..4de16e05a 100644 --- a/SignalMessaging/ViewControllers/SharingThreadPickerViewController.m +++ b/SignalMessaging/ViewControllers/SharingThreadPickerViewController.m @@ -87,7 +87,7 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion); const CGFloat contentVMargin = 0; UIView *header = [UIView new]; - header.backgroundColor = [UIColor whiteColor]; + header.backgroundColor = Theme.backgroundColor; UIButton *cancelShareButton = [UIButton buttonWithType:UIButtonTypeSystem]; [header addSubview:cancelShareButton]; diff --git a/SignalMessaging/Views/AvatarImageView.swift b/SignalMessaging/Views/AvatarImageView.swift index 760590dfe..8120c094f 100644 --- a/SignalMessaging/Views/AvatarImageView.swift +++ b/SignalMessaging/Views/AvatarImageView.swift @@ -38,7 +38,7 @@ public class AvatarImageView: UIImageView { } override public func layoutSubviews() { - self.layer.borderColor = UIColor.black.cgColor.copy(alpha: 0.15) + self.layer.borderColor = UIColor(white: 0, alpha: 0.15).cgColor self.layer.cornerRadius = self.frame.size.width / 2 } } diff --git a/SignalMessaging/Views/DisappearingTimerConfigurationView.swift b/SignalMessaging/Views/DisappearingTimerConfigurationView.swift index 308d53723..73f29d811 100644 --- a/SignalMessaging/Views/DisappearingTimerConfigurationView.swift +++ b/SignalMessaging/Views/DisappearingTimerConfigurationView.swift @@ -60,7 +60,6 @@ public class DisappearingTimerConfigurationView: UIView { self.label = UILabel() label.text = NSString.formatDurationSeconds(durationSeconds, useShortFormat: true) label.font = UIFont.systemFont(ofSize: 10) - label.textColor = UIColor.white label.textAlignment = .center label.minimumScaleFactor = 0.5 diff --git a/SignalMessaging/Views/OWSNavigationBar.swift b/SignalMessaging/Views/OWSNavigationBar.swift index 49ce69bc5..a2bf797a7 100644 --- a/SignalMessaging/Views/OWSNavigationBar.swift +++ b/SignalMessaging/Views/OWSNavigationBar.swift @@ -71,10 +71,26 @@ public class OWSNavigationBar: UINavigationBar { NotificationCenter.default.addObserver(self, selector: #selector(callDidChange), name: .OWSWindowManagerCallDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(didChangeStatusBarFrame), name: .UIApplicationDidChangeStatusBarFrame, object: nil) + NotificationCenter.default.addObserver(self, + selector: #selector(themeDidChange), + name: .ThemeDidChange, + object: nil) } // MARK: Layout + @objc + public func themeDidChange() { + Logger.debug("\(self.logTag) in \(#function)") + + guard self.backgroundImage(for: .default) != nil else { + return + } + let color = Theme.navbarBackgroundColor.withAlphaComponent(OWSNavigationBar.backgroundBlurMutingFactor) + let backgroundImage = UIImage(color: color) + self.setBackgroundImage(backgroundImage, for: .default) + } + @objc public func callDidChange() { Logger.debug("\(self.logTag) in \(#function)") @@ -143,7 +159,7 @@ public class OWSNavigationBar: UINavigationBar { @objc public func makeClear() { self.backgroundColor = .clear - self.setBackgroundImage(UIImage(), for: .default) + self.setBackgroundImage(nil, for: .default) self.shadowImage = UIImage() self.clipsToBounds = true self.blurEffectView?.isHidden = true