Browse Source

Merge branch 'master' of https://github.com/n0shake/Clocker

pull/92/head
Abhishek 5 years ago
parent
commit
030bd1361f
  1. 3
      Clocker/Clocker.xcodeproj/project.pbxproj
  2. 2
      Clocker/Clocker.xcodeproj/xcuserdata/ban.xcuserdatad/xcschemes/xcschememanagement.plist
  3. 2
      Clocker/Clocker/ca.lproj/Localizable.strings
  4. 2
      Clocker/Clocker/de.lproj/Localizable.strings
  5. 2
      Clocker/Clocker/en.lproj/Localizable.strings
  6. 2
      Clocker/Clocker/es.lproj/Localizable.strings
  7. 2
      Clocker/Clocker/fr.lproj/Localizable.strings
  8. 2
      Clocker/Clocker/hi.lproj/Localizable.strings
  9. 2
      Clocker/Clocker/ja.lproj/Localizable.strings
  10. 2
      Clocker/Clocker/ko.lproj/Localizable.strings
  11. 2
      Clocker/Clocker/nl.lproj/Localizable.strings
  12. 2
      Clocker/Clocker/ru.lproj/Localizable.strings
  13. 2
      Clocker/Clocker/zh-Hans.lproj/Localizable.strings
  14. 49
      Clocker/ClockerUnitTests/ClockerUnitTests.swift
  15. 2
      Clocker/Dependencies/Date Additions/Date+Comparators.swift
  16. 4
      Clocker/Dependencies/Date Additions/TimePeriodGroup.swift
  17. 7
      Clocker/Media.xcassets/Privacy/Privacy Dynamic.imageset/Contents.json
  18. BIN
      Clocker/Media.xcassets/Privacy/Privacy Dynamic.imageset/Privacy Dynamic-1.png
  19. 6
      Clocker/Onboarding/OnboardingSearchController.swift
  20. 6
      Clocker/Preferences/OneWindowController.swift
  21. 2
      Readme.md

3
Clocker/Clocker.xcodeproj/project.pbxproj

