forked from shadowfacts/Tusker
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 UIKit
|
||||||
import Pachyderm
|
import Pachyderm
|
||||||
|
|
||||||
class AuxiliarySceneDelegate: UIResponder, UIWindowSceneDelegate {
|
class AuxiliarySceneDelegate: UIResponder, UIWindowSceneDelegate, TuskerSceneDelegate {
|
||||||
|
|
||||||
var window: UIWindow?
|
var window: UIWindow?
|
||||||
|
|
||||||
|
var rootViewController: TuskerRootViewController? {
|
||||||
|
window?.rootViewController as? TuskerRootViewController
|
||||||
|
}
|
||||||
|
|
||||||
private var launchActivity: NSUserActivity?
|
private var launchActivity: NSUserActivity?
|
||||||
|
|
||||||
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
|
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
|
||||||
|
@ -112,7 +116,6 @@ class AuxiliarySceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func themePrefChanged() {
|
@objc private func themePrefChanged() {
|
||||||
window?.overrideUserInterfaceStyle = Preferences.shared.theme
|
applyAppearancePreferences()
|
||||||
window?.tintColor = Preferences.shared.accentColor.color
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,12 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
|
|
||||||
class ComposeSceneDelegate: UIResponder, UIWindowSceneDelegate {
|
class ComposeSceneDelegate: UIResponder, UIWindowSceneDelegate, TuskerSceneDelegate {
|
||||||
|
|
||||||
var window: UIWindow?
|
var window: UIWindow?
|
||||||
|
|
||||||
|
var rootViewController: TuskerRootViewController? { nil }
|
||||||
|
|
||||||
private var cancellables = Set<AnyCancellable>()
|
private var cancellables = Set<AnyCancellable>()
|
||||||
|
|
||||||
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
|
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
|
||||||
|
@ -100,8 +102,7 @@ class ComposeSceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func themePrefChanged() {
|
@objc private func themePrefChanged() {
|
||||||
window?.overrideUserInterfaceStyle = Preferences.shared.theme
|
applyAppearancePreferences()
|
||||||
window?.tintColor = Preferences.shared.accentColor.color
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,13 +243,7 @@ class MainSceneDelegate: UIResponder, UIWindowSceneDelegate, TuskerSceneDelegate
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func themePrefChanged() {
|
@objc func themePrefChanged() {
|
||||||
guard let window else { return }
|
applyAppearancePreferences()
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func showAddAccount() {
|
func showAddAccount() {
|
||||||
|
|
|
@ -9,9 +9,8 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
protocol TuskerSceneDelegate: UISceneDelegate {
|
protocol TuskerSceneDelegate: UISceneDelegate {
|
||||||
|
var window: UIWindow? { get }
|
||||||
var rootViewController: TuskerRootViewController? { get }
|
var rootViewController: TuskerRootViewController? { get }
|
||||||
|
|
||||||
func handleStatusBarTapped(xPosition: CGFloat) -> StatusBarTapActionResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum StatusBarTapActionResult {
|
enum StatusBarTapActionResult {
|
||||||
|
@ -27,4 +26,14 @@ extension TuskerSceneDelegate {
|
||||||
}
|
}
|
||||||
return .continue
|
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