Fix secondary windows not respecting theme preference

This commit is contained in:
Shadowfacts 2021-01-06 19:20:14 -05:00
parent 74a30d27e8
commit 0bdcda1b23
2 changed files with 14 additions and 0 deletions

View File

@ -56,6 +56,9 @@ class AuxiliarySceneDelegate: UIResponder, UIWindowSceneDelegate {
window = UIWindow(windowScene: windowScene)
window!.rootViewController = nav
window!.makeKeyAndVisible()
NotificationCenter.default.addObserver(self, selector: #selector(themePrefChanged), name: .themePreferenceChanged, object: nil)
themePrefChanged()
}
func sceneWillResignActive(_ scene: UIScene) {
@ -109,4 +112,8 @@ class AuxiliarySceneDelegate: UIResponder, UIWindowSceneDelegate {
@objc private func close() {
closeWindow()
}
@objc private func themePrefChanged() {
window?.overrideUserInterfaceStyle = Preferences.shared.theme
}
}

View File

@ -42,6 +42,9 @@ class ComposeSceneDelegate: UIResponder, UIWindowSceneDelegate {
window = UIWindow(windowScene: windowScene)
window!.rootViewController = nav
window!.makeKeyAndVisible()
NotificationCenter.default.addObserver(self, selector: #selector(themePrefChanged), name: .themePreferenceChanged, object: nil)
themePrefChanged()
}
func sceneWillResignActive(_ scene: UIScene) {
@ -58,6 +61,10 @@ class ComposeSceneDelegate: UIResponder, UIWindowSceneDelegate {
return scene.userActivity
}
@objc private func themePrefChanged() {
window?.overrideUserInterfaceStyle = Preferences.shared.theme
}
}
extension ComposeSceneDelegate: ComposeHostingControllerDelegate {