Browse Source

Cleanup app feedback window on close.

pull/113/head
Abhishek Banthia 3 years ago
parent
commit
8b75d12ad6
  1. 16
      Clocker/Panel/ParentPanelController.swift
  2. 12
      Clocker/Preferences/About/AboutViewController.swift
  3. 6
      Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift

16
Clocker/Panel/ParentPanelController.swift

@ -37,7 +37,7 @@ class ParentPanelController: NSWindowController {
var datasource: TimezoneDataSource? var datasource: TimezoneDataSource?
private lazy var feedbackWindow = AppFeedbackWindowController.shared() private var feedbackWindow: AppFeedbackWindowController?
private var notePopover: NotesPopover? private var notePopover: NotesPopover?
@ -890,9 +890,9 @@ class ParentPanelController: NSWindowController {
} else if sender.title == PanelConstants.yesWithQuestionMark { } else if sender.title == PanelConstants.yesWithQuestionMark {
ReviewController.prompted() ReviewController.prompted()
updateReviewView() updateReviewView()
feedbackWindow = AppFeedbackWindowController.shared() feedbackWindow = AppFeedbackWindowController.shared()
feedbackWindow.showWindow(nil) feedbackWindow?.appFeedbackWindowDelegate = self
feedbackWindow?.showWindow(nil)
NSApp.activate(ignoringOtherApps: true) NSApp.activate(ignoringOtherApps: true)
} else { } else {
updateReviewView() updateReviewView()
@ -986,7 +986,9 @@ class ParentPanelController: NSWindowController {
} }
@objc func reportIssue() { @objc func reportIssue() {
feedbackWindow.showWindow(nil) feedbackWindow = AppFeedbackWindowController.shared()
feedbackWindow?.appFeedbackWindowDelegate = self
feedbackWindow?.showWindow(nil)
NSApp.activate(ignoringOtherApps: true) NSApp.activate(ignoringOtherApps: true)
window?.orderOut(nil) window?.orderOut(nil)
@ -1147,3 +1149,9 @@ extension ParentPanelController: NSSharingServicePickerDelegate {
return clipboardCopy return clipboardCopy
} }
} }
extension ParentPanelController: AppFeedbackWindowControllerDelegate {
func appFeedbackWindowWillClose() {
feedbackWindow = nil
}
}

12
Clocker/Preferences/About/AboutViewController.swift

@ -22,7 +22,7 @@ class AboutViewController: ParentViewController {
@IBOutlet var versionField: NSTextField! @IBOutlet var versionField: NSTextField!
private var themeDidChangeNotification: NSObjectProtocol? private var themeDidChangeNotification: NSObjectProtocol?
private lazy var feedbackWindow = AppFeedbackWindowController.shared() private var feedbackWindow: AppFeedbackWindowController?
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
@ -120,7 +120,9 @@ class AboutViewController: ParentViewController {
} }
@IBAction func reportIssue(_: Any) { @IBAction func reportIssue(_: Any) {
feedbackWindow.showWindow(nil) feedbackWindow = AppFeedbackWindowController.sharedWindow
feedbackWindow?.appFeedbackWindowDelegate = self
feedbackWindow?.showWindow(nil)
NSApp.activate(ignoringOtherApps: true) NSApp.activate(ignoringOtherApps: true)
view.window?.orderOut(nil) view.window?.orderOut(nil)
@ -150,3 +152,9 @@ class AboutViewController: ParentViewController {
underlineTextForActionButton() underlineTextForActionButton()
} }
} }
extension AboutViewController: AppFeedbackWindowControllerDelegate {
func appFeedbackWindowWillClose() {
feedbackWindow = nil
}
}

6
Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift

@ -5,6 +5,10 @@ import CoreLoggerKit
import CoreModelKit import CoreModelKit
import FirebaseDatabase import FirebaseDatabase
protocol AppFeedbackWindowControllerDelegate: AnyObject {
func appFeedbackWindowWillClose()
}
extension NSNib.Name { extension NSNib.Name {
static let appFeedbackWindowIdentifier = NSNib.Name("AppFeedbackWindow") static let appFeedbackWindowIdentifier = NSNib.Name("AppFeedbackWindow")
static let onboardingWindowIdentifier = NSNib.Name("OnboardingWindow") static let onboardingWindowIdentifier = NSNib.Name("OnboardingWindow")
@ -36,6 +40,7 @@ class AppFeedbackWindowController: NSWindowController {
@IBOutlet var progressIndicator: NSProgressIndicator! @IBOutlet var progressIndicator: NSProgressIndicator!
@IBOutlet var quickCommentsLabel: PointingHandCursorButton! @IBOutlet var quickCommentsLabel: PointingHandCursorButton!
public weak var appFeedbackWindowDelegate: AppFeedbackWindowControllerDelegate?
private var themeDidChangeNotification: NSObjectProtocol? private var themeDidChangeNotification: NSObjectProtocol?
private var serialNumber: String? { private var serialNumber: String? {
let platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")) let platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"))
@ -307,6 +312,7 @@ extension AppFeedbackWindowController: NSWindowDelegate {
emailField.stringValue = CLEmptyString emailField.stringValue = CLEmptyString
feedbackTextView.string = CLEmptyString feedbackTextView.string = CLEmptyString
isActivityInProgress = false isActivityInProgress = false
appFeedbackWindowDelegate?.appFeedbackWindowWillClose()
} }
func bringPreferencesWindowToFront() { func bringPreferencesWindowToFront() {

Loading…
Cancel
Save