Browse Source

Restricting API calls to start after every 3rd call.

pull/92/head
Abhishek 5 years ago
parent
commit
c8cda2ee7b
  1. 2
      Clocker/Clocker.xcodeproj/xcuserdata/ban.xcuserdatad/xcschemes/xcschememanagement.plist
  2. 2
      Clocker/Clocker/ca.lproj/Localizable.strings
  3. 2
      Clocker/Clocker/de.lproj/Localizable.strings
  4. 2
      Clocker/Clocker/en.lproj/Localizable.strings
  5. 2
      Clocker/Clocker/es.lproj/Localizable.strings
  6. 2
      Clocker/Clocker/fr.lproj/Localizable.strings
  7. 2
      Clocker/Clocker/hi.lproj/Localizable.strings
  8. 2
      Clocker/Clocker/ja.lproj/Localizable.strings
  9. 2
      Clocker/Clocker/ko.lproj/Localizable.strings
  10. 2
      Clocker/Clocker/nl.lproj/Localizable.strings
  11. 2
      Clocker/Clocker/ru.lproj/Localizable.strings
  12. 2
      Clocker/Clocker/zh-Hans.lproj/Localizable.strings
  13. 2
      Clocker/Dependencies/Date Additions/Date+Comparators.swift
  14. 4
      Clocker/Dependencies/Date Additions/TimePeriodGroup.swift
  15. 6
      Clocker/Onboarding/OnboardingSearchController.swift

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

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

2
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";

2
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.";

2
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";

2
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";

2
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";

2
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";

2
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";

2
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";

2
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";

2
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.";

2
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.";

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
*/
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)
}

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
}
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 {

6
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,

Loading…
Cancel
Save