diff --git a/Clocker/Clocker.xcodeproj/project.pbxproj b/Clocker/Clocker.xcodeproj/project.pbxproj index ede3e51..97c3e30 100755 --- a/Clocker/Clocker.xcodeproj/project.pbxproj +++ b/Clocker/Clocker.xcodeproj/project.pbxproj @@ -1003,10 +1003,9 @@ }; buildConfigurationList = DD4F7BFE13C30F9F00825C6E /* Build configuration list for PBXProject "Clocker" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( - English, en, Base, hi, diff --git a/Clocker/Clocker.xcodeproj/xcuserdata/ban.xcuserdatad/xcschemes/xcschememanagement.plist b/Clocker/Clocker.xcodeproj/xcuserdata/ban.xcuserdatad/xcschemes/xcschememanagement.plist index b07b414..0fc8a42 100644 --- a/Clocker/Clocker.xcodeproj/xcuserdata/ban.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Clocker/Clocker.xcodeproj/xcuserdata/ban.xcuserdatad/xcschemes/xcschememanagement.plist @@ -17,7 +17,7 @@ Tests.xcscheme_^#shared#^_ orderHint - 3 + 1 SuppressBuildableAutocreation diff --git a/Clocker/Clocker/ca.lproj/Localizable.strings b/Clocker/Clocker/ca.lproj/Localizable.strings index 8788d9d..101a685 100644 --- a/Clocker/Clocker/ca.lproj/Localizable.strings +++ b/Clocker/Clocker/ca.lproj/Localizable.strings @@ -84,7 +84,7 @@ // Onboarding Search "Quick Add Locations" = "Quick Add Locations"; "More search options in Clocker Preferences." = "More search options in Clocker Preferences."; -"Search Locations" = "Search Locations"; +"Enter 3 or more characters for locations you'll like to add" = "Enter 3 or more characters for locations you'll like to add"; // Start at Login "Launch at Login" = "Launch at Login"; diff --git a/Clocker/Clocker/de.lproj/Localizable.strings b/Clocker/Clocker/de.lproj/Localizable.strings index df1a520..a54d25a 100644 --- a/Clocker/Clocker/de.lproj/Localizable.strings +++ b/Clocker/Clocker/de.lproj/Localizable.strings @@ -235,7 +235,7 @@ "Search Field Placeholder" = "Enter a city, state or country name"; /* (No Comment) */ -"Search Locations" = "Search Locations"; +"Enter 3 or more characters for locations you'll like to add" = "Enter 3 or more characters for locations you'll like to add"; /* Next Event Label for no Calendar access */ "See your next Calendar event here." = "See your next Calendar event here."; diff --git a/Clocker/Clocker/en.lproj/Localizable.strings b/Clocker/Clocker/en.lproj/Localizable.strings index 8788d9d..101a685 100644 --- a/Clocker/Clocker/en.lproj/Localizable.strings +++ b/Clocker/Clocker/en.lproj/Localizable.strings @@ -84,7 +84,7 @@ // Onboarding Search "Quick Add Locations" = "Quick Add Locations"; "More search options in Clocker Preferences." = "More search options in Clocker Preferences."; -"Search Locations" = "Search Locations"; +"Enter 3 or more characters for locations you'll like to add" = "Enter 3 or more characters for locations you'll like to add"; // Start at Login "Launch at Login" = "Launch at Login"; diff --git a/Clocker/Clocker/es.lproj/Localizable.strings b/Clocker/Clocker/es.lproj/Localizable.strings index 8788d9d..101a685 100644 --- a/Clocker/Clocker/es.lproj/Localizable.strings +++ b/Clocker/Clocker/es.lproj/Localizable.strings @@ -84,7 +84,7 @@ // Onboarding Search "Quick Add Locations" = "Quick Add Locations"; "More search options in Clocker Preferences." = "More search options in Clocker Preferences."; -"Search Locations" = "Search Locations"; +"Enter 3 or more characters for locations you'll like to add" = "Enter 3 or more characters for locations you'll like to add"; // Start at Login "Launch at Login" = "Launch at Login"; diff --git a/Clocker/Clocker/fr.lproj/Localizable.strings b/Clocker/Clocker/fr.lproj/Localizable.strings index 8788d9d..101a685 100644 --- a/Clocker/Clocker/fr.lproj/Localizable.strings +++ b/Clocker/Clocker/fr.lproj/Localizable.strings @@ -84,7 +84,7 @@ // Onboarding Search "Quick Add Locations" = "Quick Add Locations"; "More search options in Clocker Preferences." = "More search options in Clocker Preferences."; -"Search Locations" = "Search Locations"; +"Enter 3 or more characters for locations you'll like to add" = "Enter 3 or more characters for locations you'll like to add"; // Start at Login "Launch at Login" = "Launch at Login"; diff --git a/Clocker/Clocker/hi.lproj/Localizable.strings b/Clocker/Clocker/hi.lproj/Localizable.strings index a8ff086..fc5cb44 100644 --- a/Clocker/Clocker/hi.lproj/Localizable.strings +++ b/Clocker/Clocker/hi.lproj/Localizable.strings @@ -80,7 +80,7 @@ // Onboarding Search "Quick Add Locations" = "Quick Add Locations"; "More search options in Clocker Preferences." = "More search options in Clocker Preferences."; -"Search Locations" = "Search Locations"; +"Enter 3 or more characters for locations you'll like to add" = "Enter 3 or more characters for locations you'll like to add"; // Start at Login "Launch at Login" = "Launch at Login"; diff --git a/Clocker/Clocker/ja.lproj/Localizable.strings b/Clocker/Clocker/ja.lproj/Localizable.strings index 07af75b..ae89694 100644 --- a/Clocker/Clocker/ja.lproj/Localizable.strings +++ b/Clocker/Clocker/ja.lproj/Localizable.strings @@ -83,7 +83,7 @@ // Onboarding Search "Quick Add Locations" = "Quick Add Locations"; "More search options in Clocker Preferences." = "More search options in Clocker Preferences."; -"Search Locations" = "Search Locations"; +"Enter 3 or more characters for locations you'll like to add" = "Enter 3 or more characters for locations you'll like to add"; // Start at Login "Launch at Login" = "Launch at Login"; diff --git a/Clocker/Clocker/ko.lproj/Localizable.strings b/Clocker/Clocker/ko.lproj/Localizable.strings index 07af75b..ae89694 100644 --- a/Clocker/Clocker/ko.lproj/Localizable.strings +++ b/Clocker/Clocker/ko.lproj/Localizable.strings @@ -83,7 +83,7 @@ // Onboarding Search "Quick Add Locations" = "Quick Add Locations"; "More search options in Clocker Preferences." = "More search options in Clocker Preferences."; -"Search Locations" = "Search Locations"; +"Enter 3 or more characters for locations you'll like to add" = "Enter 3 or more characters for locations you'll like to add"; // Start at Login "Launch at Login" = "Launch at Login"; diff --git a/Clocker/Clocker/nl.lproj/Localizable.strings b/Clocker/Clocker/nl.lproj/Localizable.strings index 8788d9d..101a685 100644 --- a/Clocker/Clocker/nl.lproj/Localizable.strings +++ b/Clocker/Clocker/nl.lproj/Localizable.strings @@ -84,7 +84,7 @@ // Onboarding Search "Quick Add Locations" = "Quick Add Locations"; "More search options in Clocker Preferences." = "More search options in Clocker Preferences."; -"Search Locations" = "Search Locations"; +"Enter 3 or more characters for locations you'll like to add" = "Enter 3 or more characters for locations you'll like to add"; // Start at Login "Launch at Login" = "Launch at Login"; diff --git a/Clocker/Clocker/ru.lproj/Localizable.strings b/Clocker/Clocker/ru.lproj/Localizable.strings index 5630702..75ef1c2 100644 --- a/Clocker/Clocker/ru.lproj/Localizable.strings +++ b/Clocker/Clocker/ru.lproj/Localizable.strings @@ -235,7 +235,7 @@ "Search Field Placeholder" = "Enter a city, state or country name"; /* (No Comment) */ -"Search Locations" = "Search Locations"; +"Enter 3 or more characters for locations you'll like to add" = "Enter 3 or more characters for locations you'll like to add"; /* Next Event Label for no Calendar access */ "See your next Calendar event here." = "See your next Calendar event here."; diff --git a/Clocker/Clocker/zh-Hans.lproj/Localizable.strings b/Clocker/Clocker/zh-Hans.lproj/Localizable.strings index 84acced..b09c24c 100644 --- a/Clocker/Clocker/zh-Hans.lproj/Localizable.strings +++ b/Clocker/Clocker/zh-Hans.lproj/Localizable.strings @@ -235,7 +235,7 @@ "Search Field Placeholder" = "Enter a city, state or country name"; /* (No Comment) */ -"Search Locations" = "Search Locations"; +"Enter 3 or more characters for locations you'll like to add" = "Enter 3 or more characters for locations you'll like to add"; /* Next Event Label for no Calendar access */ "See your next Calendar event here." = "See your next Calendar event here."; diff --git a/Clocker/ClockerUnitTests/ClockerUnitTests.swift b/Clocker/ClockerUnitTests/ClockerUnitTests.swift index c6b1a6d..18cf233 100644 --- a/Clocker/ClockerUnitTests/ClockerUnitTests.swift +++ b/Clocker/ClockerUnitTests/ClockerUnitTests.swift @@ -70,6 +70,53 @@ class ClockerUnitTests: XCTestCase { return TimezoneDataOperations(with: TimezoneData(with: omaha)) } + func testOverridingSecondsComponent_shouldHideSeconds() { + let dummyDefaults = UserDefaults.standard + dummyDefaults.set(NSNumber(value: 0), forKey: CLShowSecondsInMenubar) + dummyDefaults.set(NSNumber(value: 1), forKey: CL24hourFormatSelectedKey) + + let timezoneObjects = [TimezoneData(with: mumbai), + TimezoneData(with: auckland), + TimezoneData(with: california)] + + timezoneObjects.forEach { + let operationsObject = TimezoneDataOperations(with: $0) + let currentTime = operationsObject.time(with: 0) + XCTAssert(currentTime.count == 8) // 8 includes 2 colons + + $0.setShouldOverrideSecondsFormat(1) + let newTime = operationsObject.time(with: 0) + + XCTAssert(newTime.count == 5) // 5 includes colon + } + // Reset + dummyDefaults.set(NSNumber(value: 1), forKey: CLShowSecondsInMenubar) + } + + func testOverridingSecondsComponentFor12HourFormat_shouldHideSeconds() { + let dummyDefaults = UserDefaults.standard + dummyDefaults.set(NSNumber(value: 0), forKey: CLShowSecondsInMenubar) + dummyDefaults.set(NSNumber(value: 0), forKey: CL24hourFormatSelectedKey) + + let timezoneObjects = [TimezoneData(with: mumbai), + TimezoneData(with: auckland), + TimezoneData(with: california)] + + timezoneObjects.forEach { + let operationsObject = TimezoneDataOperations(with: $0) + let currentTime = operationsObject.time(with: 0) + XCTAssert(currentTime.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines).count >= 10) // 8 includes 2 colons + + $0.setShouldOverrideSecondsFormat(1) + let newTime = operationsObject.time(with: 0) + + XCTAssert(newTime.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines).count >= 7) // 5 includes colon + } + // Reset + dummyDefaults.set(NSNumber(value: 1), forKey: CLShowSecondsInMenubar) + dummyDefaults.set(NSNumber(value: 1), forKey: CL24hourFormatSelectedKey) + } + func testAddingATimezoneToDefaults() { let timezoneData = TimezoneData(with: california) @@ -110,7 +157,7 @@ class ClockerUnitTests: XCTestCase { XCTAssertTrue(operations.timeDifference() == ", 12 hours 30 mins ahead", "Difference was unexpectedly: \(operations.timeDifference())") XCTAssertTrue(californiaOperations.timeDifference() == "", "Difference was unexpectedly: \(californiaOperations.timeDifference())") XCTAssertTrue(floridaOperations.timeDifference() == ", 3 hours ahead", "Difference was unexpectedly: \(floridaOperations.timeDifference())") - XCTAssertTrue(aucklandOperations.timeDifference() == ", 19 hours ahead", "Difference was unexpectedly: \(aucklandOperations.timeDifference())") + XCTAssertTrue(aucklandOperations.timeDifference() == ", 20 hours ahead", "Difference was unexpectedly: \(aucklandOperations.timeDifference())") XCTAssertTrue(omahaOperations.timeDifference() == ", 2 hours ahead", "Difference was unexpectedly: \(omahaOperations.timeDifference())") } diff --git a/Clocker/Dependencies/Date Additions/Date+Comparators.swift b/Clocker/Dependencies/Date Additions/Date+Comparators.swift index b358221..8553c69 100755 --- a/Clocker/Dependencies/Date Additions/Date+Comparators.swift +++ b/Clocker/Dependencies/Date Additions/Date+Comparators.swift @@ -43,7 +43,7 @@ public extension Date { * - returns: A TimeChunk representing the time between the dates, in natural form */ func chunkBetween(date: Date) -> TimeChunk { - var compenentsBetween = Calendar.autoupdatingCurrent.dateComponents([.year, .month, .day, .hour, .minute, .second], from: self, to: date) + let compenentsBetween = Calendar.autoupdatingCurrent.dateComponents([.year, .month, .day, .hour, .minute, .second], from: self, to: date) return TimeChunk(seconds: compenentsBetween.second!, minutes: compenentsBetween.minute!, hours: compenentsBetween.hour!, days: compenentsBetween.day!, weeks: 0, months: compenentsBetween.month!, years: compenentsBetween.year!) // TimeChunk(seconds: secondDelta, minutes: minuteDelta, hours: hourDelta, days: dayDelta, weeks: 0, months: monthDelta, years: yearDelta) } diff --git a/Clocker/Dependencies/Date Additions/TimePeriodGroup.swift b/Clocker/Dependencies/Date Additions/TimePeriodGroup.swift index 4980706..27a40c1 100755 --- a/Clocker/Dependencies/Date Additions/TimePeriodGroup.swift +++ b/Clocker/Dependencies/Date Additions/TimePeriodGroup.swift @@ -114,7 +114,7 @@ open class TimePeriodGroup: Sequence { return false // No need to sorting if they already have different counts } - var compArray1: [TimePeriodProtocol] = array1.sorted { (period1: TimePeriodProtocol, period2: TimePeriodProtocol) -> Bool in + let compArray1: [TimePeriodProtocol] = array1.sorted { (period1: TimePeriodProtocol, period2: TimePeriodProtocol) -> Bool in if period1.beginning == nil, period2.beginning == nil { return false } else if period1.beginning == nil { @@ -125,7 +125,7 @@ open class TimePeriodGroup: Sequence { return period2.beginning! < period1.beginning! } } - var compArray2: [TimePeriodProtocol] = array2.sorted { (period1: TimePeriodProtocol, period2: TimePeriodProtocol) -> Bool in + let compArray2: [TimePeriodProtocol] = array2.sorted { (period1: TimePeriodProtocol, period2: TimePeriodProtocol) -> Bool in if period1.beginning == nil, period2.beginning == nil { return false } else if period1.beginning == nil { diff --git a/Clocker/Media.xcassets/Privacy/Privacy Dynamic.imageset/Contents.json b/Clocker/Media.xcassets/Privacy/Privacy Dynamic.imageset/Contents.json index c8d408c..314a0da 100644 --- a/Clocker/Media.xcassets/Privacy/Privacy Dynamic.imageset/Contents.json +++ b/Clocker/Media.xcassets/Privacy/Privacy Dynamic.imageset/Contents.json @@ -6,13 +6,14 @@ }, { "idiom" : "universal", - "scale" : "1x", + "filename" : "Privacy Dynamic.png", "appearances" : [ { "appearance" : "luminosity", "value" : "dark" } - ] + ], + "scale" : "1x" }, { "idiom" : "universal", @@ -21,7 +22,7 @@ }, { "idiom" : "universal", - "filename" : "Privacy Dynamic.png", + "filename" : "Privacy Dynamic-1.png", "appearances" : [ { "appearance" : "luminosity", diff --git a/Clocker/Media.xcassets/Privacy/Privacy Dynamic.imageset/Privacy Dynamic-1.png b/Clocker/Media.xcassets/Privacy/Privacy Dynamic.imageset/Privacy Dynamic-1.png new file mode 100644 index 0000000..88c36c2 Binary files /dev/null and b/Clocker/Media.xcassets/Privacy/Privacy Dynamic.imageset/Privacy Dynamic-1.png differ diff --git a/Clocker/Onboarding/OnboardingSearchController.swift b/Clocker/Onboarding/OnboardingSearchController.swift index 553a549..7e3b45a 100644 --- a/Clocker/Onboarding/OnboardingSearchController.swift +++ b/Clocker/Onboarding/OnboardingSearchController.swift @@ -211,7 +211,7 @@ class OnboardingSearchController: NSViewController { appName.stringValue = "Quick Add Locations".localized() onboardingTypeLabel.stringValue = "More search options in Clocker Preferences.".localized() setInfoLabel(CLEmptyString) - searchBar.placeholderString = "Search Locations".localized() + searchBar.placeholderString = "Enter 3 or more characters for locations you'll like to add".localized() resultsTableView.backgroundColor = Themer.shared().mainBackgroundColor() resultsTableView.enclosingScrollView?.backgroundColor = Themer.shared().mainBackgroundColor() @@ -259,6 +259,10 @@ class OnboardingSearchController: NSViewController { searchString = words.joined(separator: CLEmptyString) + if searchString.count < 3 { + return + } + let urlString = "https://maps.googleapis.com/maps/api/geocode/json?address=\(searchString)&key=\(CLGeocodingKey)&language=\(userPreferredLanguage)" dataTask = NetworkManager.task(with: urlString, diff --git a/Clocker/Preferences/OneWindowController.swift b/Clocker/Preferences/OneWindowController.swift index f287ccb..aacfd58 100644 --- a/Clocker/Preferences/OneWindowController.swift +++ b/Clocker/Preferences/OneWindowController.swift @@ -96,9 +96,9 @@ class OneWindowController: NSWindowController { } let themer = Themer.shared() - let identifierTOImageMapping: [String: NSImage] = ["Appearance": themer.appearanceTabImage(), - "Calendar": themer.calendarTabImage(), - "Permissions": themer.privacyTabImage()] + let identifierTOImageMapping: [String: NSImage] = ["Appearance Tab": themer.appearanceTabImage(), + "Calendar Tab": themer.calendarTabImage(), + "Permissions Tab": themer.privacyTabImage()] tabViewController.tabViewItems.forEach { tabViewItem in let identity = (tabViewItem.identifier as? String) ?? "" diff --git a/Readme.md b/Readme.md index 01e1b49..0e1b38e 100644 --- a/Readme.md +++ b/Readme.md @@ -1,7 +1,7 @@ **Clocker** --- -[![Twitter: @abgbm](https://img.shields.io/badge/contact-@n0shake-blue.svg?style=flat)](https://twitter.com/n0shake) [![Build Status](https://travis-ci.org/n0shake/Clocker.svg?branch=master)](https://travis-ci.org/n0shake/Clocker) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) +[![Twitter: @abgbm](https://img.shields.io/badge/contact-@n0shake-blue.svg?style=flat)](https://twitter.com/n0shake) [![Build Status](https://travis-ci.org/n0shake/Clocker.svg?branch=master)](https://travis-ci.org/n0shake/Clocker) [![Crowdin](https://badges.crowdin.net/clocker/localized.svg)](https://crowdin.com/project/clocker) ![Clocker](https://raw.githubusercontent.com/n0shake/Clocker/master/New%20Icons/Github.png "Clocker")