@ -1003,10 +1003,9 @@
}; };
buildConfigurationList = DD4F7BFE13C30F9F00825C6E /* Build configuration list for PBXProject "Clocker" */; buildConfigurationList = DD4F7BFE13C30F9F00825C6E /* Build configuration list for PBXProject "Clocker" */;
compatibilityVersion = "Xcode 3.2"; compatibilityVersion = "Xcode 3.2";
developmentRegion = English; developmentRegion = en;
hasScannedForEncodings = 0; hasScannedForEncodings = 0;
knownRegions = ( knownRegions = (
English,
en, en,
Base, Base,
hi, hi,

2
Clocker/Clocker.xcodeproj/xcuserdata/ban.xcuserdatad/xcschemes/xcschememanagement.plist

@ -17,7 +17,7 @@
<key>Tests.xcscheme_^#shared#^_</key> <key>Tests.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>3</integer> <integer>1</integer>
</dict> </dict>
</dict> </dict>
<key>SuppressBuildableAutocreation</key> <key>SuppressBuildableAutocreation</key>

2
Clocker/Clocker/ca.lproj/Localizable.strings

@ -84,7 +84,7 @@
// Onboarding Search // Onboarding Search
"Quick Add Locations" = "Quick Add Locations"; "Quick Add Locations" = "Quick Add Locations";
"More search options in Clocker Preferences." = "More search options in Clocker Preferences."; "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 // Start at Login
"Launch at Login" = "Launch at Login"; "Launch at Login" = "Launch at Login";

2
Clocker/Clocker/de.lproj/Localizable.strings

@ -235,7 +235,7 @@
"Search Field Placeholder" = "Enter a city, state or country name"; "Search Field Placeholder" = "Enter a city, state or country name";
/* (No Comment) */ /* (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 */ /* Next Event Label for no Calendar access */
"See your next Calendar event here." = "See your next Calendar event here."; "See your next Calendar event here." = "See your next Calendar event here.";

2
Clocker/Clocker/en.lproj/Localizable.strings

@ -84,7 +84,7 @@
// Onboarding Search // Onboarding Search
"Quick Add Locations" = "Quick Add Locations"; "Quick Add Locations" = "Quick Add Locations";
"More search options in Clocker Preferences." = "More search options in Clocker Preferences."; "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 // Start at Login
"Launch at Login" = "Launch at Login"; "Launch at Login" = "Launch at Login";

2
Clocker/Clocker/es.lproj/Localizable.strings

@ -84,7 +84,7 @@
// Onboarding Search // Onboarding Search
"Quick Add Locations" = "Quick Add Locations"; "Quick Add Locations" = "Quick Add Locations";
"More search options in Clocker Preferences." = "More search options in Clocker Preferences."; "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 // Start at Login
"Launch at Login" = "Launch at Login"; "Launch at Login" = "Launch at Login";

2
Clocker/Clocker/fr.lproj/Localizable.strings

@ -84,7 +84,7 @@
// Onboarding Search // Onboarding Search
"Quick Add Locations" = "Quick Add Locations"; "Quick Add Locations" = "Quick Add Locations";
"More search options in Clocker Preferences." = "More search options in Clocker Preferences."; "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 // Start at Login
"Launch at Login" = "Launch at Login"; "Launch at Login" = "Launch at Login";

2
Clocker/Clocker/hi.lproj/Localizable.strings

@ -80,7 +80,7 @@
// Onboarding Search // Onboarding Search
"Quick Add Locations" = "Quick Add Locations"; "Quick Add Locations" = "Quick Add Locations";
"More search options in Clocker Preferences." = "More search options in Clocker Preferences."; "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 // Start at Login
"Launch at Login" = "Launch at Login"; "Launch at Login" = "Launch at Login";

2
Clocker/Clocker/ja.lproj/Localizable.strings

@ -83,7 +83,7 @@
// Onboarding Search // Onboarding Search
"Quick Add Locations" = "Quick Add Locations"; "Quick Add Locations" = "Quick Add Locations";
"More search options in Clocker Preferences." = "More search options in Clocker Preferences."; "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 // Start at Login
"Launch at Login" = "Launch at Login"; "Launch at Login" = "Launch at Login";

2
Clocker/Clocker/ko.lproj/Localizable.strings

@ -83,7 +83,7 @@
// Onboarding Search // Onboarding Search
"Quick Add Locations" = "Quick Add Locations"; "Quick Add Locations" = "Quick Add Locations";
"More search options in Clocker Preferences." = "More search options in Clocker Preferences."; "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 // Start at Login
"Launch at Login" = "Launch at Login"; "Launch at Login" = "Launch at Login";

2
Clocker/Clocker/nl.lproj/Localizable.strings

@ -84,7 +84,7 @@
// Onboarding Search // Onboarding Search
"Quick Add Locations" = "Quick Add Locations"; "Quick Add Locations" = "Quick Add Locations";
"More search options in Clocker Preferences." = "More search options in Clocker Preferences."; "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 // Start at Login
"Launch at Login" = "Launch at Login"; "Launch at Login" = "Launch at Login";

2
Clocker/Clocker/ru.lproj/Localizable.strings

@ -235,7 +235,7 @@
"Search Field Placeholder" = "Enter a city, state or country name"; "Search Field Placeholder" = "Enter a city, state or country name";
/* (No Comment) */ /* (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 */ /* Next Event Label for no Calendar access */
"See your next Calendar event here." = "See your next Calendar event here."; "See your next Calendar event here." = "See your next Calendar event here.";

2
Clocker/Clocker/zh-Hans.lproj/Localizable.strings

@ -235,7 +235,7 @@
"Search Field Placeholder" = "Enter a city, state or country name"; "Search Field Placeholder" = "Enter a city, state or country name";
/* (No Comment) */ /* (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 */ /* Next Event Label for no Calendar access */
"See your next Calendar event here." = "See your next Calendar event here."; "See your next Calendar event here." = "See your next Calendar event here.";

49
Clocker/ClockerUnitTests/ClockerUnitTests.swift

@ -70,6 +70,53 @@ class ClockerUnitTests: XCTestCase {
return TimezoneDataOperations(with: TimezoneData(with: omaha)) 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() { func testAddingATimezoneToDefaults() {
let timezoneData = TimezoneData(with: california) 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(operations.timeDifference() == ", 12 hours 30 mins ahead", "Difference was unexpectedly: \(operations.timeDifference())")
XCTAssertTrue(californiaOperations.timeDifference() == "", "Difference was unexpectedly: \(californiaOperations.timeDifference())") XCTAssertTrue(californiaOperations.timeDifference() == "", "Difference was unexpectedly: \(californiaOperations.timeDifference())")
XCTAssertTrue(floridaOperations.timeDifference() == ", 3 hours ahead", "Difference was unexpectedly: \(floridaOperations.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())") XCTAssertTrue(omahaOperations.timeDifference() == ", 2 hours ahead", "Difference was unexpectedly: \(omahaOperations.timeDifference())")
} }

2
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 * - returns: A TimeChunk representing the time between the dates, in natural form
*/ */
func chunkBetween(date: Date) -> TimeChunk { 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!) 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) // TimeChunk(seconds: secondDelta, minutes: minuteDelta, hours: hourDelta, days: dayDelta, weeks: 0, months: monthDelta, years: yearDelta)
} }

