From 1928620aa797036f6296530dbd88bc4c2d373fa6 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Sat, 10 Jul 2021 16:34:51 -0400 Subject: [PATCH] Use Toast for feedback window! --- .../App Feedback/AppFeedbackWindow.xib | 25 ++++--------------- .../AppFeedbackWindowController.swift | 19 +------------- 2 files changed, 6 insertions(+), 38 deletions(-) diff --git a/Clocker/Preferences/App Feedback/AppFeedbackWindow.xib b/Clocker/Preferences/App Feedback/AppFeedbackWindow.xib index 7e861f68..b749b739 100644 --- a/Clocker/Preferences/App Feedback/AppFeedbackWindow.xib +++ b/Clocker/Preferences/App Feedback/AppFeedbackWindow.xib @@ -1,8 +1,8 @@ - + - + @@ -12,7 +12,6 @@ - @@ -24,7 +23,7 @@ - + @@ -111,7 +110,7 @@ - - - - - - - - - - - @@ -191,7 +179,6 @@ DQ - @@ -206,10 +193,8 @@ DQ - - diff --git a/Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift b/Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift index eb150d35..089b55a9 100644 --- a/Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift +++ b/Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift @@ -31,7 +31,6 @@ class AppFeedbackWindowController: NSWindowController { @IBOutlet var nameField: NSTextField! @IBOutlet var emailField: NSTextField! @IBOutlet var feedbackTextView: NSTextView! - @IBOutlet var informativeText: NSTextField! @IBOutlet var progressIndicator: NSProgressIndicator! @IBOutlet var quickCommentsLabel: UnderlinedButton! @@ -69,7 +68,6 @@ class AppFeedbackWindowController: NSWindowController { window?.titlebarAppearsTransparent = true progressIndicator.isHidden = true - informativeText.setAccessibilityIdentifier("InformativeText") feedbackTextView.setAccessibilityIdentifier("FeedbackTextView") nameField.setAccessibilityIdentifier("NameField") emailField.setAccessibilityIdentifier("EmailField") @@ -106,8 +104,6 @@ class AppFeedbackWindowController: NSWindowController { } @IBAction func sendFeedback(_: Any) { - resetInformativeLabel() - isActivityInProgress = true if didUserEnterFeedback() == false { @@ -127,16 +123,8 @@ class AppFeedbackWindowController: NSWindowController { let cleanedUpString = feedbackTextView.string.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) if cleanedUpString.isEmpty { - informativeText.stringValue = AppFeedbackConstants.CLFeedbackNotEnteredErrorMessage - - Timer.scheduledTimer(withTimeInterval: 5.0, - repeats: false, - block: { _ in - self.resetInformativeLabel() - }) - + self.window?.contentView?.makeToast(AppFeedbackConstants.CLFeedbackNotEnteredErrorMessage) isActivityInProgress = false - return false } @@ -206,10 +194,6 @@ class AppFeedbackWindowController: NSWindowController { } } - private func resetInformativeLabel() { - informativeText.stringValue = CLEmptyString - } - @IBOutlet var contactBox: NSBox! @IBOutlet var accessoryInfo: NSTextField! @@ -262,7 +246,6 @@ class AppFeedbackWindowController: NSWindowController { extension AppFeedbackWindowController: NSWindowDelegate { func windowWillClose(_: Notification) { - resetInformativeLabel() performClosingCleanUp() bringPreferencesWindowToFront() }