Browse Source

Older Xcode compatibility!

pull/92/head
Abhishek 4 years ago
parent
commit
a0184e52d5
  1. 7
      Clocker/Onboarding/OnboardingParentViewController.swift
  2. 18
      Clocker/Overall App/Themer.swift
  3. 2
      Clocker/Panel/ParentPanelController.swift
  4. 3
      Clocker/Panel/UI/TimezoneDataSource.swift

7
Clocker/Onboarding/OnboardingParentViewController.swift

@ -69,10 +69,9 @@ class OnboardingParentViewController: NSViewController {
[negativeButton, backButton].forEach { $0?.isHidden = true }
if #available(OSX 10.16, *) {
negativeButton.controlSize = .large
positiveButton.controlSize = .large
backButton.image = NSImage(systemSymbolName: "chevron.left.circle.fill",
accessibilityDescription: nil)
// negativeButton.controlSize = .large
// positiveButton.controlSize = .large
backButton.image = Themer.shared().symbolImage(for: "chevron.left.circle.fill", "back-button")
} else {
backButton.title = NSLocalizedString("Back",
comment: "Button title for going back to the previous screen")

18
Clocker/Overall App/Themer.swift

@ -152,8 +152,7 @@ extension Themer {
func shutdownImage() -> NSImage {
if #available(macOS 10.16, *) {
return NSImage(systemSymbolName: "ellipsis.circle",
accessibilityDescription: nil)!
return symbolImage(for: "ellipsis.circle", nil)
}
if #available(macOS 10.14, *) {
@ -172,8 +171,7 @@ extension Themer {
func preferenceImage() -> NSImage {
if #available(macOS 10.16, *) {
return NSImage(systemSymbolName: "gear",
accessibilityDescription: nil)!
return symbolImage(for: "gear", nil)
}
if #available(macOS 10.14, *) {
@ -195,8 +193,7 @@ extension Themer {
func pinImage() -> NSImage {
if #available(macOS 10.16, *) {
return NSImage(systemSymbolName: "macwindow.on.rectangle",
accessibilityDescription: nil)!
return symbolImage(for: "macwindow.on.rectangle", nil)
}
if #available(macOS 10.14, *) {
@ -320,8 +317,7 @@ extension Themer {
func sharingImage() -> NSImage {
if #available(macOS 10.16, *) {
return NSImage(systemSymbolName: "square.and.arrow.up.on.square.fill",
accessibilityDescription: nil)!
return symbolImage(for: "square.and.arrow.up.on.square.fill", nil)
}
if #available(macOS 10.14, *) {
@ -448,4 +444,10 @@ extension Themer {
NSColor(deviceRed: 241.0 / 255.0, green: 241.0 / 255.0, blue: 241.0 / 255.0, alpha: 1.0) :
NSColor(deviceRed: 42.0 / 255.0, green: 55.0 / 255.0, blue: 62.0 / 255.0, alpha: 1.0)
}
func symbolImage(for _: String, _: String?) -> NSImage {
// Dummy image for older xcodes
return NSImage(named: NSImage.Name("Calendar Tab Icon"))!
// return NSImage(systemSymbolName: name, accessibilityDescription: accessibilityDescription)!
}
}

2
Clocker/Panel/ParentPanelController.swift

@ -168,7 +168,7 @@ class ParentPanelController: NSWindowController {
showDebugVersionViewIfNeccesary()
if #available(macOS 10.16, *) {
mainTableView.style = .fullWidth
// mainTableView.style = .fullWidth
}
}

3
Clocker/Panel/UI/TimezoneDataSource.swift

@ -135,8 +135,7 @@ extension TimezoneDataSource: NSTableViewDataSource, NSTableViewDelegate {
})
if #available(OSX 10.16, *) {
swipeToDelete.image = NSImage(systemSymbolName: "trash.fill",
accessibilityDescription: nil)
swipeToDelete.image = Themer.shared().symbolImage(for: "trash.fill", "Trash Button")
} else {
swipeToDelete.image = NSImage(named: NSImage.Name("Trash"))
}

Loading…
Cancel
Save