4
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 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 { if period1.beginning == nil, period2.beginning == nil {
return false return false
} else if period1.beginning == nil { } else if period1.beginning == nil {
@ -125,7 +125,7 @@ open class TimePeriodGroup: Sequence {
return period2.beginning! < period1.beginning! 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 { if period1.beginning == nil, period2.beginning == nil {
return false return false
} else if period1.beginning == nil { } else if period1.beginning == nil {

7
Clocker/Media.xcassets/Privacy/Privacy Dynamic.imageset/Contents.json vendored

@ -6,13 +6,14 @@
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"scale" : "1x", "filename" : "Privacy Dynamic.png",
"appearances" : [ "appearances" : [
{ {
"appearance" : "luminosity", "appearance" : "luminosity",
"value" : "dark" "value" : "dark"
} }
] ],
"scale" : "1x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
@ -21,7 +22,7 @@
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "Privacy Dynamic.png", "filename" : "Privacy Dynamic-1.png",
"appearances" : [ "appearances" : [
{ {
"appearance" : "luminosity", "appearance" : "luminosity",

BIN
Clocker/Media.xcassets/Privacy/Privacy Dynamic.imageset/Privacy Dynamic-1.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

6
Clocker/Onboarding/OnboardingSearchController.swift

@ -211,7 +211,7 @@ class OnboardingSearchController: NSViewController {
appName.stringValue = "Quick Add Locations".localized() appName.stringValue = "Quick Add Locations".localized()
onboardingTypeLabel.stringValue = "More search options in Clocker Preferences.".localized() onboardingTypeLabel.stringValue = "More search options in Clocker Preferences.".localized()
setInfoLabel(CLEmptyString) 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.backgroundColor = Themer.shared().mainBackgroundColor()
resultsTableView.enclosingScrollView?.backgroundColor = Themer.shared().mainBackgroundColor() resultsTableView.enclosingScrollView?.backgroundColor = Themer.shared().mainBackgroundColor()
@ -259,6 +259,10 @@ class OnboardingSearchController: NSViewController {
searchString = words.joined(separator: CLEmptyString) 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)" let urlString = "https://maps.googleapis.com/maps/api/geocode/json?address=\(searchString)&key=\(CLGeocodingKey)&language=\(userPreferredLanguage)"
dataTask = NetworkManager.task(with: urlString, dataTask = NetworkManager.task(with: urlString,

6
Clocker/Preferences/OneWindowController.swift

@ -96,9 +96,9 @@ class OneWindowController: NSWindowController {
} }
let themer = Themer.shared() let themer = Themer.shared()
let identifierTOImageMapping: [String: NSImage] = ["Appearance": themer.appearanceTabImage(), let identifierTOImageMapping: [String: NSImage] = ["Appearance Tab": themer.appearanceTabImage(),
"Calendar": themer.calendarTabImage(), "Calendar Tab": themer.calendarTabImage(),
"Permissions": themer.privacyTabImage()] "Permissions Tab": themer.privacyTabImage()]
tabViewController.tabViewItems.forEach { tabViewItem in tabViewController.tabViewItems.forEach { tabViewItem in
let identity = (tabViewItem.identifier as? String) ?? "" let identity = (tabViewItem.identifier as? String) ?? ""

2
Readme.md

@ -1,7 +1,7 @@
**Clocker** **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") ![Clocker](https://raw.githubusercontent.com/n0shake/Clocker/master/New%20Icons/Github.png "Clocker")

Loading…
Cancel
Save