From 74206676f244c04b2f798ba34fa90fb19cfa580b Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 2 Jul 2023 21:12:34 +0100 Subject: [PATCH] chore: Remove macOS 12 & 13 availability provisions now the minimum build target is macOS 13 --- auto-clicker/Build Assets/Info.plist | 2 +- auto-clicker/Enums/Colour.swift | 30 +++-------------- auto-clicker/Services/MenuBarService.swift | 10 ++---- .../Tabs/GeneralSettingsTabView.swift | 32 +++++++++---------- 4 files changed, 24 insertions(+), 50 deletions(-) diff --git a/auto-clicker/Build Assets/Info.plist b/auto-clicker/Build Assets/Info.plist index d40f5f7..4cc756c 100644 --- a/auto-clicker/Build Assets/Info.plist +++ b/auto-clicker/Build Assets/Info.plist @@ -30,7 +30,7 @@ CFBundleVersion - 73c8f66 + 0e7ad81 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/auto-clicker/Enums/Colour.swift b/auto-clicker/Enums/Colour.swift index f11ef06..e3a1b9c 100644 --- a/auto-clicker/Enums/Colour.swift +++ b/auto-clicker/Enums/Colour.swift @@ -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: @@ -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: diff --git a/auto-clicker/Services/MenuBarService.swift b/auto-clicker/Services/MenuBarService.swift index fa798f7..3a4a72e 100644 --- a/auto-clicker/Services/MenuBarService.swift +++ b/auto-clicker/Services/MenuBarService.swift @@ -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) } @@ -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) { diff --git a/auto-clicker/Views/Settings/Tabs/GeneralSettingsTabView.swift b/auto-clicker/Views/Settings/Tabs/GeneralSettingsTabView.swift index a914f25..0abf018 100644 --- a/auto-clicker/Views/Settings/Tabs/GeneralSettingsTabView.swift +++ b/auto-clicker/Views/Settings/Tabs/GeneralSettingsTabView.swift @@ -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) } }