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?
private lazy var feedbackWindow = AppFeedbackWindowController.shared()
private var feedbackWindow: AppFeedbackWindowController?
private var notePopover: NotesPopover?
@ -890,9 +890,9 @@ class ParentPanelController: NSWindowController {
} else if sender.title == PanelConstants.yesWithQuestionMark {
ReviewController.prompted()
updateReviewView()
feedbackWindow = AppFeedbackWindowController.shared()
feedbackWindow.showWindow(nil)
feedbackWindow?.appFeedbackWindowDelegate = self
feedbackWindow?.showWindow(nil)
NSApp.activate(ignoringOtherApps: true)
} else {
updateReviewView()
@ -986,7 +986,9 @@ class ParentPanelController: NSWindowController {
}
@objc func reportIssue() {
feedbackWindow.showWindow(nil)
feedbackWindow = AppFeedbackWindowController.shared()
feedbackWindow?.appFeedbackWindowDelegate = self
feedbackWindow?.showWindow(nil)
NSApp.activate(ignoringOtherApps: true)
window?.orderOut(nil)
@ -1147,3 +1149,9 @@ extension ParentPanelController: NSSharingServicePickerDelegate {
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!
private var themeDidChangeNotification: NSObjectProtocol?
private lazy var feedbackWindow = AppFeedbackWindowController.shared()
private var feedbackWindow: AppFeedbackWindowController?
override func viewDidLoad() {
super.viewDidLoad()
@ -120,7 +120,9 @@ class AboutViewController: ParentViewController {
}
@IBAction func reportIssue(_: Any) {
feedbackWindow.showWindow(nil)
feedbackWindow = AppFeedbackWindowController.sharedWindow
feedbackWindow?.appFeedbackWindowDelegate = self
feedbackWindow?.showWindow(nil)
NSApp.activate(ignoringOtherApps: true)
view.window?.orderOut(nil)
@ -150,3 +152,9 @@ class AboutViewController: ParentViewController {
underlineTextForActionButton()
}
}
extension AboutViewController: AppFeedbackWindowControllerDelegate {
func appFeedbackWindowWillClose() {
feedbackWindow = nil
}
}

6
Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift

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

Loading…
Cancel
Save