Skip to content

Commit 0f03dcc

Browse files
committed
feat: changed minimum macOS version to macOS 11.15 (Big Sur)
1 parent 20030a2 commit 0f03dcc

File tree

27 files changed

+99
-219
lines changed

27 files changed

+99
-219
lines changed

Kit/Widgets/Stack.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,7 @@ private class OrderTableView: NSView, NSTableViewDelegate, NSTableViewDataSource
347347
self.tableView.registerForDraggedTypes([dragDropType])
348348
self.tableView.gridColor = .gridColor
349349
self.tableView.gridStyleMask = [.solidVerticalGridLineMask, .solidHorizontalGridLineMask]
350-
if #available(macOS 11.0, *) {
351-
self.tableView.style = .plain
352-
}
350+
self.tableView.style = .plain
353351

354352
self.tableView.addTableColumn(NSTableColumn(identifier: NSUserInterfaceItemIdentifier(rawValue: "name")))
355353

Kit/constants.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,7 @@ public struct Widget_c_s {
3737
}
3838
}
3939
public var margin: CGPoint {
40-
get {
41-
var point: CGPoint = CGPoint(x: 2, y: 2)
42-
if #available(macOS 11.0, *) {
43-
point.x = 0
44-
}
45-
return point
46-
}
40+
get { CGPoint(x: 0, y: 2) }
4741
}
4842
public let spacing: CGFloat = 2
4943
}

Kit/extensions.swift

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -597,18 +597,8 @@ extension CGFloat {
597597
public class KeyboardShartcutView: NSStackView {
598598
private let callback: (_ value: [UInt16]) -> Void
599599

600-
private var startIcon: NSImage {
601-
if #available(macOS 12.0, *), let icon = iconFromSymbol(name: "record.circle", scale: .large) {
602-
return icon
603-
}
604-
return NSImage(named: NSImage.Name("record"))!
605-
}
606-
private var stopIcon: NSImage {
607-
if #available(macOS 12.0, *), let icon = iconFromSymbol(name: "stop.circle.fill", scale: .large) {
608-
return icon
609-
}
610-
return NSImage(named: NSImage.Name("stop"))!
611-
}
600+
private var startIcon: NSImage { iconFromSymbol(name: "record.circle", scale: .large) }
601+
private var stopIcon: NSImage { iconFromSymbol(name: "stop.circle.fill", scale: .large) }
612602

613603
private var valueField: NSTextField? = nil
614604
private var startButton: NSButton? = nil

Kit/helpers.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,13 +1211,12 @@ public func controlState(_ sender: NSControl) -> Bool {
12111211
return state == .on
12121212
}
12131213

