mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-31 04:58:11 +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 {
|
@Published var listRowDensity: ListRowDensity = .standard {
|
||||||
didSet { save() }
|
didSet { save() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Published var showMenuBarIcon: Bool = true {
|
|
||||||
didSet { save() }
|
|
||||||
}
|
|
||||||
|
|
||||||
@Published var perServerConnections: Int {
|
@Published var perServerConnections: Int {
|
||||||
didSet {
|
didSet {
|
||||||
@@ -148,7 +144,6 @@ final class AppSettings: ObservableObject {
|
|||||||
appTheme = stored.appTheme ?? .system
|
appTheme = stored.appTheme ?? .system
|
||||||
appFontSize = stored.appFontSize ?? .standard
|
appFontSize = stored.appFontSize ?? .standard
|
||||||
listRowDensity = stored.listRowDensity ?? .standard
|
listRowDensity = stored.listRowDensity ?? .standard
|
||||||
showMenuBarIcon = stored.showMenuBarIcon ?? true
|
|
||||||
perServerConnections = min(max(stored.perServerConnections, 1), 16)
|
perServerConnections = min(max(stored.perServerConnections, 1), 16)
|
||||||
maxConcurrentDownloads = min(max(stored.maxConcurrentDownloads ?? 3, 1), 12)
|
maxConcurrentDownloads = min(max(stored.maxConcurrentDownloads ?? 3, 1), 12)
|
||||||
globalSpeedLimitKiBPerSecond = min(max(stored.globalSpeedLimitKiBPerSecond ?? 0, 0), 10_485_760)
|
globalSpeedLimitKiBPerSecond = min(max(stored.globalSpeedLimitKiBPerSecond ?? 0, 0), 10_485_760)
|
||||||
@@ -160,7 +155,6 @@ final class AppSettings: ObservableObject {
|
|||||||
appTheme = .system
|
appTheme = .system
|
||||||
appFontSize = .standard
|
appFontSize = .standard
|
||||||
listRowDensity = .standard
|
listRowDensity = .standard
|
||||||
showMenuBarIcon = true
|
|
||||||
perServerConnections = 16
|
perServerConnections = 16
|
||||||
maxConcurrentDownloads = 3
|
maxConcurrentDownloads = 3
|
||||||
globalSpeedLimitKiBPerSecond = 0
|
globalSpeedLimitKiBPerSecond = 0
|
||||||
@@ -245,7 +239,6 @@ final class AppSettings: ObservableObject {
|
|||||||
appTheme: appTheme,
|
appTheme: appTheme,
|
||||||
appFontSize: appFontSize,
|
appFontSize: appFontSize,
|
||||||
listRowDensity: listRowDensity,
|
listRowDensity: listRowDensity,
|
||||||
showMenuBarIcon: showMenuBarIcon,
|
|
||||||
perServerConnections: perServerConnections,
|
perServerConnections: perServerConnections,
|
||||||
maxConcurrentDownloads: maxConcurrentDownloads,
|
maxConcurrentDownloads: maxConcurrentDownloads,
|
||||||
globalSpeedLimitKiBPerSecond: globalSpeedLimitKiBPerSecond,
|
globalSpeedLimitKiBPerSecond: globalSpeedLimitKiBPerSecond,
|
||||||
@@ -308,7 +301,6 @@ private struct StoredSettings: Codable {
|
|||||||
var appTheme: AppTheme?
|
var appTheme: AppTheme?
|
||||||
var appFontSize: AppFontSize?
|
var appFontSize: AppFontSize?
|
||||||
var listRowDensity: ListRowDensity?
|
var listRowDensity: ListRowDensity?
|
||||||
var showMenuBarIcon: Bool?
|
|
||||||
var perServerConnections: Int
|
var perServerConnections: Int
|
||||||
var maxConcurrentDownloads: Int?
|
var maxConcurrentDownloads: Int?
|
||||||
var globalSpeedLimitKiBPerSecond: Int?
|
var globalSpeedLimitKiBPerSecond: Int?
|
||||||
|
|||||||
@@ -13,12 +13,10 @@ struct ContentView: View {
|
|||||||
NavigationSplitView {
|
NavigationSplitView {
|
||||||
SidebarView(selection: $sidebarSelection)
|
SidebarView(selection: $sidebarSelection)
|
||||||
.navigationSplitViewColumnWidth(min: 190, ideal: 220, max: 260)
|
.navigationSplitViewColumnWidth(min: 190, ideal: 220, max: 260)
|
||||||
.scrollContentBackground(.hidden)
|
.themeBackground(settings.appTheme.theme.secondaryBackground)
|
||||||
.background(settings.appTheme.theme.secondaryBackground ?? Color(NSColor.windowBackgroundColor))
|
|
||||||
} detail: {
|
} detail: {
|
||||||
detailView
|
detailView
|
||||||
.scrollContentBackground(.hidden)
|
.themeBackground(settings.appTheme.theme.background)
|
||||||
.background(settings.appTheme.theme.background ?? Color(NSColor.windowBackgroundColor))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ struct SettingsView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
.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 {
|
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