Skip to content

Commit

Permalink
fix(settings): use SettingsLink to open Settings on Sonoma
Browse files Browse the repository at this point in the history
so now there are 3 different methods to open settings/preferences, each only working on a specific macOS version
  • Loading branch information
cryptoAlgorithm committed Sep 26, 2023
1 parent 4c21d3e commit 151ffc7
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions Swiftcord/Views/User/CurrentUserFooter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,19 +180,29 @@ struct CurrentUserFooter: View {

Spacer()

Button(action: {
if #available(macOS 13.0, *) {
NSApp.sendAction(Selector(("showSettingsWindow:")), to: nil, from: nil)
} else {
NSApp.sendAction(Selector(("showPreferencesWindow:")), to: nil, from: nil)
if #available(macOS 14.0, *) {
SettingsLink {
Image(systemName: "gear")
.font(.system(size: 18))
.opacity(0.75)
}
}, label: {
Image(systemName: "gear")
.font(.system(size: 18))
.opacity(0.75)
})
.buttonStyle(.plain)
.frame(width: 32, height: 32)
.buttonStyle(.plain)
.frame(width: 32, height: 32)
} else {
Button {
if #unavailable(macOS 13.0) {
NSApp.sendAction(Selector(("showPreferencesWindow:")), to: nil, from: nil)
} else if #unavailable(macOS 14.0) {
NSApp.sendAction(Selector(("showSettingsWindow:")), to: nil, from: nil)
}
} label: {
Image(systemName: "gear")
.font(.system(size: 18))
.opacity(0.75)
}
.buttonStyle(.plain)
.frame(width: 32, height: 32)
}
}
.frame(height: 52)
.padding(.horizontal, 8)
Expand Down

0 comments on commit 151ffc7

Please sign in to comment.