Make progress on crash report system.

This commit is contained in:
Brent Simmons 2018-12-29 12:31:27 -08:00
parent 1906dff715
commit 3931d7ae38
3 changed files with 15 additions and 15 deletions

View File

@ -14,7 +14,7 @@ final class CrashReportWindowController: NSWindowController {
didSet {
textView.font = NSFont.userFixedPitchFont(ofSize: 0.0)
textView.textContainerInset = NSSize(width: 5.0, height: 5.0)
textView.string = crashLog.content
textView.string = crashLogText
}
}
@ -22,8 +22,8 @@ final class CrashReportWindowController: NSWindowController {
@IBOutlet var dontSendButton: NSButton!
var testing = false // If true, crashLog wont actually be sent.
private var crashLog: CrashLog!
private var crashLogText: String!
private var didSendCrashLog = false {
didSet {
@ -32,15 +32,14 @@ final class CrashReportWindowController: NSWindowController {
}
}
convenience init(crashLog: CrashLog) {
convenience init(crashLogText: String) {
self.init(windowNibName: "CrashReporterWindow")
self.crashLog = crashLog
self.crashLogText = crashLogText
}
override func showWindow(_ sender: Any?) {
super.showWindow(sender)
override func windowDidLoad() {
super.windowDidLoad()
window!.center()
window!.makeKeyAndOrderFront(sender)
}
// MARK: - Actions
@ -51,7 +50,7 @@ final class CrashReportWindowController: NSWindowController {
}
didSendCrashLog = true
if !testing {
CrashReporter.sendCrashLog(crashLog)
CrashReporter.sendCrashLogText(crashLogText)
}
showThanksSheet()
}
@ -71,7 +70,7 @@ private extension CrashReportWindowController {
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.informativeText = NSLocalizedString("Thank you! You rock! This is a big help to us.", comment: "Crash Report Window")
alert.beginSheetModal(for: window)
}
}

View File

@ -85,14 +85,14 @@ struct CrashReporter {
remember(crashLog)
if shouldSendCrashLogsAutomatically() {
sendCrashLog(crashLog)
sendCrashLogText(crashLog.content)
}
else {
runCrashReporterWindow(crashLog)
}
}
static func sendCrashLog(_ crashLog: CrashLog) {
static func sendCrashLogText(_ crashLogText: String) {
// TODO
}

View File

@ -10,6 +10,7 @@
<outlet property="dontSendButton" destination="o4V-7L-v6D" id="Sxa-iT-OTj"/>
<outlet property="sendCrashLogButton" destination="fcK-kG-dtY" id="T04-pD-qZq"/>
<outlet property="textView" destination="hW5-cq-81L" id="RLj-Ti-pGC"/>
<outlet property="window" destination="QvC-M9-y7g" id="4kq-h9-osI"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
@ -20,8 +21,8 @@
<rect key="contentRect" x="251" y="776" width="496" height="416"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
<value key="maxSize" type="size" width="2048" height="2048"/>
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="496" height="498"/>
<view key="contentView" wantsLayer="YES" misplaced="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="496" height="416"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="QBv-7S-WQv">
@ -47,7 +48,7 @@
<rect key="frame" x="1" y="1" width="454" height="254"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView importsGraphics="NO" richText="NO" verticallyResizable="YES" spellingCorrection="YES" smartInsertDelete="YES" id="hW5-cq-81L">
<textView editable="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" allowsCharacterPickerTouchBarItem="NO" textCompletion="NO" id="hW5-cq-81L">
<rect key="frame" x="0.0" y="0.0" width="454" height="254"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>