Browse Source

Older Xcode compatibility!

pull/92/head
Abhishek 4 years ago
parent
commit
a0184e52d5
  1. 7
      Clocker/Onboarding/OnboardingParentViewController.swift
  2. 22
      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 } [negativeButton, backButton].forEach { $0?.isHidden = true }
if #available(OSX 10.16, *) { if #available(OSX 10.16, *) {
negativeButton.controlSize = .large // negativeButton.controlSize = .large
positiveButton.controlSize = .large // positiveButton.controlSize = .large
backButton.image = NSImage(systemSymbolName: "chevron.left.circle.fill", backButton.image = Themer.shared().symbolImage(for: "chevron.left.circle.fill", "back-button")
accessibilityDescription: nil)
} else { } else {
backButton.title = NSLocalizedString("Back", backButton.title = NSLocalizedString("Back",
comment: "Button title for going back to the previous screen") comment: "Button title for going back to the previous screen")

22
Clocker/Overall App/Themer.swift

@ -152,8 +152,7 @@ extension Themer {
func shutdownImage() -> NSImage { func shutdownImage() -> NSImage {
if #available(macOS 10.16, *) { if #available(macOS 10.16, *) {
return NSImage(systemSymbolName: "ellipsis.circle", return symbolImage(for: "ellipsis.circle", nil)
accessibilityDescription: nil)!
} }
if #available(macOS 10.14, *) { if #available(macOS 10.14, *) {
@ -172,8 +171,7 @@ extension Themer {
func preferenceImage() -> NSImage { func preferenceImage() -> NSImage {
if #available(macOS 10.16, *) { if #available(macOS 10.16, *) {
return NSImage(systemSymbolName: "gear", return symbolImage(for: "gear", nil)
accessibilityDescription: nil)!
} }
if #available(macOS 10.14, *) { if #available(macOS 10.14, *) {
@ -189,14 +187,13 @@ extension Themer {
return return
themeIndex == .light themeIndex == .light
? NSImage(named: NSImage.Name("Settings"))! ? NSImage(named: NSImage.Name("Settings"))!
: NSImage(named: NSImage.Name("Settings-White"))! : NSImage(named: NSImage.Name("Settings-White"))!
} }
func pinImage() -> NSImage { func pinImage() -> NSImage {
if #available(macOS 10.16, *) { if #available(macOS 10.16, *) {
return NSImage(systemSymbolName: "macwindow.on.rectangle", return symbolImage(for: "macwindow.on.rectangle", nil)
accessibilityDescription: nil)!
} }
if #available(macOS 10.14, *) { if #available(macOS 10.14, *) {
@ -320,8 +317,7 @@ extension Themer {
func sharingImage() -> NSImage { func sharingImage() -> NSImage {
if #available(macOS 10.16, *) { if #available(macOS 10.16, *) {
return NSImage(systemSymbolName: "square.and.arrow.up.on.square.fill", return symbolImage(for: "square.and.arrow.up.on.square.fill", nil)
accessibilityDescription: nil)!
} }
if #available(macOS 10.14, *) { 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: 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) 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() showDebugVersionViewIfNeccesary()
if #available(macOS 10.16, *) { 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, *) { if #available(OSX 10.16, *) {
swipeToDelete.image = NSImage(systemSymbolName: "trash.fill", swipeToDelete.image = Themer.shared().symbolImage(for: "trash.fill", "Trash Button")
accessibilityDescription: nil)
} else { } else {
swipeToDelete.image = NSImage(named: NSImage.Name("Trash")) swipeToDelete.image = NSImage(named: NSImage.Name("Trash"))
} }

Loading…
Cancel
Save