From 5b017cb6a75b4a5fcbb209819e8258ec461763c6 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Fri, 28 Dec 2018 21:49:32 -0800 Subject: [PATCH] Add CrashReportWindowController. --- .../CrashReportWindowController.swift | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 NetNewsWire/CrashReporter/CrashReportWindowController.swift diff --git a/NetNewsWire/CrashReporter/CrashReportWindowController.swift b/NetNewsWire/CrashReporter/CrashReportWindowController.swift new file mode 100644 index 000000000..44e90a5ac --- /dev/null +++ b/NetNewsWire/CrashReporter/CrashReportWindowController.swift @@ -0,0 +1,52 @@ +// +// CrashReportWindowController.swift +// NetNewsWire +// +// Created by Brent Simmons on 12/28/18. +// Copyright © 2018 Ranchero Software. All rights reserved. +// + +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) + textView.textContainerInset = NSSize(width: 5.0, height: 5.0) + textView.string = crashLog.content + } + } + + override func windowDidLoad() { + super.windowDidLoad() + windowFrameAutosaveName = CrashReportWindowController.windowName + } + + // MARK: - Actions + + @IBAction func sendCrashReport(_ sender: Any?) { + CrashReporter.sendCrashLog(crashLog) + // TODO: some kind of acknowledgement + } + + @IBAction func cancel(_ sender: Any?) { + close() + } + + @IBAction func showPrivacyPolicy(_ sender: Any?) { + Browser.open(AppConstants.privacyPolicyURL, inBackground: false) + } +} + +private extension CrashReportWindowController { + +}