From ab392c2f0789d29a4e4299f9032768b099d845e0 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Sat, 8 Feb 2020 19:04:28 -0800 Subject: [PATCH] Scroll Wheel Support! --- Clocker/Onboarding/OnboardingParentViewController.swift | 4 ++-- Clocker/Overall App/Logger.swift | 2 +- Clocker/Panel/Notes Popover/NotesPopover.swift | 4 ++-- Clocker/Panel/PanelController.swift | 9 +++++++++ Clocker/Panel/ParentPanelController.swift | 2 +- Clocker/Panel/UI/TimezoneCellView.swift | 4 ++-- .../Preferences/General/PreferencesViewController.swift | 2 +- 7 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Clocker/Onboarding/OnboardingParentViewController.swift b/Clocker/Onboarding/OnboardingParentViewController.swift index 4f65315..d299dfe 100644 --- a/Clocker/Onboarding/OnboardingParentViewController.swift +++ b/Clocker/Onboarding/OnboardingParentViewController.swift @@ -297,8 +297,8 @@ class OnboardingParentViewController: NSViewController { UserDefaults.standard.set(shouldStart ? 1 : 0, forKey: CLStartAtLogin) startupManager.toggleLogin(shouldStart) shouldStart ? - Logger.log(object: [:], for: "Enable Launch at Login while Onboarding") : - Logger.log(object: [:], for: "Disable Launch at Login while Onboarding") + Logger.log(object: nil, for: "Enable Launch at Login while Onboarding") : + Logger.log(object: nil, for: "Disable Launch at Login while Onboarding") } func logExitPoint() { diff --git a/Clocker/Overall App/Logger.swift b/Clocker/Overall App/Logger.swift index 146e825..748059e 100644 --- a/Clocker/Overall App/Logger.swift +++ b/Clocker/Overall App/Logger.swift @@ -6,7 +6,7 @@ import os.log import os.signpost class Logger: NSObject { - class func log(object: [String: Any], for key: NSString) { + class func log(object: [String: Any]?, for key: NSString) { Answers.logCustomEvent(withName: key as String, customAttributes: object) } diff --git a/Clocker/Panel/Notes Popover/NotesPopover.swift b/Clocker/Panel/Notes Popover/NotesPopover.swift index 5dcb982..cfd17a8 100644 --- a/Clocker/Panel/Notes Popover/NotesPopover.swift +++ b/Clocker/Panel/Notes Popover/NotesPopover.swift @@ -216,7 +216,7 @@ class NotesPopover: NSViewController { if setReminderCheckbox.state == .on { setReminderAlarm() - Logger.log(object: [:], for: "Reminder Set") + Logger.log(object: nil, for: "Reminder Set") } refreshMainTableView() @@ -249,7 +249,7 @@ class NotesPopover: NSViewController { } NSWorkspace.shared.launchApplication("Reminders") } else if eventDescriptor == nil { - Logger.log(object: [:], for: "Event Description is unexpectedly nil") + Logger.log(object: nil, for: "Event Description is unexpectedly nil") NSWorkspace.shared.launchApplication("Reminders") } else { Logger.log(object: ["Successfully Executed Apple Script": "YES"], for: "Successfully Executed Apple Script") diff --git a/Clocker/Panel/PanelController.swift b/Clocker/Panel/PanelController.swift index 702d096..2dc8fe8 100644 --- a/Clocker/Panel/PanelController.swift +++ b/Clocker/Panel/PanelController.swift @@ -356,6 +356,15 @@ class PanelController: ParentPanelController { func refreshBackgroundView() { backgroundView.setNeedsDisplay(backgroundView.bounds) } + + override func scrollWheel(with event: NSEvent) { + if event.phase == NSEvent.Phase.ended { + Logger.log(object: nil, for: "Scroll Event Ended") + } + + futureSlider.doubleValue += Double(event.scrollingDeltaX) + sliderMoved(futureSlider!) + } } extension PanelController: NSWindowDelegate { diff --git a/Clocker/Panel/ParentPanelController.swift b/Clocker/Panel/ParentPanelController.swift index 978eede..8fd9aad 100644 --- a/Clocker/Panel/ParentPanelController.swift +++ b/Clocker/Panel/ParentPanelController.swift @@ -501,7 +501,7 @@ class ParentPanelController: NSWindowController { object: nil) // Now log! - Logger.log(object: [:], for: "Deleted Timezone Through Swipe") + Logger.log(object: nil, for: "Deleted Timezone Through Swipe") } private lazy var menubarTitleHandler = MenubarHandler() diff --git a/Clocker/Panel/UI/TimezoneCellView.swift b/Clocker/Panel/UI/TimezoneCellView.swift index 3b9ac8e..512cfe6 100644 --- a/Clocker/Panel/UI/TimezoneCellView.swift +++ b/Clocker/Panel/UI/TimezoneCellView.swift @@ -151,7 +151,7 @@ class TimezoneCellView: NSTableCellView { andButton: sender) } - Logger.log(object: [:], for: "Open Extra Options") + Logger.log(object: nil, for: "Open Extra Options") } override func mouseDown(with _: NSEvent) { @@ -161,6 +161,6 @@ class TimezoneCellView: NSTableCellView { override func rightMouseDown(with event: NSEvent) { super.rightMouseDown(with: event) showExtraOptions(extraOptions) - Logger.log(object: [:], for: "Right Click Open Options") + Logger.log(object: nil, for: "Right Click Open Options") } } diff --git a/Clocker/Preferences/General/PreferencesViewController.swift b/Clocker/Preferences/General/PreferencesViewController.swift index 27ed152..d63c33d 100644 --- a/Clocker/Preferences/General/PreferencesViewController.swift +++ b/Clocker/Preferences/General/PreferencesViewController.swift @@ -576,7 +576,7 @@ extension PreferencesViewController { return } - if error == nil, let json = response, let timezone = strongSelf .decodeTimezone(from: json) { + if error == nil, let json = response, let timezone = strongSelf.decodeTimezone(from: json) { if strongSelf.availableTimezoneTableView.selectedRow >= 0 { strongSelf.installTimezone(timezone) }