diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2021-11-04 18:28:25 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2021-11-04 18:28:25 +0100 |
| commit | 57b24f04ebff934a302fa154cad173b6088c989f (patch) | |
| tree | 3e6d4d8f28889b9e683dd2888572d1c3864493cd | |
| parent | 75962e60eda3ece2fc192679a7b53d7ccb566773 (diff) | |
| parent | ec3c45a2a93a1c834b66512ea117c6aff68b556f (diff) | |
| download | mullvadvpn-57b24f04ebff934a302fa154cad173b6088c989f.tar.xz mullvadvpn-57b24f04ebff934a302fa154cad173b6088c989f.zip | |
Merge branch 'fix-statusbar-appearance'
| -rw-r--r-- | ios/MullvadVPN/CustomNavigationBar.swift | 6 | ||||
| -rw-r--r-- | ios/MullvadVPN/CustomSplitViewController.swift | 21 | ||||
| -rw-r--r-- | ios/MullvadVPN/SelectLocationNavigationController.swift | 10 | ||||
| -rw-r--r-- | ios/MullvadVPN/SelectLocationViewController.swift | 4 | ||||
| -rw-r--r-- | ios/MullvadVPN/SettingsNavigationController.swift | 10 |
5 files changed, 46 insertions, 5 deletions
diff --git a/ios/MullvadVPN/CustomNavigationBar.swift b/ios/MullvadVPN/CustomNavigationBar.swift index 51a7655254..4268a45d72 100644 --- a/ios/MullvadVPN/CustomNavigationBar.swift +++ b/ios/MullvadVPN/CustomNavigationBar.swift @@ -59,6 +59,7 @@ class CustomNavigationBar: UINavigationBar { } private func setupNavigationBarAppearance() { + tintColor = .white backgroundColor = .secondaryColor isTranslucent = false @@ -69,7 +70,10 @@ class CustomNavigationBar: UINavigationBar { backIndicatorImage = customBackIndicatorImage backIndicatorTransitionMaskImage = customBackIndicatorTransitionMask barTintColor = .secondaryColor - titleTextAttributes = [.foregroundColor: UIColor.white] + + let titleAttributes: [NSAttributedString.Key: Any] = [.foregroundColor: UIColor.white] + titleTextAttributes = titleAttributes + largeTitleTextAttributes = titleAttributes shadowImage = UIImage() } } diff --git a/ios/MullvadVPN/CustomSplitViewController.swift b/ios/MullvadVPN/CustomSplitViewController.swift index 8f85e7064c..662eef869b 100644 --- a/ios/MullvadVPN/CustomSplitViewController.swift +++ b/ios/MullvadVPN/CustomSplitViewController.swift @@ -32,6 +32,27 @@ class CustomSplitViewController: UISplitViewController, RootContainment { } } + override var childForStatusBarStyle: UIViewController? { + if #available(iOS 13, *) { + return super.childForStatusBarStyle + } else { + return viewControllers.last + } + } + + override var childForStatusBarHidden: UIViewController? { + if #available(iOS 13, *) { + return super.childForStatusBarHidden + } else { + return viewControllers.last + } + } + + override var shouldAutomaticallyForwardAppearanceMethods: Bool { + // iOS 12: force split view controller to forward appearance events. + return true + } + override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() diff --git a/ios/MullvadVPN/SelectLocationNavigationController.swift b/ios/MullvadVPN/SelectLocationNavigationController.swift index 3b6b8ba0a8..66a5c71fd1 100644 --- a/ios/MullvadVPN/SelectLocationNavigationController.swift +++ b/ios/MullvadVPN/SelectLocationNavigationController.swift @@ -11,12 +11,18 @@ import UIKit class SelectLocationNavigationController: UINavigationController { + override var childForStatusBarStyle: UIViewController? { + return topViewController + } + + override var childForStatusBarHidden: UIViewController? { + return topViewController + } + init(contentController: SelectLocationViewController) { super.init(navigationBarClass: CustomNavigationBar.self, toolbarClass: nil) viewControllers = [contentController] - navigationBar.barStyle = .black - navigationBar.tintColor = .white } override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { diff --git a/ios/MullvadVPN/SelectLocationViewController.swift b/ios/MullvadVPN/SelectLocationViewController.swift index 3b672c2c09..b0730a53ad 100644 --- a/ios/MullvadVPN/SelectLocationViewController.swift +++ b/ios/MullvadVPN/SelectLocationViewController.swift @@ -36,6 +36,10 @@ class SelectLocationViewController: UIViewController, UITableViewDelegate { } } + override var preferredStatusBarStyle: UIStatusBarStyle { + return .lightContent + } + weak var delegate: SelectLocationViewControllerDelegate? var scrollToSelectedRelayOnViewWillAppear = true diff --git a/ios/MullvadVPN/SettingsNavigationController.swift b/ios/MullvadVPN/SettingsNavigationController.swift index f8959c927d..b594492cff 100644 --- a/ios/MullvadVPN/SettingsNavigationController.swift +++ b/ios/MullvadVPN/SettingsNavigationController.swift @@ -29,6 +29,14 @@ class SettingsNavigationController: CustomNavigationController, SettingsViewCont weak var settingsDelegate: SettingsNavigationControllerDelegate? + override var childForStatusBarStyle: UIViewController? { + return topViewController + } + + override var childForStatusBarHidden: UIViewController? { + return topViewController + } + init() { super.init(navigationBarClass: CustomNavigationBar.self, toolbarClass: nil) @@ -51,8 +59,6 @@ class SettingsNavigationController: CustomNavigationController, SettingsViewCont override func viewDidLoad() { super.viewDidLoad() - navigationBar.barStyle = .black - navigationBar.tintColor = .white navigationBar.prefersLargeTitles = true // Update account expiry |
