Run the crash report window at startup when needed.

This commit is contained in:
Brent Simmons 2019-01-11 22:50:36 -08:00
parent e73c660c03
commit 085cfb2e60
3 changed files with 31 additions and 49 deletions

View File

@ -173,7 +173,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
}
#endif
CrashReporter.check(appName: "NetNewsWire")
DispatchQueue.main.async {
CrashReporter.check(appName: "NetNewsWire")
}
}
func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {

View File

@ -44,6 +44,8 @@ struct CrashReporter {
static let sendCrashLogsAutomaticallyKey = "SendCrashLogsAutomatically"
}
private static var crashReportWindowController: CrashReportWindowController?
/// Look in ~/Library/Logs/DiagnosticReports/ for a new crash log for this app.
/// Show a crash log reporter window if found.
static func check(appName: String) {
@ -112,9 +114,9 @@ struct CrashReporter {
}
static func runCrashReporterWindow(_ crashLog: CrashLog) {
// TODO
crashReportWindowController = CrashReportWindowController(crashLogText: crashLog.content)
crashReportWindowController!.showWindow(self)
}
}
private extension CrashReporter {

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@ -16,25 +16,26 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Crash Log Reporter" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="251" y="776" width="496" height="416"/>
<rect key="contentRect" x="251" y="776" width="496" height="498"/>
<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" misplaced="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="496" height="416"/>
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="496" height="498"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="QBv-7S-WQv">
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="QBv-7S-WQv">
<rect key="frame" x="18" y="459" width="460" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" selectable="YES" title="NetNewsWire Crash Log Found" id="k6r-PA-hYf">
<font key="font" size="16" name=".AppleSystemUIFontBold"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="b7P-9Z-RkD">
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="b7P-9Z-RkD">
<rect key="frame" x="18" y="417" width="460" height="34"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" selectable="YES" id="O6E-xl-G55">
<font key="font" metaFont="system"/>
<string key="title">To help us fix crashing bugs, click Send Crash Log. Below is the text that will be sent to Brent. No other information will be sent.</string>
@ -42,9 +43,10 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<scrollView borderType="line" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UTe-5f-47F">
<scrollView borderType="line" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" id="UTe-5f-47F">
<rect key="frame" x="20" y="153" width="456" height="256"/>
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="MeG-49-sPS">
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<clipView key="contentView" copiesOnScroll="NO" id="MeG-49-sPS">
<rect key="frame" x="1" y="1" width="454" height="254"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
@ -58,17 +60,16 @@
<color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
</textView>
</subviews>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</clipView>
<constraints>
<constraint firstAttribute="height" constant="256" id="t2l-lf-pj5"/>
</constraints>
<scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="wLl-nc-XBT">
<rect key="frame" x="439" y="1" width="16" height="254"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="MDs-Wi-EiJ">
<button verticalHuggingPriority="750" id="MDs-Wi-EiJ">
<rect key="frame" x="18" y="118" width="460" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Send crash reports automatically" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="hsB-Hx-Fgs">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
@ -87,8 +88,9 @@
</binding>
</connections>
</button>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="D5D-Vb-5TR">
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" textCompletion="NO" id="D5D-Vb-5TR">
<rect key="frame" x="18" y="61" width="460" height="51"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" allowsUndo="NO" id="nou-5k-c1U">
<font key="font" metaFont="system"/>
<string key="title">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.</string>
@ -96,8 +98,9 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fcK-kG-dtY">
<button verticalHuggingPriority="750" id="fcK-kG-dtY">
<rect key="frame" x="345" y="13" width="137" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Send Crash Log" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="7ot-Ev-JTY">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@ -109,8 +112,9 @@ DQ
<action selector="sendCrashReport:" target="-2" id="mob-bL-tRb"/>
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="o4V-7L-v6D">
<button verticalHuggingPriority="750" id="o4V-7L-v6D">
<rect key="frame" x="208" y="13" width="137" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Dont Send" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="gzj-Vz-pdb">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@ -122,8 +126,9 @@ Gw
<action selector="dontSendCrashReport:" target="-2" id="r3y-TC-h8U"/>
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fEy-Fg-JhO">
<button verticalHuggingPriority="750" id="fEy-Fg-JhO">
<rect key="frame" x="14" y="13" width="137" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Privacy Policy" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="mMg-qO-UGu">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@ -133,35 +138,8 @@ Gw
</connections>
</button>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="QBv-7S-WQv" secondAttribute="trailing" constant="20" symbolic="YES" id="36B-NT-JKz"/>
<constraint firstAttribute="trailing" secondItem="fcK-kG-dtY" secondAttribute="trailing" constant="20" symbolic="YES" id="6md-gj-Ebi"/>
<constraint firstItem="D5D-Vb-5TR" firstAttribute="top" secondItem="MDs-Wi-EiJ" secondAttribute="bottom" constant="8" id="CfF-vN-jCe"/>
<constraint firstAttribute="trailing" secondItem="D5D-Vb-5TR" secondAttribute="trailing" constant="20" symbolic="YES" id="CsH-Gv-cwP"/>
<constraint firstAttribute="trailing" secondItem="MDs-Wi-EiJ" secondAttribute="trailing" constant="20" symbolic="YES" id="ElN-Oc-O2s"/>
<constraint firstItem="D5D-Vb-5TR" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" symbolic="YES" id="GRh-Au-gHX"/>
<constraint firstItem="UTe-5f-47F" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" symbolic="YES" id="U1O-9z-jYz"/>
<constraint firstItem="fcK-kG-dtY" firstAttribute="width" secondItem="o4V-7L-v6D" secondAttribute="width" id="U5j-x8-wHK"/>
<constraint firstItem="fcK-kG-dtY" firstAttribute="firstBaseline" secondItem="o4V-7L-v6D" secondAttribute="firstBaseline" id="Vpq-7Z-UNR"/>
<constraint firstAttribute="trailing" secondItem="b7P-9Z-RkD" secondAttribute="trailing" constant="20" symbolic="YES" id="W19-0H-DVN"/>
<constraint firstItem="MDs-Wi-EiJ" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" symbolic="YES" id="Zwd-5k-iXD"/>
<constraint firstItem="UTe-5f-47F" firstAttribute="top" secondItem="b7P-9Z-RkD" secondAttribute="bottom" constant="8" symbolic="YES" id="aED-61-b2W"/>
<constraint firstItem="fEy-Fg-JhO" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" symbolic="YES" id="dP8-9C-Ig6"/>
<constraint firstItem="fcK-kG-dtY" firstAttribute="top" secondItem="D5D-Vb-5TR" secondAttribute="bottom" constant="20" id="eFz-oU-MeW"/>
<constraint firstItem="b7P-9Z-RkD" firstAttribute="top" secondItem="QBv-7S-WQv" secondAttribute="bottom" constant="8" symbolic="YES" id="eOP-Vs-QAJ"/>
<constraint firstItem="o4V-7L-v6D" firstAttribute="firstBaseline" secondItem="fEy-Fg-JhO" secondAttribute="firstBaseline" id="h78-2f-JRj"/>
<constraint firstItem="QBv-7S-WQv" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" constant="20" symbolic="YES" id="kab-GW-in9"/>
<constraint firstItem="b7P-9Z-RkD" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" symbolic="YES" id="kuR-dt-lWl"/>
<constraint firstAttribute="bottom" secondItem="fcK-kG-dtY" secondAttribute="bottom" constant="20" symbolic="YES" id="kur-mc-PCf"/>
<constraint firstAttribute="trailing" secondItem="UTe-5f-47F" secondAttribute="trailing" constant="20" symbolic="YES" id="mgo-OJ-3aJ"/>
<constraint firstItem="o4V-7L-v6D" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="fEy-Fg-JhO" secondAttribute="trailing" constant="12" symbolic="YES" id="nlA-5l-26s"/>
<constraint firstItem="fcK-kG-dtY" firstAttribute="leading" secondItem="o4V-7L-v6D" secondAttribute="trailing" constant="12" symbolic="YES" id="oSf-uE-ggL"/>
<constraint firstItem="o4V-7L-v6D" firstAttribute="width" secondItem="fEy-Fg-JhO" secondAttribute="width" id="roG-LM-pbk"/>
<constraint firstItem="MDs-Wi-EiJ" firstAttribute="top" secondItem="hW5-cq-81L" secondAttribute="bottom" constant="20" id="uOq-NF-b2t"/>
<constraint firstItem="QBv-7S-WQv" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" symbolic="YES" id="zQj-wQ-ppH"/>
</constraints>
</view>
<point key="canvasLocation" x="136" y="-14"/>
<point key="canvasLocation" x="121" y="-239"/>
</window>
<userDefaultsController representsSharedInstance="YES" id="Owf-g6-irL"/>
</objects>