mirror of
https://github.com/yattee/yattee.git
synced 2026-07-20 14:22:02 +00:00
Enforce theme at the window level instead of preferredColorScheme
SwiftUI's .preferredColorScheme on the root view could not revert from dark back to light/system while a sheet was presented, and on macOS it never applied to secondary window scenes such as Settings. The override is now applied directly to UIKit/AppKit instead. - SettingsManager.applyTheme sets overrideUserInterfaceStyle on every window of every connected scene (iOS) or NSApp.appearance (macOS); the theme setter calls it, so any future code path that changes the theme outside the setter must do the same - AppTheme gains userInterfaceStyle / appearance mappings, with .system resolving to .unspecified / nil so the OS setting takes over again - Applied on app appear for the initial launch state, and after both iCloud sync paths, since theme can arrive as a synced change and is no longer driven by SwiftUI state Claude-Session: https://claude.ai/code/session_0154KH8RAVAvm6iVanhmoW8o
This commit is contained in:
@@ -70,7 +70,6 @@ struct YatteeApp: App {
|
||||
ContentView()
|
||||
.appEnvironment(appEnvironment)
|
||||
#if !os(tvOS)
|
||||
.preferredColorScheme(appEnvironment.settingsManager.theme.colorScheme)
|
||||
.tint(appEnvironment.settingsManager.resolvedAccentColor)
|
||||
#endif
|
||||
#if os(macOS)
|
||||
@@ -85,6 +84,9 @@ struct YatteeApp: App {
|
||||
handleContinuedActivity(activity)
|
||||
}
|
||||
.onAppear {
|
||||
#if !os(tvOS)
|
||||
SettingsManager.applyTheme(appEnvironment.settingsManager.theme)
|
||||
#endif
|
||||
registerBackgroundTasksIfNeeded()
|
||||
#if os(tvOS)
|
||||
TopShelfSnapshotWriter.startObserving(dataManager: appEnvironment.dataManager)
|
||||
|
||||
Reference in New Issue
Block a user