Create modal presentation theme

This commit is contained in:
Davide De Rosa 2019-11-19 23:20:22 +01:00
parent 39ff0e3093
commit bacd510345
3 changed files with 9 additions and 3 deletions

View File

@ -142,7 +142,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
wizard.parsingResult = parsingResult wizard.parsingResult = parsingResult
wizard.removesConfigurationOnCancel = true wizard.removesConfigurationOnCancel = true
wizardNav.modalPresentationStyle = .formSheet wizardNav.applyModalPresentation(.current)
target.present(wizardNav, animated: true, completion: nil) target.present(wizardNav, animated: true, completion: nil)
} }
} }

View File

@ -110,6 +110,12 @@ extension Theme {
} }
} }
extension UIViewController {
func applyModalPresentation(_ theme: Theme) {
modalPresentationStyle = theme.modalPresentationStyle
}
}
extension UIView { extension UIView {
func applyPrimaryBackground(_ theme: Theme) { func applyPrimaryBackground(_ theme: Theme) {
backgroundColor = theme.palette.primaryBackground backgroundColor = theme.palette.primaryBackground

View File

@ -146,7 +146,7 @@ class ShortcutsViewController: UITableViewController, INUIAddVoiceShortcutViewCo
} }
pendingShortcut = nil pendingShortcut = nil
let vc = INUIAddVoiceShortcutViewController(shortcut: shortcut) let vc = INUIAddVoiceShortcutViewController(shortcut: shortcut)
vc.modalPresentationStyle = Theme.current.modalPresentationStyle vc.applyModalPresentation(.current)
vc.delegate = self vc.delegate = self
present(vc, animated: true, completion: nil) present(vc, animated: true, completion: nil)
} }
@ -206,7 +206,7 @@ class ShortcutsViewController: UITableViewController, INUIAddVoiceShortcutViewCo
break break
} }
let vc = INUIEditVoiceShortcutViewController(voiceShortcut: wrapper.original) let vc = INUIEditVoiceShortcutViewController(voiceShortcut: wrapper.original)
vc.modalPresentationStyle = Theme.current.modalPresentationStyle vc.applyModalPresentation(.current)
vc.delegate = self vc.delegate = self
editedIndexPath = indexPath editedIndexPath = indexPath
present(vc, animated: true, completion: nil) present(vc, animated: true, completion: nil)