diff --git a/NetNewsWire/CrashReporter/CrashReportWindowController.swift b/NetNewsWire/CrashReporter/CrashReportWindowController.swift
index 44e90a5ac..b933692be 100644
--- a/NetNewsWire/CrashReporter/CrashReportWindowController.swift
+++ b/NetNewsWire/CrashReporter/CrashReportWindowController.swift
@@ -10,14 +10,6 @@ import Cocoa
final class CrashReportWindowController: NSWindowController {
- private var crashLog: CrashLog!
- private static let windowName = "CrashReporterWindow"
-
- convenience init(crashLog: CrashLog) {
- self.init(windowNibName: CrashReportWindowController.windowName)
- self.crashLog = crashLog
- }
-
@IBOutlet var textView: NSTextView! {
didSet {
textView.font = NSFont.userFixedPitchFont(ofSize: 0.0)
@@ -26,27 +18,60 @@ final class CrashReportWindowController: NSWindowController {
}
}
- override func windowDidLoad() {
- super.windowDidLoad()
- windowFrameAutosaveName = CrashReportWindowController.windowName
- }
+ @IBOutlet var sendCrashLogButton: NSButton!
+ @IBOutlet var dontSendButton: NSButton!
+
+ var testing = false // If true, crashLog won’t actually be sent.
+
+ private var crashLog: CrashLog!
+
+ private var didSendCrashLog = false {
+ didSet {
+ sendCrashLogButton.isEnabled = !didSendCrashLog
+ dontSendButton.isEnabled = !didSendCrashLog
+ }
+ }
+
+ convenience init(crashLog: CrashLog) {
+ self.init(windowNibName: "CrashReporterWindow")
+ self.crashLog = crashLog
+ }
+
+ override func showWindow(_ sender: Any?) {
+ super.showWindow(sender)
+ window!.center()
+ window!.makeKeyAndOrderFront(sender)
+ }
// MARK: - Actions
@IBAction func sendCrashReport(_ sender: Any?) {
- CrashReporter.sendCrashLog(crashLog)
- // TODO: some kind of acknowledgement
+ guard !didSendCrashLog else {
+ return
+ }
+ didSendCrashLog = true
+ if !testing {
+ CrashReporter.sendCrashLog(crashLog)
+ }
+ showThanksSheet()
}
- @IBAction func cancel(_ sender: Any?) {
+ @IBAction func dontSendCrashReport(_ sender: Any?) {
close()
}
-
- @IBAction func showPrivacyPolicy(_ sender: Any?) {
- Browser.open(AppConstants.privacyPolicyURL, inBackground: false)
- }
}
private extension CrashReportWindowController {
+ func showThanksSheet() {
+ guard let window = window else {
+ return
+ }
+
+ let alert = NSAlert()
+ alert.alertStyle = .informational
+ alert.messageText = NSLocalizedString("Crash Report Sent", comment: "Crash Report Window")
+ alert.informativeText = NSLocalizedString("Thank you! This helps us to know about crashing bugs, so we can fix them.", comment: "Crash Report Window")
+ alert.beginSheetModal(for: window)
+ }
}
diff --git a/NetNewsWire/CrashReporter/CrashReporterWindow.xib b/NetNewsWire/CrashReporter/CrashReporterWindow.xib
index 11a1e9a3a..110272441 100644
--- a/NetNewsWire/CrashReporter/CrashReporterWindow.xib
+++ b/NetNewsWire/CrashReporter/CrashReporterWindow.xib
@@ -5,7 +5,13 @@
-
+
+
+
+
+
+
+
@@ -84,7 +90,7 @@
- You can skip this window in the future by telling NetNewsWire to automatically send crash reports. You can also turn this setting on and off in the Preferences window, in the Advanced section.
+ You can skip this window in the future by telling NetNewsWire to automatically send crash logs. You can also turn this setting on and off in the Preferences window, in the Advanced section.
@@ -98,6 +104,9 @@
DQ
+
+
+