From f6c8f5dcf590fa48bd484ce9591ab72174d73cc6 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Thu, 27 Aug 2020 15:10:28 +1000 Subject: [PATCH] WIP --- ...otificationSettingsOptionsViewController.m | 2 +- .../NotificationSettingsViewController.m | 2 +- .../OWSSoundSettingsViewController.m | 19 +------------------ .../UIViewController+Utilities.swift | 12 +++++++----- 4 files changed, 10 insertions(+), 25 deletions(-) diff --git a/Signal/src/ViewControllers/AppSettings/NotificationSettingsOptionsViewController.m b/Signal/src/ViewControllers/AppSettings/NotificationSettingsOptionsViewController.m index 1b30b3266..e9b6b2f78 100644 --- a/Signal/src/ViewControllers/AppSettings/NotificationSettingsOptionsViewController.m +++ b/Signal/src/ViewControllers/AppSettings/NotificationSettingsOptionsViewController.m @@ -16,7 +16,7 @@ [self updateTableContents]; - [LKViewControllerUtilities setUpDefaultSessionStyleForVC:self withTitle:NSLocalizedString(@"Content", @"")] + [LKViewControllerUtilities setUpDefaultSessionStyleForVC:self withTitle:NSLocalizedString(@"Content", @"") customBackButton:NO]; self.tableView.backgroundColor = UIColor.clearColor; } diff --git a/Signal/src/ViewControllers/AppSettings/NotificationSettingsViewController.m b/Signal/src/ViewControllers/AppSettings/NotificationSettingsViewController.m index 0f071f30e..23664337d 100644 --- a/Signal/src/ViewControllers/AppSettings/NotificationSettingsViewController.m +++ b/Signal/src/ViewControllers/AppSettings/NotificationSettingsViewController.m @@ -21,7 +21,7 @@ [self updateTableContents]; - [LKViewControllerUtilities setUpDefaultSessionStyleForVC:self withTitle:NSLocalizedString(@"vc_notification_settings_title", @"")]; + [LKViewControllerUtilities setUpDefaultSessionStyleForVC:self withTitle:NSLocalizedString(@"vc_notification_settings_title", @"") customBackButton:YES]; self.tableView.backgroundColor = UIColor.clearColor; } diff --git a/Signal/src/ViewControllers/AppSettings/OWSSoundSettingsViewController.m b/Signal/src/ViewControllers/AppSettings/OWSSoundSettingsViewController.m index 2346414b7..1c38803d4 100644 --- a/Signal/src/ViewControllers/AppSettings/OWSSoundSettingsViewController.m +++ b/Signal/src/ViewControllers/AppSettings/OWSSoundSettingsViewController.m @@ -38,25 +38,8 @@ NS_ASSUME_NONNULL_BEGIN [self updateTableContents]; [self updateNavigationItems]; - // Loki: Set gradient background + [LKViewControllerUtilities setUpDefaultSessionStyleForVC:self withTitle:NSLocalizedString(@"Sound", @"") customBackButton:NO]; self.tableView.backgroundColor = UIColor.clearColor; - LKGradient *gradient = LKGradients.defaultLokiBackground; - self.view.backgroundColor = UIColor.clearColor; - [self.view setGradient:gradient]; - - // Loki: Set navigation bar background color - UINavigationBar *navigationBar = self.navigationController.navigationBar; - [navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; - navigationBar.shadowImage = [UIImage new]; - [navigationBar setTranslucent:NO]; - navigationBar.barTintColor = LKColors.navigationBarBackground; - - // Loki: Customize title - UILabel *titleLabel = [UILabel new]; - titleLabel.text = NSLocalizedString(@"Sound", @""); - titleLabel.textColor = LKColors.text; - titleLabel.font = [UIFont boldSystemFontOfSize:LKValues.veryLargeFontSize]; - self.navigationItem.titleView = titleLabel; } - (void)viewDidAppear:(BOOL)animated diff --git a/SignalMessaging/Loki/Redesign/Utilities/UIViewController+Utilities.swift b/SignalMessaging/Loki/Redesign/Utilities/UIViewController+Utilities.swift index 830a70305..7fb93a775 100644 --- a/SignalMessaging/Loki/Redesign/Utilities/UIViewController+Utilities.swift +++ b/SignalMessaging/Loki/Redesign/Utilities/UIViewController+Utilities.swift @@ -4,8 +4,8 @@ public final class ViewControllerUtilities : NSObject { private override init() { } - @objc(setUpDefaultSessionStyleForVC:withTitle:) - public static func setUpDefaultSessionStyle(for vc: UIViewController, title: String) { + @objc(setUpDefaultSessionStyleForVC:withTitle:customBackButton:) + public static func setUpDefaultSessionStyle(for vc: UIViewController, title: String, hasCustomBackButton: Bool) { // Set gradient background vc.view.backgroundColor = .clear let gradient = Gradients.defaultLokiBackground @@ -24,8 +24,10 @@ public final class ViewControllerUtilities : NSObject { titleLabel.font = .boldSystemFont(ofSize: Values.veryLargeFontSize) vc.navigationItem.titleView = titleLabel // Set up back button - let backButton = UIBarButtonItem(title: "Back", style: .plain, target: nil, action: nil) - backButton.tintColor = Colors.text - vc.navigationItem.backBarButtonItem = backButton + if hasCustomBackButton { + let backButton = UIBarButtonItem(title: "Back", style: .plain, target: nil, action: nil) + backButton.tintColor = Colors.text + vc.navigationItem.backBarButtonItem = backButton + } } }