mirror of
https://github.com/nimbold/Firelink.git
synced 2026-07-27 20:40:12 +00:00
fix: remove unused showMenuBarIcon from AppSettings and conditionally apply theme backgrounds
This commit is contained in:
@@ -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?
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user