From a9607762be85520d777c7f07ede55657d8dabeda Mon Sep 17 00:00:00 2001 From: Abhishek Date: Sat, 26 Sep 2020 21:53:41 -0500 Subject: [PATCH] Minor adjustments. --- .../Preferences/General/PreferencesViewController.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Clocker/Preferences/General/PreferencesViewController.swift b/Clocker/Preferences/General/PreferencesViewController.swift index 4de61cb..5570ad3 100644 --- a/Clocker/Preferences/General/PreferencesViewController.swift +++ b/Clocker/Preferences/General/PreferencesViewController.swift @@ -628,7 +628,10 @@ extension PreferencesViewController { CLCustomLabel: filteredAddress, ] as [String: Any] + // Mark if the timezone is same as local timezone let timezoneObject = TimezoneData(with: newTimeZone) + timezoneObject.isSystemTimezone = timezoneObject.timezoneID == NSTimeZone.system.identifier + let operationsObject = TimezoneDataOperations(with: timezoneObject) operationsObject.saveObject() @@ -680,6 +683,7 @@ extension PreferencesViewController { comment: "Search Field Placeholder") availableTimezoneTableView.isHidden = false isActivityInProgress = false + selectNewlyInsertedTimezone() } @IBAction func addTimeZone(_: NSButton) { @@ -801,6 +805,10 @@ extension PreferencesViewController { availableTimezoneTableView.isHidden = false isActivityInProgress = false + selectNewlyInsertedTimezone() + } + + private func selectNewlyInsertedTimezone() { // Let's highlight the newly added row. If the number of timezones is greater than 6, the newly added timezone isn't visible. Since we hide the scrollbars as well, the user might get the impression that something is broken! if timezoneTableView.numberOfRows > 6 { timezoneTableView.scrollRowToVisible(timezoneTableView.numberOfRows - 1)