Merge branch 'mac-candidate'

This commit is contained in:
Brent Simmons 2019-08-18 16:08:04 -07:00
commit 2cc5e20fad
3 changed files with 185 additions and 27 deletions

View File

@ -177,14 +177,91 @@
<objects> <objects>
<viewController storyboardIdentifier="Advanced" id="GNh-Wp-giO" customClass="AdvancedPreferencesViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController"> <viewController storyboardIdentifier="Advanced" id="GNh-Wp-giO" customClass="AdvancedPreferencesViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" id="Hij-7D-6Pw"> <view key="view" id="Hij-7D-6Pw">
<rect key="frame" x="0.0" y="0.0" width="450" height="93"/> <rect key="frame" x="0.0" y="0.0" width="450" height="281"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="YHH-fu-i0y"> <customView translatesAutoresizingMaskIntoConstraints="NO" id="uJD-OF-YVY">
<rect key="frame" x="116" y="52" width="219" height="25"/> <rect key="frame" x="60" y="20" width="330" height="241"/>
<subviews> <subviews>
<textField horizontalHuggingPriority="1000" verticalHuggingPriority="1000" horizontalCompressionResistancePriority="1000" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="EH5-aS-E55">
<rect key="frame" x="-2" y="224" width="87" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="App Updates:" id="zqG-X2-E9b">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="T4A-0o-p2w">
<rect key="frame" x="89" y="223" width="145" height="18"/>
<buttonCell key="cell" type="check" title="Check automatically" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="dm8-Xy-0Ba">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<binding destination="1hh-8U-B8b" name="value" keyPath="automaticallyChecksForUpdates" id="cge-fo-09y">
<dictionary key="options">
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
<bool key="NSConditionallySetsEnabled" value="NO"/>
<integer key="NSMultipleValuesPlaceholder" value="0"/>
<integer key="NSNoSelectionPlaceholder" value="0"/>
<integer key="NSNotApplicablePlaceholder" value="0"/>
<integer key="NSNullPlaceholder" value="0"/>
<bool key="NSRaisesForNotApplicableKeys" value="NO"/>
</dictionary>
</binding>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Q6M-Iz-Ypx">
<rect key="frame" x="17" y="197" width="68" height="17"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Download:" id="6bb-c0-guo">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="QCu-J4-0yV">
<rect key="frame" x="90" y="196" width="110" height="18"/>
<buttonCell key="cell" type="radio" title="Release builds" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="F8M-rS-und">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="updateTypeButtonClicked:" target="GNh-Wp-giO" id="Cja-cf-HV7"/>
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="CeE-AE-hRG">
<rect key="frame" x="90" y="174" width="88" height="18"/>
<buttonCell key="cell" type="radio" title="Test builds" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="Fuf-rU-D6M">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="updateTypeButtonClicked:" target="GNh-Wp-giO" id="3Jh-Vu-GlY"/>
</connections>
</button>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="MzL-QQ-2oL">
<rect key="frame" x="-2" y="116" width="334" height="51"/>
<constraints>
<constraint firstAttribute="width" constant="330" id="jf8-5e-Eij"/>
</constraints>
<textFieldCell key="cell" selectable="YES" title="If youre not sure, choose Release builds. Test builds may have bugs, which may include crashing bugs and data loss." id="fOZ-zv-QTc">
<font key="font" metaFont="system"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TKI-a9-bRX">
<rect key="frame" x="85" y="80" width="154" height="32"/>
<buttonCell key="cell" type="push" title="Check for Updates" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="AaA-Rr-UYD">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="checkForUpdates:" target="1hh-8U-B8b" id="RX4-6c-Osn"/>
</connections>
</button>
<textField horizontalHuggingPriority="1000" verticalHuggingPriority="1000" horizontalCompressionResistancePriority="1000" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="SUN-k3-ZEb"> <textField horizontalHuggingPriority="1000" verticalHuggingPriority="1000" horizontalCompressionResistancePriority="1000" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="SUN-k3-ZEb">
<rect key="frame" x="2" y="4" width="73" height="17"/> <rect key="frame" x="12" y="40" width="73" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Crash logs:" id="qcq-fU-Ks0"> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Crash logs:" id="qcq-fU-Ks0">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@ -192,7 +269,7 @@
</textFieldCell> </textFieldCell>
</textField> </textField>
<button horizontalHuggingPriority="1000" verticalHuggingPriority="1000" horizontalCompressionResistancePriority="1000" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="UHg-1l-FlD"> <button horizontalHuggingPriority="1000" verticalHuggingPriority="1000" horizontalCompressionResistancePriority="1000" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="UHg-1l-FlD">
<rect key="frame" x="79" y="3" width="138" height="18"/> <rect key="frame" x="89" y="39" width="138" height="18"/>
<buttonCell key="cell" type="check" title="Send automatically" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="jnc-C5-4oI"> <buttonCell key="cell" type="check" title="Send automatically" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="jnc-C5-4oI">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
@ -211,18 +288,8 @@
</binding> </binding>
</connections> </connections>
</button> </button>
</subviews>
<constraints>
<constraint firstItem="SUN-k3-ZEb" firstAttribute="top" secondItem="YHH-fu-i0y" secondAttribute="top" constant="4" id="1ob-SX-cEr"/>
<constraint firstItem="SUN-k3-ZEb" firstAttribute="leading" secondItem="YHH-fu-i0y" secondAttribute="leading" constant="4" id="4S2-oa-ux0"/>
<constraint firstAttribute="bottom" secondItem="SUN-k3-ZEb" secondAttribute="bottom" constant="4" id="Jca-Ye-1QG"/>
<constraint firstItem="UHg-1l-FlD" firstAttribute="leading" secondItem="SUN-k3-ZEb" secondAttribute="trailing" constant="8" symbolic="YES" id="VR4-qB-pAv"/>
<constraint firstItem="UHg-1l-FlD" firstAttribute="firstBaseline" secondItem="SUN-k3-ZEb" secondAttribute="firstBaseline" id="fsO-Cm-ojt"/>
<constraint firstAttribute="trailing" secondItem="UHg-1l-FlD" secondAttribute="trailing" constant="4" id="gW6-Lm-rC4"/>
</constraints>
</customView>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="uuc-f2-OFX"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="uuc-f2-OFX">
<rect key="frame" x="163" y="13" width="124" height="32"/> <rect key="frame" x="85" y="-7" width="154" height="32"/>
<buttonCell key="cell" type="push" title="Privacy Policy" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="kSv-Wu-NYx"> <buttonCell key="cell" type="push" title="Privacy Policy" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="kSv-Wu-NYx">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
@ -233,18 +300,56 @@
</button> </button>
</subviews> </subviews>
<constraints> <constraints>
<constraint firstItem="YHH-fu-i0y" firstAttribute="centerX" secondItem="Hij-7D-6Pw" secondAttribute="centerX" id="A8h-AD-wpA"/> <constraint firstAttribute="trailing" secondItem="MzL-QQ-2oL" secondAttribute="trailing" id="04t-Su-3fv"/>
<constraint firstItem="uuc-f2-OFX" firstAttribute="top" secondItem="UHg-1l-FlD" secondAttribute="bottom" constant="16" id="Iyi-OX-Im2"/> <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="T4A-0o-p2w" secondAttribute="trailing" id="0zv-Cr-GlR"/>
<constraint firstAttribute="bottom" secondItem="uuc-f2-OFX" secondAttribute="bottom" constant="20" symbolic="YES" id="Qfi-i7-9Tw"/> <constraint firstItem="uuc-f2-OFX" firstAttribute="width" secondItem="TKI-a9-bRX" secondAttribute="width" id="4ZH-zo-sNF"/>
<constraint firstItem="YHH-fu-i0y" firstAttribute="top" secondItem="Hij-7D-6Pw" secondAttribute="top" constant="16" id="Vjr-8X-8Ib"/> <constraint firstItem="QCu-J4-0yV" firstAttribute="leading" secondItem="T4A-0o-p2w" secondAttribute="leading" id="4c4-16-5yq"/>
<constraint firstItem="uuc-f2-OFX" firstAttribute="centerX" secondItem="Hij-7D-6Pw" secondAttribute="centerX" id="frb-uz-KeI"/> <constraint firstItem="TKI-a9-bRX" firstAttribute="leading" secondItem="CeE-AE-hRG" secondAttribute="leading" id="6Sm-VV-Qda"/>
<constraint firstItem="EH5-aS-E55" firstAttribute="leading" secondItem="uJD-OF-YVY" secondAttribute="leading" id="6eS-X9-PTK"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="UHg-1l-FlD" secondAttribute="trailing" id="7gl-UP-wqg"/>
<constraint firstItem="UHg-1l-FlD" firstAttribute="firstBaseline" secondItem="SUN-k3-ZEb" secondAttribute="firstBaseline" id="MAL-Ip-mEN"/>
<constraint firstItem="MzL-QQ-2oL" firstAttribute="leading" secondItem="uJD-OF-YVY" secondAttribute="leading" id="MMt-v0-0gl"/>
<constraint firstItem="CeE-AE-hRG" firstAttribute="leading" secondItem="T4A-0o-p2w" secondAttribute="leading" id="NWB-BO-GtL"/>
<constraint firstItem="uuc-f2-OFX" firstAttribute="leading" secondItem="TKI-a9-bRX" secondAttribute="leading" id="PQj-is-Zlx"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="QCu-J4-0yV" secondAttribute="trailing" id="QVh-z8-aNJ"/>
<constraint firstItem="UHg-1l-FlD" firstAttribute="leading" secondItem="CeE-AE-hRG" secondAttribute="leading" id="QlP-bI-uga"/>
<constraint firstItem="EH5-aS-E55" firstAttribute="top" secondItem="uJD-OF-YVY" secondAttribute="top" id="VDU-as-fdx"/>
<constraint firstAttribute="bottom" secondItem="uuc-f2-OFX" secondAttribute="bottom" id="YA7-Xm-cFO"/>
<constraint firstItem="Q6M-Iz-Ypx" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="uJD-OF-YVY" secondAttribute="leading" id="Ygv-ha-RLn"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="TKI-a9-bRX" secondAttribute="trailing" id="bLP-TU-TeL"/>
<constraint firstItem="SUN-k3-ZEb" firstAttribute="trailing" secondItem="Q6M-Iz-Ypx" secondAttribute="trailing" id="c23-mt-Mfd"/>
<constraint firstItem="SUN-k3-ZEb" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="uJD-OF-YVY" secondAttribute="leading" id="dj1-Uj-ibG"/>
<constraint firstItem="MzL-QQ-2oL" firstAttribute="top" secondItem="CeE-AE-hRG" secondAttribute="bottom" constant="8" symbolic="YES" id="emd-u5-hgZ"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="uuc-f2-OFX" secondAttribute="trailing" id="gBp-7A-zG6"/>
<constraint firstItem="CeE-AE-hRG" firstAttribute="top" secondItem="QCu-J4-0yV" secondAttribute="bottom" constant="6" symbolic="YES" id="hYd-1l-oMg"/>
<constraint firstItem="uuc-f2-OFX" firstAttribute="top" secondItem="UHg-1l-FlD" secondAttribute="bottom" constant="20" symbolic="YES" id="jcZ-pH-ABY"/>
<constraint firstItem="T4A-0o-p2w" firstAttribute="firstBaseline" secondItem="EH5-aS-E55" secondAttribute="firstBaseline" id="jvM-Qd-rbB"/>
<constraint firstItem="TKI-a9-bRX" firstAttribute="top" secondItem="MzL-QQ-2oL" secondAttribute="bottom" constant="8" symbolic="YES" id="lIt-NB-IL8"/>
<constraint firstItem="QCu-J4-0yV" firstAttribute="top" secondItem="T4A-0o-p2w" secondAttribute="bottom" constant="12" id="nBX-kW-ncB"/>
<constraint firstItem="T4A-0o-p2w" firstAttribute="leading" secondItem="EH5-aS-E55" secondAttribute="trailing" constant="8" symbolic="YES" id="oNo-Il-411"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="CeE-AE-hRG" secondAttribute="trailing" id="qB6-BG-c3D"/>
<constraint firstItem="UHg-1l-FlD" firstAttribute="top" secondItem="TKI-a9-bRX" secondAttribute="bottom" constant="32" id="qJT-Cw-fcV"/>
<constraint firstItem="Q6M-Iz-Ypx" firstAttribute="trailing" secondItem="EH5-aS-E55" secondAttribute="trailing" id="tJ7-bI-cwl"/>
<constraint firstItem="QCu-J4-0yV" firstAttribute="firstBaseline" secondItem="Q6M-Iz-Ypx" secondAttribute="firstBaseline" id="zV9-lp-iXf"/>
</constraints>
</customView>
</subviews>
<constraints>
<constraint firstItem="uJD-OF-YVY" firstAttribute="top" secondItem="Hij-7D-6Pw" secondAttribute="top" constant="20" symbolic="YES" id="T6k-KK-0gC"/>
<constraint firstAttribute="bottom" secondItem="uJD-OF-YVY" secondAttribute="bottom" constant="20" symbolic="YES" id="ftc-7Q-cpC"/>
<constraint firstItem="uJD-OF-YVY" firstAttribute="centerX" secondItem="Hij-7D-6Pw" secondAttribute="centerX" id="njb-lt-xOA"/>
</constraints> </constraints>
</view> </view>
<connections>
<outlet property="releaseBuildsButton" destination="QCu-J4-0yV" id="mjo-l6-P3b"/>
<outlet property="testBuildsButton" destination="CeE-AE-hRG" id="mFo-DS-g83"/>
</connections>
</viewController> </viewController>
<customObject id="VX1-M3-K0J" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/> <customObject id="VX1-M3-K0J" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
<customObject id="1hh-8U-B8b" customClass="SUUpdater"/>
<userDefaultsController id="Y8q-yi-F5Z"/> <userDefaultsController id="Y8q-yi-F5Z"/>
</objects> </objects>
<point key="canvasLocation" x="-29" y="347"/> <point key="canvasLocation" x="-29" y="455.5"/>
</scene> </scene>
<!--Accounts Preferences View Controller--> <!--Accounts Preferences View Controller-->
<scene sceneID="Rsj-41-ZOj"> <scene sceneID="Rsj-41-ZOj">