1214-
@available(macOS 11.0, *)
1215-
public func iconFromSymbol(name: String, scale: NSImage.SymbolScale) -> NSImage? {
1214+
public func iconFromSymbol(name: String, scale: NSImage.SymbolScale) -> NSImage {
12161215
let config = NSImage.SymbolConfiguration(textStyle: .body, scale: scale)
1217-
if let symbol = NSImage(systemSymbolName: name, accessibilityDescription: nil) {
1218-
return symbol.withSymbolConfiguration(config)
1216+
if let symbol = NSImage(systemSymbolName: name, accessibilityDescription: nil), let icon = symbol.withSymbolConfiguration(config) {
1217+
return icon
12191218
}
1220-
return nil
1219+
return NSImage()
12211220
}
12221221

12231222
public func showAlert(_ message: String, _ information: String? = nil, _ style: NSAlert.Style = .informational) {

Kit/module/module.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ public struct module_c {
2828
if let state = dict["State"] as? Bool {
2929
self.defaultState = state
3030
}
31-
if let symbol = dict["Symbol"] as? String, #available(macOS 11.0, *) {
31+
if let symbol = dict["Symbol"] as? String {
3232
self.icon = NSImage(systemSymbolName: symbol, accessibilityDescription: nil)
3333
}
34-
if self.icon == nil, #available(macOS 11.0, *), let symbol = dict["AlternativeSymbol"] as? String {
34+
if self.icon == nil, let symbol = dict["AlternativeSymbol"] as? String {
3535
self.icon = NSImage(systemSymbolName: symbol, accessibilityDescription: nil)
3636
}
3737

Kit/module/settings.swift

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -678,18 +678,8 @@ private class ButtonSelectorView: NSStackView {
678678
return view
679679
}()
680680

681-
private var settingsIcon: NSImage {
682-
if #available(macOS 12.0, *), let icon = iconFromSymbol(name: "gear", scale: .large) {
683-
return icon
684-
}
685-
return NSImage(named: NSImage.Name("settings"))!
686-
}
687-
private var previewIcon: NSImage {
688-
if #available(macOS 12.0, *), let icon = iconFromSymbol(name: "command", scale: .large) {
689-
return icon
690-
}
691-
return NSImage(named: NSImage.Name("chart"))!
692-
}
681+
private var settingsIcon: NSImage { iconFromSymbol(name: "gear", scale: .large) }
682+
private var previewIcon: NSImage { iconFromSymbol(name: "command", scale: .large) }
693683

694684
private var button: NSButton? = nil
695685
private var isSettingsEnabled: Bool = false

Kit/types.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ public struct ColorValue: Equatable {
3232
self.color = color
3333
}
3434

35-
// swiftlint:disable operator_whitespace
35+
// swiftlint:disable function_name_whitespace
3636
public static func ==(lhs: ColorValue, rhs: ColorValue) -> Bool {
3737
return lhs.value == rhs.value
3838
}
39-
// swiftlint:enable operator_whitespace
39+
// swiftlint:enable function_name_whitespace
4040
}
4141

4242
public enum AppUpdateInterval: String {

LaunchAtLogin/main.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ func main() {
1717

1818
let pathComponents = (Bundle.main.bundlePath as NSString).pathComponents
1919
let mainPath = NSString.path(withComponents: Array(pathComponents[0...(pathComponents.count - 5)]))
20-
NSWorkspace.shared.launchApplication(mainPath)
21-
22-
exit(0)
20+
NSWorkspace.shared.openApplication(at: NSURL.fileURL(withPath: mainPath), configuration: NSWorkspace.OpenConfiguration(), completionHandler: { _, _ in
21+
exit(0)
22+
})
2323
}
2424

2525
main()

Modules/Bluetooth/readers.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,6 @@ internal class DevicesReader: Reader<[BLEDevice]>, CBCentralManagerDelegate, CBP
225225
// MARK: - system_profiler
226226

227227
private func profilerDevices() -> ([bleDevice], [String]) {
228-
if #unavailable(macOS 11) { return ([], []) }
229-
230228
guard let res = process(path: "/usr/sbin/system_profiler", arguments: ["SPBluetoothDataType", "-json"]) else {
231229
return ([], [])
232230
}

Modules/CPU/main.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,11 @@ public class CPU: Module {
238238
}
239239

240240
if self.systemWidgetsUpdatesState {
241-
if #available(macOS 11.0, *) {
242-
if isWidgetActive(self.userDefaults, [CPU_entry.kind, "UnitedWidget"]), let blobData = try? JSONEncoder().encode(value) {
243-
self.userDefaults?.set(blobData, forKey: "CPU@LoadReader")
244-
}
245-
WidgetCenter.shared.reloadTimelines(ofKind: CPU_entry.kind)
246-
WidgetCenter.shared.reloadTimelines(ofKind: "UnitedWidget")
241+
if isWidgetActive(self.userDefaults, [CPU_entry.kind, "UnitedWidget"]), let blobData = try? JSONEncoder().encode(value) {
242+
self.userDefaults?.set(blobData, forKey: "CPU@LoadReader")
247243
}
244+
WidgetCenter.shared.reloadTimelines(ofKind: CPU_entry.kind)
245+
WidgetCenter.shared.reloadTimelines(ofKind: "UnitedWidget")
248246
}
249247
}
250248
}

0 commit comments

Comments
 (0)