fix: remove unused showMenuBarIcon from AppSettings and conditionally apply theme backgrounds

This commit is contained in:
nimbold
2026-06-03 05:17:17 +03:30
parent f6d34caaf1
commit c4f02ff78f
4 changed files with 23 additions and 13 deletions
-8
View File
@@ -76,10 +76,6 @@ final class AppSettings: ObservableObject {
@Published var listRowDensity: ListRowDensity = .standard {
didSet { save() }
}
@Published var showMenuBarIcon: Bool = true {
didSet { save() }
}
@Published var perServerConnections: Int {
didSet {
@@ -148,7 +144,6 @@ final class AppSettings: ObservableObject {
appTheme = stored.appTheme ?? .system
appFontSize = stored.appFontSize ?? .standard
listRowDensity = stored.listRowDensity ?? .standard
showMenuBarIcon = stored.showMenuBarIcon ?? true
perServerConnections = min(max(stored.perServerConnections, 1), 16)
maxConcurrentDownloads = min(max(stored.maxConcurrentDownloads ?? 3, 1), 12)
globalSpeedLimitKiBPerSecond = min(max(stored.globalSpeedLimitKiBPerSecond ?? 0, 0), 10_485_760)
@@ -160,7 +155,6 @@ final class AppSettings: ObservableObject {
appTheme = .system
appFontSize = .standard
listRowDensity = .standard
showMenuBarIcon = true
perServerConnections = 16
maxConcurrentDownloads = 3
globalSpeedLimitKiBPerSecond = 0
@@ -245,7 +239,6 @@ final class AppSettings: ObservableObject {
appTheme: appTheme,
appFontSize: appFontSize,
listRowDensity: listRowDensity,
showMenuBarIcon: showMenuBarIcon,
perServerConnections: perServerConnections,
maxConcurrentDownloads: maxConcurrentDownloads,
globalSpeedLimitKiBPerSecond: globalSpeedLimitKiBPerSecond,
@@ -308,7 +301,6 @@ private struct StoredSettings: Codable {
var appTheme: AppTheme?
var appFontSize: AppFontSize?
var listRowDensity: ListRowDensity?
var showMenuBarIcon: Bool?
var perServerConnections: Int
var maxConcurrentDownloads: Int?
var globalSpeedLimitKiBPerSecond: Int?
+2 -4
View File
@@ -13,12 +13,10 @@ struct ContentView: View {
NavigationSplitView {
SidebarView(selection: $sidebarSelection)
.navigationSplitViewColumnWidth(min: 190, ideal: 220, max: 260)
.scrollContentBackground(.hidden)
.background(settings.appTheme.theme.secondaryBackground ?? Color(NSColor.windowBackgroundColor))
.themeBackground(settings.appTheme.theme.secondaryBackground)
} detail: {
detailView
.scrollContentBackground(.hidden)
.background(settings.appTheme.theme.background ?? Color(NSColor.windowBackgroundColor))
.themeBackground(settings.appTheme.theme.background)
}
}
+1 -1
View File
@@ -73,7 +73,7 @@ struct SettingsView: View {
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
.background(settings.appTheme.theme.background ?? Color(NSColor.windowBackgroundColor))
.themeBackground(settings.appTheme.theme.background)
}
private var settingsSidebar: some View {
+20
View File
@@ -118,3 +118,23 @@ struct AppThemeModifier: ViewModifier {
}
}
}
struct ThemeBackgroundModifier: ViewModifier {
let color: Color?
func body(content: Content) -> some View {
if let color {
content
.scrollContentBackground(.hidden)
.background(color)
} else {
content
}
}
}
extension View {
func themeBackground(_ color: Color?) -> some View {
modifier(ThemeBackgroundModifier(color: color))
}
}