View File

@ -10,5 +10,56 @@ import AppKit
final class AdvancedPreferencesViewController: NSViewController { final class AdvancedPreferencesViewController: NSViewController {
@IBOutlet var releaseBuildsButton: NSButton!
@IBOutlet var testBuildsButton: NSButton!
let releaseBuildsURL = Bundle.main.infoDictionary!["SUFeedURL"]! as! String
let testBuildsURL = Bundle.main.infoDictionary!["FeedURLForTestBuilds"]! as! String
let appcastDefaultsKey = "SUFeedURL"
var didRegisterForNotification = false
var wantsTestBuilds: Bool {
get {
return currentAppcastURL() == testBuildsURL
}
set {
UserDefaults.standard.set(newValue ? testBuildsURL : releaseBuildsURL, forKey: appcastDefaultsKey)
}
}
override func viewWillAppear() {
super.viewWillAppear()
updateUI()
if !didRegisterForNotification {
NotificationCenter.default.addObserver(self, selector: #selector(userDefaultsDidChange(_:)), name: UserDefaults.didChangeNotification, object: nil)
didRegisterForNotification = true
}
}
@IBAction func updateTypeButtonClicked(_ sender: Any?) {
guard let button = sender as? NSButton else {
return
}
wantsTestBuilds = (button === testBuildsButton)
}
@objc func userDefaultsDidChange(_ sender: Any?) {
updateUI()
}
} }
private extension AdvancedPreferencesViewController {
func updateUI() {
if wantsTestBuilds {
testBuildsButton.state = .on
}
else {
releaseBuildsButton.state = .on
}
}
func currentAppcastURL() -> String {
return UserDefaults.standard.string(forKey: appcastDefaultsKey) ?? ""
}
}

View File

@ -56,6 +56,8 @@
<key>OSAScriptingDefinition</key> <key>OSAScriptingDefinition</key>
<string>NetNewsWire.sdef</string> <string>NetNewsWire.sdef</string>
<key>SUFeedURL</key> <key>SUFeedURL</key>
<string>https://ranchero.com/downloads/netnewswire-release.xml</string>
<key>FeedURLForTestBuilds</key>
<string>https://ranchero.com/downloads/netnewswire-beta.xml</string> <string>https://ranchero.com/downloads/netnewswire-beta.xml</string>
<key>UserAgent</key> <key>UserAgent</key>
<string>NetNewsWire (RSS Reader; https://ranchero.com/netnewswire/)</string> <string>NetNewsWire (RSS Reader; https://ranchero.com/netnewswire/)</string>