Fix non-pure-black dark mode not applying to ohter scenes
This commit is contained in:
parent
d1b5126288
commit
57fb921573
|
@ -9,10 +9,14 @@
|
|||
import UIKit
|
||||
import Pachyderm
|
||||
|
||||
class AuxiliarySceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||
class AuxiliarySceneDelegate: UIResponder, UIWindowSceneDelegate, TuskerSceneDelegate {
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
var rootViewController: TuskerRootViewController? {
|
||||
window?.rootViewController as? TuskerRootViewController
|
||||
}
|
||||
|
||||
private var launchActivity: NSUserActivity?
|
||||
|
||||
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
|
||||
|
@ -112,7 +116,6 @@ class AuxiliarySceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|||
}
|
||||
|
||||
@objc private func themePrefChanged() {
|
||||
window?.overrideUserInterfaceStyle = Preferences.shared.theme
|
||||
window?.tintColor = Preferences.shared.accentColor.color
|
||||
applyAppearancePreferences()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,10 +9,12 @@
|
|||
import UIKit
|
||||
import Combine
|
||||
|
||||
class ComposeSceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||
class ComposeSceneDelegate: UIResponder, UIWindowSceneDelegate, TuskerSceneDelegate {
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
var rootViewController: TuskerRootViewController? { nil }
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
|
||||
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
|
||||
|
@ -100,8 +102,7 @@ class ComposeSceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|||
}
|
||||
|
||||
@objc private func themePrefChanged() {
|
||||
window?.overrideUserInterfaceStyle = Preferences.shared.theme
|
||||
window?.tintColor = Preferences.shared.accentColor.color
|
||||
applyAppearancePreferences()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -243,13 +243,7 @@ class MainSceneDelegate: UIResponder, UIWindowSceneDelegate, TuskerSceneDelegate
|
|||
}
|
||||
|
||||
@objc func themePrefChanged() {
|
||||
guard let window else { return }
|
||||
window.overrideUserInterfaceStyle = Preferences.shared.theme
|
||||
window.tintColor = Preferences.shared.accentColor.color
|
||||
let key = ["Controller", "Presentation", "root", "_"].reversed().joined()
|
||||
if let rootPresentationController = window.value(forKey: key) as? UIPresentationController {
|
||||
rootPresentationController.overrideTraitCollection = UITraitCollection(pureBlackDarkMode: Preferences.shared.pureBlackDarkMode)
|
||||
}
|
||||
applyAppearancePreferences()
|
||||
}
|
||||
|
||||
func showAddAccount() {
|
||||
|
|
|
@ -9,9 +9,8 @@
|
|||
import UIKit
|
||||
|
||||
protocol TuskerSceneDelegate: UISceneDelegate {
|
||||
var window: UIWindow? { get }
|
||||
var rootViewController: TuskerRootViewController? { get }
|
||||
|
||||
func handleStatusBarTapped(xPosition: CGFloat) -> StatusBarTapActionResult
|
||||
}
|
||||
|
||||
enum StatusBarTapActionResult {
|
||||
|
@ -27,4 +26,14 @@ extension TuskerSceneDelegate {
|
|||
}
|
||||
return .continue
|
||||
}
|
||||
|
||||
func applyAppearancePreferences() {
|
||||
guard let window else { return }
|
||||
window.overrideUserInterfaceStyle = Preferences.shared.theme
|
||||
window.tintColor = Preferences.shared.accentColor.color
|
||||
let key = ["Controller", "Presentation", "root", "_"].reversed().joined()
|
||||
if let rootPresentationController = window.value(forKey: key) as? UIPresentationController {
|
||||
rootPresentationController.overrideTraitCollection = UITraitCollection(pureBlackDarkMode: Preferences.shared.pureBlackDarkMode)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue