Browse Source

Quick fixes!

pull/92/head
Abhishek 5 years ago
parent
commit
f27c83e95d
  1. 4
      Clocker/Clocker.xcodeproj/project.pbxproj
  2. 14
      Clocker/Onboarding/OnboardingSearchController.swift
  3. 1
      Clocker/Overall App/Strings.swift
  4. 14
      Clocker/Preferences/General/PreferencesViewController.swift

4
Clocker/Clocker.xcodeproj/project.pbxproj

@ -80,6 +80,7 @@
35C36FA12259ED6D002FA5C6 /* EventCenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35C36F9E2259ED6D002FA5C6 /* EventCenter.swift */; }; 35C36FA12259ED6D002FA5C6 /* EventCenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35C36F9E2259ED6D002FA5C6 /* EventCenter.swift */; };
35C36FA22259ED6D002FA5C6 /* RemindersHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35C36F9F2259ED6D002FA5C6 /* RemindersHandler.swift */; }; 35C36FA22259ED6D002FA5C6 /* RemindersHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35C36F9F2259ED6D002FA5C6 /* RemindersHandler.swift */; };
35C36FA42259EEC2002FA5C6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35C36FA32259EEC2002FA5C6 /* AppDelegate.swift */; }; 35C36FA42259EEC2002FA5C6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35C36FA32259EEC2002FA5C6 /* AppDelegate.swift */; };
35E05E4424621A40008CA0A9 /* Keys.plist in Resources */ = {isa = PBXBuildFile; fileRef = 35E05E4324621A40008CA0A9 /* Keys.plist */; };
9A0A1C8C20903DBD0012003B /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A9E87651C1FEDC500A7A2DF /* CoreLocation.framework */; }; 9A0A1C8C20903DBD0012003B /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A9E87651C1FEDC500A7A2DF /* CoreLocation.framework */; };
9A13BAD61CA87F08007C6CBE /* Panel.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9A13BAD81CA87F08007C6CBE /* Panel.xib */; }; 9A13BAD61CA87F08007C6CBE /* Panel.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9A13BAD81CA87F08007C6CBE /* Panel.xib */; };
9A13BAE01CA882FA007C6CBE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9A13BAE21CA882FA007C6CBE /* InfoPlist.strings */; }; 9A13BAE01CA882FA007C6CBE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9A13BAE21CA882FA007C6CBE /* InfoPlist.strings */; };
@ -297,6 +298,7 @@
35C36F9E2259ED6D002FA5C6 /* EventCenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EventCenter.swift; sourceTree = "<group>"; }; 35C36F9E2259ED6D002FA5C6 /* EventCenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EventCenter.swift; sourceTree = "<group>"; };
35C36F9F2259ED6D002FA5C6 /* RemindersHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemindersHandler.swift; sourceTree = "<group>"; }; 35C36F9F2259ED6D002FA5C6 /* RemindersHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemindersHandler.swift; sourceTree = "<group>"; };
35C36FA32259EEC2002FA5C6 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = SOURCE_ROOT; }; 35C36FA32259EEC2002FA5C6 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = SOURCE_ROOT; };
35E05E4324621A40008CA0A9 /* Keys.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Keys.plist; path = ../Internal/Keys.plist; sourceTree = "<group>"; };
9A13BAD71CA87F08007C6CBE /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/Panel.xib; sourceTree = "<group>"; }; 9A13BAD71CA87F08007C6CBE /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/Panel.xib; sourceTree = "<group>"; };
9A13BAE11CA882FA007C6CBE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 9A13BAE11CA882FA007C6CBE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
9A13BAEB1CA88A76007C6CBE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; }; 9A13BAEB1CA88A76007C6CBE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
@ -816,6 +818,7 @@
DD4F7BF913C30F9F00825C6E = { DD4F7BF913C30F9F00825C6E = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
35E05E4324621A40008CA0A9 /* Keys.plist */,
35C36F9B2259EC97002FA5C6 /* Events and Reminders */, 35C36F9B2259EC97002FA5C6 /* Events and Reminders */,
35C36F382259D80C002FA5C6 /* Overall App */, 35C36F382259D80C002FA5C6 /* Overall App */,
35C36F242259D64D002FA5C6 /* Panel */, 35C36F242259D64D002FA5C6 /* Panel */,
@ -1109,6 +1112,7 @@
9A13BAD61CA87F08007C6CBE /* Panel.xib in Resources */, 9A13BAD61CA87F08007C6CBE /* Panel.xib in Resources */,
35C36F6B2259E0E1002FA5C6 /* FloatingWindow.xib in Resources */, 35C36F6B2259E0E1002FA5C6 /* FloatingWindow.xib in Resources */,
35C36F17225961DA002FA5C6 /* DateTools.bundle in Resources */, 35C36F17225961DA002FA5C6 /* DateTools.bundle in Resources */,
35E05E4424621A40008CA0A9 /* Keys.plist in Resources */,
35C36EF322595F14002FA5C6 /* WelcomeView.xib in Resources */, 35C36EF322595F14002FA5C6 /* WelcomeView.xib in Resources */,
35C36EF822595F14002FA5C6 /* Onboarding.storyboard in Resources */, 35C36EF822595F14002FA5C6 /* Onboarding.storyboard in Resources */,
35C36F612259DE67002FA5C6 /* NotesPopover.xib in Resources */, 35C36F612259DE67002FA5C6 /* NotesPopover.xib in Resources */,

