Merge branch 'refactor-theme'
This commit is contained in:
commit
c33e087f0c
|
@ -142,7 +142,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
|
|||
wizard.parsingResult = parsingResult
|
||||
wizard.removesConfigurationOnCancel = true
|
||||
|
||||
wizardNav.modalPresentationStyle = .formSheet
|
||||
wizardNav.applyModalPresentation(.current)
|
||||
target.present(wizardNav, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,16 +26,6 @@
|
|||
import UIKit
|
||||
import Convenience
|
||||
|
||||
extension UIViewController {
|
||||
func applyMasterTitle(_ theme: Theme) {
|
||||
navigationItem.largeTitleDisplayMode = theme.masterTitleDisplayMode
|
||||
}
|
||||
|
||||
func applyDetailTitle(_ theme: Theme) {
|
||||
navigationItem.largeTitleDisplayMode = theme.detailTitleDisplayMode
|
||||
}
|
||||
}
|
||||
|
||||
extension StrongTableModel {
|
||||
func headerHeight(for section: Int) -> CGFloat {
|
||||
guard let title = header(forSection: section) else {
|
||||
|
|
|
@ -82,16 +82,10 @@ struct Theme {
|
|||
|
||||
var palette: Palette
|
||||
|
||||
var masterTitleDisplayMode: UINavigationItem.LargeTitleDisplayMode
|
||||
|
||||
var detailTitleDisplayMode: UINavigationItem.LargeTitleDisplayMode
|
||||
|
||||
var modalPresentationStyle: UIModalPresentationStyle
|
||||
|
||||
private init() {
|
||||
palette = Palette()
|
||||
masterTitleDisplayMode = .never
|
||||
detailTitleDisplayMode = .never
|
||||
modalPresentationStyle = .formSheet
|
||||
}
|
||||
}
|
||||
|
@ -116,6 +110,12 @@ extension Theme {
|
|||
}
|
||||
}
|
||||
|
||||
extension UIViewController {
|
||||
func applyModalPresentation(_ theme: Theme) {
|
||||
modalPresentationStyle = theme.modalPresentationStyle
|
||||
}
|
||||
}
|
||||
|
||||
extension UIView {
|
||||
func applyPrimaryBackground(_ theme: Theme) {
|
||||
backgroundColor = theme.palette.primaryBackground
|
||||
|
|
|
@ -53,12 +53,6 @@ class AboutViewController: UITableViewController, StrongTableHost {
|
|||
|
||||
// MARK: UIViewController
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
applyDetailTitle(.current)
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
|
|
@ -37,12 +37,6 @@ class LabelViewController: UIViewController {
|
|||
|
||||
var license: AppConstants.License?
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
applyDetailTitle(.current)
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
|
|
@ -134,12 +134,6 @@ class AccountViewController: UIViewController, StrongTableHost {
|
|||
|
||||
// MARK: UIViewController
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
applyDetailTitle(.current)
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
|
|
@ -90,12 +90,6 @@ class ConfigurationViewController: UIViewController, StrongTableHost {
|
|||
|
||||
// MARK: UIViewController
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
applyDetailTitle(.current)
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
|
|
@ -38,12 +38,6 @@ class DebugLogViewController: UIViewController {
|
|||
NotificationCenter.default.removeObserver(self)
|
||||
}
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
applyDetailTitle(.current)
|
||||
}
|
||||
|
||||
// MARK: UIViewController
|
||||
|
||||
override func viewDidLoad() {
|
||||
|
|
|
@ -91,12 +91,6 @@ class EndpointViewController: UIViewController, StrongTableHost {
|
|||
|
||||
// MARK: UIViewController
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
applyDetailTitle(.current)
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
|
|
@ -104,12 +104,6 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
|
|||
NotificationCenter.default.removeObserver(self)
|
||||
}
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
applyMasterTitle(.current)
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
|
|
@ -64,12 +64,6 @@ class ProviderPoolViewController: UIViewController {
|
|||
|
||||
// MARK: UIViewController
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
applyDetailTitle(.current)
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
|
|
@ -45,12 +45,6 @@ class ProviderPresetViewController: UIViewController {
|
|||
|
||||
// MARK: UIViewController
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
applyDetailTitle(.current)
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
|
|
@ -113,12 +113,6 @@ class ServerNetworkViewController: UITableViewController, StrongTableHost {
|
|||
|
||||
// MARK: UIViewController
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
applyDetailTitle(.current)
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
|
|
@ -87,12 +87,6 @@ class ServiceViewController: UIViewController, StrongTableHost {
|
|||
}
|
||||
}
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
applyDetailTitle(.current)
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ class ShortcutsViewController: UITableViewController, INUIAddVoiceShortcutViewCo
|
|||
}
|
||||
pendingShortcut = nil
|
||||
let vc = INUIAddVoiceShortcutViewController(shortcut: shortcut)
|
||||
vc.modalPresentationStyle = Theme.current.modalPresentationStyle
|
||||
vc.applyModalPresentation(.current)
|
||||
vc.delegate = self
|
||||
present(vc, animated: true, completion: nil)
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ class ShortcutsViewController: UITableViewController, INUIAddVoiceShortcutViewCo
|
|||
break
|
||||
}
|
||||
let vc = INUIEditVoiceShortcutViewController(voiceShortcut: wrapper.original)
|
||||
vc.modalPresentationStyle = Theme.current.modalPresentationStyle
|
||||
vc.applyModalPresentation(.current)
|
||||
vc.delegate = self
|
||||
editedIndexPath = indexPath
|
||||
present(vc, animated: true, completion: nil)
|
||||
|
|
Loading…
Reference in New Issue