@ -228,7 +228,7 @@ class PreferencesViewController: ParentViewController {
[ placeholderLabel ] . forEach { $0 . isHidden = true }
[ placeholderLabel ] . forEach { $0 . isHidden = true }
messageLabel . stringValue = CLE mptyString
messageLabel . stringValue = UserDefaultKeys . e mptyString
timezoneTableView . registerForDraggedTypes ( [ . dragSession ] )
timezoneTableView . registerForDraggedTypes ( [ . dragSession ] )
@ -238,7 +238,7 @@ class PreferencesViewController: ParentViewController {
setupColor ( )
setupColor ( )
startupCheckbox . integerValue = DataStore . shared ( ) . retrieve ( key : CLS tartAtLogin) as ? Int ? ? 0
startupCheckbox . integerValue = DataStore . shared ( ) . retrieve ( key : UserDefaultKeys . s tartAtLogin) as ? Int ? ? 0
searchField . bezelStyle = . roundedBezel
searchField . bezelStyle = . roundedBezel
}
}
@ -249,7 +249,7 @@ class PreferencesViewController: ParentViewController {
startAtLoginLabel . textColor = Themer . shared ( ) . mainTextColor ( )
startAtLoginLabel . textColor = Themer . shared ( ) . mainTextColor ( )
[ timezoneNameSortButton , labelSortButton , timezoneSortButton ] . forEach {
[ timezoneNameSortButton , labelSortButton , timezoneSortButton ] . forEach {
$0 ? . attributedTitle = NSAttributedString ( string : $0 ? . title ? ? CLE mptyString, attributes : [
$0 ? . attributedTitle = NSAttributedString ( string : $0 ? . title ? ? UserDefaultKeys . e mptyString, attributes : [
NSAttributedString . Key . foregroundColor : Themer . shared ( ) . mainTextColor ( ) ,
NSAttributedString . Key . foregroundColor : Themer . shared ( ) . mainTextColor ( ) ,
NSAttributedString . Key . font : NSFont ( name : " Avenir-Light " , size : 13 ) ! ,
NSAttributedString . Key . font : NSFont ( name : " Avenir-Light " , size : 13 ) ! ,
] )
] )
@ -360,10 +360,10 @@ extension PreferencesViewController: NSTableViewDataSource, NSTableViewDelegate
}
}
private func showAlertIfMoreThanOneTimezoneHasBeenAddedToTheMenubar ( ) {
private func showAlertIfMoreThanOneTimezoneHasBeenAddedToTheMenubar ( ) {
let isUITestRunning = ProcessInfo . processInfo . arguments . contains ( CLUIT estingLaunchArgument)
let isUITestRunning = ProcessInfo . processInfo . arguments . contains ( UserDefaultKeys . t estingLaunchArgument)
// I f w e h a v e s e e n d i s p l a y e d t h e m e s s a g e b e f o r e , a b o r t !
// I f w e h a v e s e e n d i s p l a y e d t h e m e s s a g e b e f o r e , a b o r t !
let haveWeSeenThisMessageBefore = UserDefaults . standard . bool ( forKey : CLL ongStatusBarWarningMessage)
let haveWeSeenThisMessageBefore = UserDefaults . standard . bool ( forKey : UserDefaultKeys . l ongStatusBarWarningMessage)
if haveWeSeenThisMessageBefore , ! isUITestRunning {
if haveWeSeenThisMessageBefore , ! isUITestRunning {
return
return
@ -393,10 +393,10 @@ extension PreferencesViewController: NSTableViewDataSource, NSTableViewDelegate
if response . rawValue = = 1000 {
if response . rawValue = = 1000 {
OperationQueue . main . addOperation {
OperationQueue . main . addOperation {
UserDefaults . standard . set ( 0 , forKey : CLM enubarCompactMode)
UserDefaults . standard . set ( 0 , forKey : UserDefaultKeys . m enubarCompactMode)
if alert . suppressionButton ? . state = = NSControl . StateValue . on {
if alert . suppressionButton ? . state = = NSControl . StateValue . on {
UserDefaults . standard . set ( true , forKey : CLL ongStatusBarWarningMessage)
UserDefaults . standard . set ( true , forKey : UserDefaultKeys . l ongStatusBarWarningMessage)
}
}
self . updateStatusBarAppearance ( )
self . updateStatusBarAppearance ( )
@ -458,14 +458,14 @@ extension PreferencesViewController {
if searchResults . status = = ResultStatus . zeroResults {
if searchResults . status = = ResultStatus . zeroResults {
Logger . info ( " Zero Results returned " )
Logger . info ( " Zero Results returned " )
self . findLocalSearchResultsForTimezones ( )
self . findLocalSearchResultsForTimezones ( )
self . placeholderLabel . placeholderString = self . searchResultsDataSource . timezoneFilteredArray . isEmpty ? " No results! 😔 Try entering the exact name. " : CLE mptyString
self . placeholderLabel . placeholderString = self . searchResultsDataSource . timezoneFilteredArray . isEmpty ? " No results! 😔 Try entering the exact name. " : UserDefaultKeys . e mptyString
self . reloadSearchResults ( )
self . reloadSearchResults ( )
self . isActivityInProgress = false
self . isActivityInProgress = false
return
return
} else if searchResults . status = = ResultStatus . requestDenied && searchResults . results . isEmpty {
} else if searchResults . status = = ResultStatus . requestDenied && searchResults . results . isEmpty {
Logger . info ( " Request denied! " )
Logger . info ( " Request denied! " )
self . findLocalSearchResultsForTimezones ( )
self . findLocalSearchResultsForTimezones ( )
self . placeholderLabel . placeholderString = self . searchResultsDataSource . timezoneFilteredArray . isEmpty ? " Update Clocker to get a faster experience 😃 " : CLE mptyString
self . placeholderLabel . placeholderString = self . searchResultsDataSource . timezoneFilteredArray . isEmpty ? " Update Clocker to get a faster experience 😃 " : UserDefaultKeys . e mptyString
self . reloadSearchResults ( )
self . reloadSearchResults ( )
self . isActivityInProgress = false
self . isActivityInProgress = false
return
return
@ -490,7 +490,7 @@ extension PreferencesViewController {
var searchString = searchField . stringValue
var searchString = searchField . stringValue
let words = searchString . components ( separatedBy : CharacterSet . whitespacesAndNewlines )
let words = searchString . components ( separatedBy : CharacterSet . whitespacesAndNewlines )
searchString = words . joined ( separator : CLE mptyString)
searchString = words . joined ( separator : UserDefaultKeys . e mptyString)
return " https://maps.googleapis.com/maps/api/geocode/json?address= \( searchString ) &key= \( geocodingKey ) &language= \( userPreferredLanguage ) "
return " https://maps.googleapis.com/maps/api/geocode/json?address= \( searchString ) &key= \( geocodingKey ) &language= \( userPreferredLanguage ) "
}
}
@ -511,10 +511,10 @@ extension PreferencesViewController {
let totalPackage = [
let totalPackage = [
" latitude " : latitude ,
" latitude " : latitude ,
" longitude " : longitude ,
" longitude " : longitude ,
CLT imezoneName: formattedAddress ,
UserDefaultKeys . t imezoneName: formattedAddress ,
CLC ustomLabel: formattedAddress ,
UserDefaultKeys . c ustomLabel: formattedAddress ,
CLTimezoneID : CLE mptyString,
UserDefaultKeys . timezoneID : UserDefaultKeys . e mptyString,
CLP laceIdentifier: $0 . placeId ,
UserDefaultKeys . p laceIdentifier: $0 . placeId ,
] as [ String : Any ]
] as [ String : Any ]
finalResults . append ( TimezoneData ( with : totalPackage ) )
finalResults . append ( TimezoneData ( with : totalPackage ) )
@ -523,7 +523,7 @@ extension PreferencesViewController {
}
}
private func prepareUIForPresentingResults ( ) {
private func prepareUIForPresentingResults ( ) {
placeholderLabel . placeholderString = CLE mptyString
placeholderLabel . placeholderString = UserDefaultKeys . e mptyString
isActivityInProgress = false
isActivityInProgress = false
reloadSearchResults ( )
reloadSearchResults ( )
}
}
@ -541,7 +541,7 @@ extension PreferencesViewController {
}
}
isActivityInProgress = false
isActivityInProgress = false
placeholderLabel . placeholderString = CLE mptyString
placeholderLabel . placeholderString = UserDefaultKeys . e mptyString
}
}
private func getTimezone ( for latitude : Double , and longitude : Double ) {
private func getTimezone ( for latitude : Double , and longitude : Double ) {
@ -600,13 +600,13 @@ extension PreferencesViewController {
}
}
let newTimeZone = [
let newTimeZone = [
CLT imezoneID: timezone . timeZoneId ,
UserDefaultKeys . t imezoneID: timezone . timeZoneId ,
CLT imezoneName: filteredAddress ,
UserDefaultKeys . t imezoneName: filteredAddress ,
CLP laceIdentifier: dataObject . placeID ! ,
UserDefaultKeys . p laceIdentifier: dataObject . placeID ! ,
" latitude " : dataObject . latitude ! ,
" latitude " : dataObject . latitude ! ,
" longitude " : dataObject . longitude ! ,
" longitude " : dataObject . longitude ! ,
" nextUpdate " : CLE mptyString,
" nextUpdate " : UserDefaultKeys . e mptyString,
CLC ustomLabel: filteredAddress ,
UserDefaultKeys . c ustomLabel: filteredAddress ,
] as [ String : Any ]
] as [ String : Any ]
// M a r k i f t h e t i m e z o n e i s s a m e a s l o c a l t i m e z o n e
// M a r k i f t h e t i m e z o n e i s s a m e a s l o c a l t i m e z o n e
@ -658,7 +658,7 @@ extension PreferencesViewController {
refreshTimezoneTableView ( true )
refreshTimezoneTableView ( true )
refreshMainTable ( )
refreshMainTable ( )
timezonePanel . close ( )
timezonePanel . close ( )
placeholderLabel . placeholderString = CLE mptyString
placeholderLabel . placeholderString = UserDefaultKeys . e mptyString
searchField . placeholderString = NSLocalizedString ( " Search Field Placeholder " ,
searchField . placeholderString = NSLocalizedString ( " Search Field Placeholder " ,
comment : " Search Field Placeholder " )
comment : " Search Field Placeholder " )
availableTimezoneTableView . isHidden = false
availableTimezoneTableView . isHidden = false
@ -723,7 +723,7 @@ extension PreferencesViewController {
}
}
if messageLabel . stringValue . isEmpty {
if messageLabel . stringValue . isEmpty {
searchField . stringValue = CLE mptyString
searchField . stringValue = UserDefaultKeys . e mptyString
guard let latitude = dataObject . latitude , let longitude = dataObject . longitude else {
guard let latitude = dataObject . latitude , let longitude = dataObject . longitude else {
assertionFailure ( " Data was unexpectedly nil " )
assertionFailure ( " Data was unexpectedly nil " )
@ -736,7 +736,7 @@ extension PreferencesViewController {
private func cleanupAfterInstallingTimezone ( ) {
private func cleanupAfterInstallingTimezone ( ) {
let data = TimezoneData ( )
let data = TimezoneData ( )
data . setLabel ( CLE mptyString)
data . setLabel ( UserDefaultKeys . e mptyString)
let currentSelection = searchResultsDataSource . retrieveSelectedTimezone ( availableTimezoneTableView . selectedRow )
let currentSelection = searchResultsDataSource . retrieveSelectedTimezone ( availableTimezoneTableView . selectedRow )
@ -751,8 +751,8 @@ extension PreferencesViewController {
searchResultsDataSource . cleanupFilterArray ( )
searchResultsDataSource . cleanupFilterArray ( )
searchResultsDataSource . timezoneFilteredArray = [ ]
searchResultsDataSource . timezoneFilteredArray = [ ]
placeholderLabel . placeholderString = CLE mptyString
placeholderLabel . placeholderString = UserDefaultKeys . e mptyString
searchField . stringValue = CLE mptyString
searchField . stringValue = UserDefaultKeys . e mptyString
reloadSearchResults ( )
reloadSearchResults ( )
refreshTimezoneTableView ( true )
refreshTimezoneTableView ( true )
@ -788,8 +788,8 @@ extension PreferencesViewController {
@IBAction func closePanel ( _ : NSButton ) {
@IBAction func closePanel ( _ : NSButton ) {
searchResultsDataSource . cleanupFilterArray ( )
searchResultsDataSource . cleanupFilterArray ( )
searchResultsDataSource . timezoneFilteredArray = [ ]
searchResultsDataSource . timezoneFilteredArray = [ ]
searchField . stringValue = CLE mptyString
searchField . stringValue = UserDefaultKeys . e mptyString
placeholderLabel . placeholderString = CLE mptyString
placeholderLabel . placeholderString = UserDefaultKeys . e mptyString
searchField . placeholderString = NSLocalizedString ( " Search Field Placeholder " ,
searchField . placeholderString = NSLocalizedString ( " Search Field Placeholder " ,
comment : " Search Field Placeholder " )
comment : " Search Field Placeholder " )