mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Merge pull request #2259 from stuartbreckenridge/feature/mac-preferences
Mac Preferences
This commit is contained in:
@@ -138,6 +138,17 @@ final class AppDefaults: ObservableObject {
|
||||
}
|
||||
}
|
||||
|
||||
static var userInterfaceColorScheme: ColorScheme? {
|
||||
switch AppDefaults.shared.userInterfaceColorPalette {
|
||||
case .light:
|
||||
return ColorScheme.light
|
||||
case .dark:
|
||||
return ColorScheme.dark
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Feeds & Folders
|
||||
@AppStorage(Key.addWebFeedAccountID, store: store) var addWebFeedAccountID: String?
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ struct MainApp: App {
|
||||
@StateObject private var refreshProgress = RefreshProgressModel()
|
||||
@StateObject private var defaults = AppDefaults.shared
|
||||
|
||||
|
||||
@SceneBuilder var body: some Scene {
|
||||
#if os(macOS)
|
||||
WindowGroup {
|
||||
@@ -29,6 +30,7 @@ struct MainApp: App {
|
||||
.onAppear { refreshProgress.startup() }
|
||||
.environmentObject(refreshProgress)
|
||||
.environmentObject(defaults)
|
||||
.preferredColorScheme(AppDefaults.userInterfaceColorScheme)
|
||||
}
|
||||
.windowToolbarStyle(UnifiedWindowToolbarStyle())
|
||||
.commands {
|
||||
@@ -72,6 +74,7 @@ struct MainApp: App {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// Mac Preferences
|
||||
Settings {
|
||||
MacPreferencesView()
|
||||
@@ -79,8 +82,8 @@ struct MainApp: App {
|
||||
.frame(width: 500)
|
||||
.navigationTitle("Preferences")
|
||||
.environmentObject(defaults)
|
||||
.preferredColorScheme(AppDefaults.userInterfaceColorScheme)
|
||||
}
|
||||
.windowToolbarStyle(UnifiedWindowToolbarStyle())
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user