14
Clocker/Onboarding/OnboardingSearchController.swift

@ -20,6 +20,16 @@ class OnboardingSearchController: NSViewController {
private var dataTask: URLSessionDataTask? = .none private var dataTask: URLSessionDataTask? = .none
private var themeDidChangeNotification: NSObjectProtocol? private var themeDidChangeNotification: NSObjectProtocol?
private var geocodingKey: String = {
guard let path = Bundle.main.path(forResource: "Keys", ofType: "plist"),
let dictionary = NSDictionary(contentsOfFile: path),
let apiKey = dictionary["GeocodingKey"] as? String else {
assertionFailure("Unable to find the API key")
return ""
}
return apiKey
}()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
@ -146,7 +156,7 @@ class OnboardingSearchController: NSViewController {
let tuple = "\(latitude),\(longitude)" let tuple = "\(latitude),\(longitude)"
let timeStamp = Date().timeIntervalSince1970 let timeStamp = Date().timeIntervalSince1970
let urlString = "https://maps.googleapis.com/maps/api/timezone/json?location=\(tuple)&timestamp=\(timeStamp)&key=\(CLGeocodingKey)" let urlString = "https://maps.googleapis.com/maps/api/timezone/json?location=\(tuple)&timestamp=\(timeStamp)&key=\(geocodingKey)"
NetworkManager.task(with: urlString) { [weak self] response, error in NetworkManager.task(with: urlString) { [weak self] response, error in
@ -275,7 +285,7 @@ class OnboardingSearchController: NSViewController {
return 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=\(geocodingKey)&language=\(userPreferredLanguage)"
dataTask = NetworkManager.task(with: urlString, dataTask = NetworkManager.task(with: urlString,
completionHandler: { [weak self] response, error in completionHandler: { [weak self] response, error in

1
Clocker/Overall App/Strings.swift

@ -37,4 +37,3 @@ let CLDefaultMenubarMode = "com.abhishek.shouldDefaultToCompactMode"
let CLInstallHomeIndicatorObject = "installHomeIndicatorObject" let CLInstallHomeIndicatorObject = "installHomeIndicatorObject"
let CLDefaultThemeOnMojave = "com.abhishek.defaultHasBeenSetOnMacOsMojave" let CLDefaultThemeOnMojave = "com.abhishek.defaultHasBeenSetOnMacOsMojave"
let CLSwitchToCompactModeAlert = "com.abhishek.switchToCompactMode" let CLSwitchToCompactModeAlert = "com.abhishek.switchToCompactMode"
let CLGeocodingKey = "AIzaSyCyf2knCi6KiKuDJLYDBD3Odq5dt4c-_KI"

14
Clocker/Preferences/General/PreferencesViewController.swift

@ -37,6 +37,16 @@ class PreferencesViewController: ParentViewController {
NoTimezoneView(frame: tableview.frame) NoTimezoneView(frame: tableview.frame)
}() }()
private var geocodingKey: String = {
guard let path = Bundle.main.path(forResource: "Keys", ofType: "plist"),
let dictionary = NSDictionary(contentsOfFile: path),
let apiKey = dictionary["GeocodingKey"] as? String else {
assertionFailure("Unable to find the API key")
return ""
}
return apiKey
}()
// Sorting // Sorting
private var arePlacesSortedInAscendingOrder = false private var arePlacesSortedInAscendingOrder = false
private var arePlacesSortedInAscendingTimezoneOrder = false private var arePlacesSortedInAscendingTimezoneOrder = false
@ -471,7 +481,7 @@ extension PreferencesViewController {
let words = searchString.components(separatedBy: CharacterSet.whitespacesAndNewlines) let words = searchString.components(separatedBy: CharacterSet.whitespacesAndNewlines)
searchString = words.joined(separator: CLEmptyString) searchString = words.joined(separator: CLEmptyString)
let url = "https://maps.googleapis.com/maps/api/geocode/json?address=\(searchString)&key=\(CLGeocodingKey)&language=\(userPreferredLanguage)" let url = "https://maps.googleapis.com/maps/api/geocode/json?address=\(searchString)&key=\(geocodingKey)&language=\(userPreferredLanguage)"
return url return url
} }
@ -564,7 +574,7 @@ extension PreferencesViewController {
let tuple = "\(latitude),\(longitude)" let tuple = "\(latitude),\(longitude)"
let timeStamp = Date().timeIntervalSince1970 let timeStamp = Date().timeIntervalSince1970
let urlString = "https://maps.googleapis.com/maps/api/timezone/json?location=\(tuple)&timestamp=\(timeStamp)&key=\(CLGeocodingKey)" let urlString = "https://maps.googleapis.com/maps/api/timezone/json?location=\(tuple)&timestamp=\(timeStamp)&key=\(geocodingKey)"
NetworkManager.task(with: urlString) { [weak self] response, error in NetworkManager.task(with: urlString) { [weak self] response, error in

Loading…
Cancel
Save