Commit 27623f2a by Demid Merzlyakov

iOS 15: fix navigation bar appearance.

parent 8950c1dc
......@@ -271,6 +271,7 @@
CEC8FBB5263976400001A6BF /* OnboardingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEC8FBB4263976400001A6BF /* OnboardingViewModel.swift */; };
CED4D66B26ED6A5E00ECF479 /* SubscriptionOverviewCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = CED4D66A26ED6A5E00ECF479 /* SubscriptionOverviewCoordinator.swift */; };
CEE1150626D987C5008FE415 /* WidgetLocationSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEE1150526D987C5008FE415 /* WidgetLocationSource.swift */; };
CEE798FC270D83F800218318 /* ColoredNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEE798FB270D83F800218318 /* ColoredNavigationController.swift */; };
CEE8869526C30F680000161B /* OneWeatherUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CD5909CF26A59AAA00448579 /* OneWeatherUI.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
CEEB3547266F5D9900E16F90 /* BannerAdCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEEB3546266F5D9900E16F90 /* BannerAdCell.swift */; };
CEEB3549266F5DA900E16F90 /* MRECAdCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEEB3548266F5DA900E16F90 /* MRECAdCell.swift */; };
......@@ -630,6 +631,7 @@
CEC8FBB4263976400001A6BF /* OnboardingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingViewModel.swift; sourceTree = "<group>"; };
CED4D66A26ED6A5E00ECF479 /* SubscriptionOverviewCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionOverviewCoordinator.swift; sourceTree = "<group>"; };
CEE1150526D987C5008FE415 /* WidgetLocationSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WidgetLocationSource.swift; sourceTree = "<group>"; };
CEE798FB270D83F800218318 /* ColoredNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColoredNavigationController.swift; sourceTree = "<group>"; };
CEEB3546266F5D9900E16F90 /* BannerAdCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BannerAdCell.swift; sourceTree = "<group>"; };
CEEB3548266F5DA900E16F90 /* MRECAdCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MRECAdCell.swift; sourceTree = "<group>"; };
CEEF40FF265E47FF00425D8F /* BlendFIPSSource.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = BlendFIPSSource.framework; sourceTree = BUILT_PRODUCTS_DIR; };
......@@ -1093,6 +1095,7 @@
CE578FE025FB415E00E8B85D /* Locations */,
CD37D3ED260DF4B8002669D6 /* Settings */,
CD82300925D6B2AF00A05501 /* AppTabBarController.swift */,
CEE798FB270D83F800218318 /* ColoredNavigationController.swift */,
);
path = "View controllers";
sourceTree = "<group>";
......@@ -2344,6 +2347,7 @@
CD50555F26983C14006776AB /* CubicCurveAlgorithm.swift in Sources */,
CDC3F858269460E600AAE3BF /* PromotionMediumWidgetView.swift in Sources */,
CD7D318B268F36AF000D01FA /* UIApplication+Version.swift in Sources */,
CEE798FC270D83F800218318 /* ColoredNavigationController.swift in Sources */,
CD86246125E662BC0097F3FB /* SunUvLineView.swift in Sources */,
CD32CE0B260C744A00235081 /* MenuCoordinator.swift in Sources */,
CD55E0BB2615EE2400CC4DC7 /* PollutantView.swift in Sources */,
......
......@@ -11,7 +11,7 @@ import OneWeatherCore
class ForecastCoordinator: Coordinator {
//Private
private let forecastViewModel = ForecastViewModel(locationManager: LocationManager.shared)
private let navigationController = UINavigationController(nibName: nil, bundle: nil)
private let navigationController = ColoredNavigationController(nibName: nil, bundle: nil)
private var tabBarController:UITabBarController?
private var forecastViewController: ForecastViewController?
......
......@@ -24,7 +24,7 @@ class NWSAlertCoordinator: Coordinator {
func start() {
let viewModel = NWSAlertViewModel(alert: alert, alertsManager: alertManager)
let viewController = NWSAlertViewController(coordinator: self, viewModel: viewModel)
let navigationController = UINavigationController(rootViewController: viewController)
let navigationController = ColoredNavigationController(rootViewController: viewController)
self.parentViewController.present(navigationController, animated: true)
}
......
......@@ -9,7 +9,7 @@ import UIKit
class RadarCoordinator: Coordinator {
//Private
private let navigationController = UINavigationController(nibName: nil, bundle: nil)
private let navigationController = ColoredNavigationController(nibName: nil, bundle: nil)
private let tabBarController:UITabBarController
//Public
......
......@@ -10,7 +10,7 @@ import UIKit
class SettingsCoordinator: Coordinator {
//Private
private let settingsViewModel = SettingsViewModel()
private let navVC = UINavigationController()
private let navVC = ColoredNavigationController()
private var parentViewController:UIViewController?
//Public
......
......@@ -14,7 +14,7 @@ protocol TodayCoordinatorDelegate: AnyObject {
class TodayCoordinator: Coordinator {
// MARK: - Private
private let navigationController = UINavigationController(nibName: nil, bundle: nil)
private let navigationController = ColoredNavigationController(nibName: nil, bundle: nil)
private var tabBarController:UITabBarController?
var todayViewController: TodayViewController?
......
//
// ColoredNavigationController.swift
// 1Weather
//
// Created by Demid Merzlyakov on 06.10.2021.
//
import UIKit
class ColoredNavigationController: UINavigationController {
override init(rootViewController: UIViewController) {
super.init(rootViewController: rootViewController)
self.view.backgroundColor = ThemeManager.currentTheme.baseBackgroundColor
}
required init?(coder: NSCoder) {
super.init(coder: coder)
self.view.backgroundColor = ThemeManager.currentTheme.baseBackgroundColor
}
override init(nibName: String?, bundle: Bundle?) {
super.init(nibName: nibName, bundle: bundle)
self.view.backgroundColor = ThemeManager.currentTheme.baseBackgroundColor
}
override init(navigationBarClass: AnyClass?, toolbarClass: AnyClass?) {
super.init(navigationBarClass: navigationBarClass, toolbarClass: toolbarClass)
self.view.backgroundColor = ThemeManager.currentTheme.baseBackgroundColor
}
convenience init() {
self.init(nibName: nil, bundle: nil)
}
}
......@@ -71,11 +71,15 @@ public struct UserDefaultsBasicValue<T> {
set {
userDefaults.setValue(newValue, forKey: key)
Settings.shared.delegate.invoke { (delegate) in
delegate.settingsDidChange()
}
if #available(iOS 14, *) {
WidgetCenter.shared.reloadAllTimelines()
DispatchQueue.main.async {
Settings.shared.delegate.invoke { (delegate) in
delegate.settingsDidChange()
}
if #available(iOS 14, *) {
WidgetCenter.shared.reloadAllTimelines()
}
}
}
}
......
......@@ -42,15 +42,12 @@ public class Settings {
@UserDefaultsBasicValue(key: "app_theme", userDefaults: UserDefaults.appDefaults)
private var _appTheme = AppTheme.system.rawValue
public var appTheme:AppTheme {
public var appTheme: AppTheme {
get {
return AppTheme(rawValue: _appTheme) ?? .system
}
set {
_appTheme = newValue.rawValue
Settings.shared.delegate.invoke { (delegate) in
delegate.settingsDidChange()
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment