Skip to content

Commit

Permalink
Make things more readable.
Browse files Browse the repository at this point in the history
  • Loading branch information
n0shake committed Apr 16, 2022
1 parent e76b983 commit 33623d4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Clocker/Dependencies/Date Additions/Date+Comparators.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public extension Date {
* - returns: A TimeChunk representing the time between the dates, in natural form
*/
func chunkBetween(date: Date) -> TimeChunk {
let components : Set<Calendar.Component> = [.year, .month, .day, .hour, .minute, .second]
let components: Set<Calendar.Component> = [.year, .month, .day, .hour, .minute, .second]
let compenentsBetween = Calendar.autoupdatingCurrent.dateComponents(components, from: self, to: date)
return TimeChunk(seconds: compenentsBetween.second!,
minutes: compenentsBetween.minute!,
Expand Down
5 changes: 4 additions & 1 deletion Clocker/Onboarding/OnboardingSearchController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,10 @@ extension OnboardingSearchController: NSTableViewDataSource {
}

func tableView(_ tableView: NSTableView, viewFor _: NSTableColumn?, row: Int) -> NSView? {
if let result = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "resultCellView"), owner: self) as? ResultTableViewCell, row >= 0, row < searchResultsDataSource.resultsCount() {
if let result = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "resultCellView"), owner: self) as? ResultTableViewCell,
row >= 0,
row < searchResultsDataSource.resultsCount()
{
let currentSelection = searchResultsDataSource.retrieveResult(row)
if let timezone = currentSelection as? TimezoneMetadata {
result.result.stringValue = " \(timezone.formattedName)"
Expand Down
5 changes: 4 additions & 1 deletion Clocker/Panel/UI/TimezoneDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ extension TimezoneDataSource: NSTableViewDataSource, NSTableViewDelegate {
return 100
}

if let userFontSize = DataStore.shared().retrieve(key: CLUserFontSizePreference) as? NSNumber, timezones.count > row, let relativeDisplay = DataStore.shared().retrieve(key: CLRelativeDateKey) as? NSNumber {
if let userFontSize = DataStore.shared().retrieve(key: CLUserFontSizePreference) as? NSNumber,
timezones.count > row,
let relativeDisplay = DataStore.shared().retrieve(key: CLRelativeDateKey) as? NSNumber
{
let model = timezones[row]
let shouldShowSunrise = DataStore.shared().shouldDisplay(.sunrise)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright © 2015 Abhishek Banthia

import AppKit
import Foundation

class UpcomingEventsDataSource: NSObject, NSCollectionViewDataSource, NSCollectionViewDelegateFlowLayout {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,14 @@ class AppFeedbackWindowController: NSWindowController {
guard let timezoneObject = TimezoneData.customObject(from: data) else {
return nil
}
return "Timezone: \(timezoneObject.timezone()) Name: \(timezoneObject.formattedAddress ?? "No") Favourited: \((timezoneObject.isFavourite == 1) ? "Yes" : "No") Note: \(timezoneObject.note ?? "No Note") System: \(timezoneObject.isSystemTimezone ? "Yes" : "No")"
let customString = """
Timezone: \(timezoneObject.timezone())
Name: \(timezoneObject.formattedAddress ?? "No")
Favourited: \((timezoneObject.isFavourite == 1) ? "Yes" : "No")
Note: \(timezoneObject.note ?? "No Note")
System: \(timezoneObject.isSystemTimezone ? "Yes" : "No")"
"""
return customString
}

var relativeDate = "Relative"
Expand Down

0 comments on commit 33623d4

Please sign in to comment.