Skip to content

Commit

Permalink
chore: Remove macOS 12 & 13 availability provisions now the minimum b…
Browse files Browse the repository at this point in the history
…uild target is macOS 13
  • Loading branch information
othyn committed Jul 2, 2023
1 parent 0e7ad81 commit 7420667
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 50 deletions.
2 changes: 1 addition & 1 deletion auto-clicker/Build Assets/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>73c8f66</string>
<string>0e7ad81</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
30 changes: 5 additions & 25 deletions auto-clicker/Enums/Colour.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,33 +72,17 @@ enum Colour: ThemeColour, Identifiable, CaseIterable, Codable {
case .Blue:
return .blue
case .Brown:
if #available(macOS 12.0, *) {
return Color.brown
} else {
return Color(.sRGBLinear, red: 163, green: 132, blue: 94, opacity: 1)
}
return Color.brown
case .Cyan:
if #available(macOS 12.0, *) {
return Color.cyan
} else {
return Color(.sRGBLinear, red: 84, green: 190, blue: 240, opacity: 1)
}
return Color.cyan
case .Gray:
return .gray
case .Green:
return .green
case .Indigo:
if #available(macOS 12.0, *) {
return Color.indigo
} else {
return Color(.sRGBLinear, red: 88, green: 86, blue: 215, opacity: 1)
}
return Color.indigo
case .Mint:
if #available(macOS 12.0, *) {
return Color.mint
} else {
return Color(.sRGBLinear, red: 3, green: 199, blue: 191, opacity: 1)
}
return Color.mint
case .Orange:
return .orange
case .Pink:
Expand All @@ -108,11 +92,7 @@ enum Colour: ThemeColour, Identifiable, CaseIterable, Codable {
case .Red:
return .red
case .Teal:
if #available(macOS 12.0, *) {
return Color.teal
} else {
return Color(.sRGBLinear, red: 89, green: 173, blue: 196, opacity: 1)
}
return Color.teal
case .White:
return .white
case .Yellow:
Expand Down
10 changes: 3 additions & 7 deletions auto-clicker/Services/MenuBarService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ final class MenuBarService {
}

static func changeImageColor(newColor: NSColor) {
if Defaults[.menuBarShowDynamicIcon], #available(macOS 12.0, *),
let statusBarButton = self.statusBarItem!.button {
if Defaults[.menuBarShowDynamicIcon],
let statusBarButton = self.statusBarItem!.button {
let config = NSImage.SymbolConfiguration(paletteColors: [.white, newColor])
statusBarButton.image = statusBarButton.image!.withSymbolConfiguration(config)
}
Expand Down Expand Up @@ -243,11 +243,7 @@ final class MenuBarService {
NSApp.activate(ignoringOtherApps: true)

// https://stackoverflow.com/questions/65355696/how-to-programatically-open-settings-window-in-a-macos-swiftui-app
if #available(macOS 13, *) {
NSApp.sendAction(Selector(("showSettingsWindow:")), to: nil, from: nil)
} else {
NSApp.sendAction(Selector(("showPreferencesWindow:")), to: nil, from: nil)
}
NSApp.sendAction(Selector(("showSettingsWindow:")), to: nil, from: nil)
}

@objc static func menuActionAbout(sender: NSMenuItem) {
Expand Down
32 changes: 15 additions & 17 deletions auto-clicker/Views/Settings/Tabs/GeneralSettingsTabView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,22 @@ struct GeneralSettingsTabView: View {
}
}

if #available(macOS 12.0, *) {
SettingsTabItemView(
help: "settings_general_menu_bar_show_dynamic_icon_help"
) {
HStack {
Defaults.Toggle(
" " + String(format: NSLocalizedString("settings_general_menu_bar_show_dynamic_icon", comment: "Dynamic icon in menu bar toggle")),
key: .menuBarShowDynamicIcon
)
.disabled(!self.menuBarShowIcon)
SettingsTabItemView(
help: "settings_general_menu_bar_show_dynamic_icon_help"
) {
HStack {
Defaults.Toggle(
" " + String(format: NSLocalizedString("settings_general_menu_bar_show_dynamic_icon", comment: "Dynamic icon in menu bar toggle")),
key: .menuBarShowDynamicIcon
)
.disabled(!self.menuBarShowIcon)

Image(systemName: "cursorarrow.click.badge.clock")
.symbolRenderingMode(.palette)
.foregroundStyle(.white, .orange)
Image(systemName: "cursorarrow.click.badge.clock")
.symbolRenderingMode(.palette)
.foregroundStyle(.white, .green)
}
Image(systemName: "cursorarrow.click.badge.clock")
.symbolRenderingMode(.palette)
.foregroundStyle(.white, .orange)
Image(systemName: "cursorarrow.click.badge.clock")
.symbolRenderingMode(.palette)
.foregroundStyle(.white, .green)
}
}

Expand Down

0 comments on commit 7420667

Please sign in to comment.