mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-03 10:47:21 +00:00
Move Articles settings to its own screen.
This commit is contained in:
1 parent
74c2ec2dd8
commit
aa9677c667
6 files changed
+201
-272
No files matched your search
@@ -559,6 +559,15 @@
|
||||
"Email" : {
|
||||
"comment" : "Email field placeholder"
|
||||
},
|
||||
"Enable Full Screen Articles" : {
|
||||
"comment" : "Enable Full Screen Articles"
|
||||
},
|
||||
"Enable Horizontal Swipe to Previous and Next Article" : {
|
||||
"comment" : "Enable Horizontal Swipe to Previous and Next Article"
|
||||
},
|
||||
"Enable JavaScript" : {
|
||||
"comment" : "Enable JavaScript"
|
||||
},
|
||||
"Enable Notifications" : {
|
||||
"comment" : "Notifications"
|
||||
},
|
||||
@@ -1076,6 +1085,9 @@
|
||||
"Open in Browser in Foreground" : {
|
||||
"comment" : "Open in Browser in Foreground menu item title"
|
||||
},
|
||||
"Open Links in NetNewsWire" : {
|
||||
"comment" : "Open Links in NetNewsWire"
|
||||
},
|
||||
"Open Settings" : {
|
||||
"comment" : "Open Settings button"
|
||||
},
|
||||
@@ -1380,6 +1392,9 @@
|
||||
"Smart Feeds" : {
|
||||
"comment" : "Smart Feeds group title"
|
||||
},
|
||||
"Some content, such as videos and embedded social media posts, may require JavaScript to work correctly." : {
|
||||
"comment" : "Some content, such as videos and embedded social media posts, may require JavaScript to work correctly."
|
||||
},
|
||||
"Sort Oldest to Newest" : {
|
||||
"comment" : "Sort Oldest to Newest"
|
||||
},
|
||||
@@ -1438,6 +1453,9 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"Tap the article top bar to enter Full Screen. Tap the top or bottom to exit." : {
|
||||
"comment" : "Tap the article top bar to enter Full Screen. Tap the top or bottom to exit."
|
||||
},
|
||||
"Thanks to Sheila and my family; thanks to my friends in Seattle and around the globe; thanks to the ever-patient and ever-awesome NetNewsWire beta testers.\n\nThanks to [Gus Mueller](https://shapeof.com/) for [FMDB](https://github.com/ccgus/fmdb) by [Flying Meat Software](http://flyingmeat.com/). Thanks to [GitHub](https://github.com) and [Discourse](https://discourse.com) for making open source collaboration easy and fun. Thanks to [Ben Ubois](https://benubois.com/) at [Feedbin](https://feedbin.com) for all the extra help with syncing and article rendering — and [for hosting the server for the Reader view](https://feedbin.com/blog/2019/03/11/the-future-of-full-content/)." : {
|
||||
"comment" : "A list of credits for the app.",
|
||||
"isCommentAutoGenerated" : true
|
||||
@@ -1458,6 +1476,9 @@
|
||||
"The theme “%@” has been installed." : {
|
||||
"comment" : "Theme installed"
|
||||
},
|
||||
"Theme" : {
|
||||
"comment" : "Theme"
|
||||
},
|
||||
"Theme Error" : {
|
||||
"comment" : "Theme download error"
|
||||
},
|
||||
|
||||
@@ -56,7 +56,7 @@ extension UIBarButtonItem: MarkAsReadAlertControllerSourceType {}
|
||||
}
|
||||
let settingsAction = UIAlertAction(title: settingsTitle, style: .default) { _ in
|
||||
Task { @MainActor in
|
||||
coordinator.showSettings(scrollToArticlesSection: true)
|
||||
coordinator.showSettings(showTimelineSettings: true)
|
||||
}
|
||||
}
|
||||
let markAction = UIAlertAction(title: confirmTitle, style: .default, handler: completion)
|
||||
|
||||
@@ -1608,10 +1608,10 @@ struct SidebarItemNode: Hashable, Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
func showSettings(scrollToArticlesSection: Bool = false) {
|
||||
func showSettings(showTimelineSettings: Bool = false) {
|
||||
let settingsNavController = UIStoryboard.settings.instantiateInitialViewController() as! UINavigationController
|
||||
let settingsViewController = settingsNavController.topViewController as! SettingsViewController
|
||||
settingsViewController.scrollToArticlesSection = scrollToArticlesSection
|
||||
settingsViewController.showTimelineSettings = showTimelineSettings
|
||||
settingsNavController.modalPresentationStyle = .formSheet
|
||||
settingsViewController.presentingParentController = rootSplitViewController
|
||||
rootSplitViewController.present(settingsNavController, animated: true)
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
//
|
||||
// ArticlesSettingsViewController.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Brent Simmons on 11/17/26.
|
||||
// Copyright © 2026 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
final class ArticlesSettingsViewController: UITableViewController {
|
||||
|
||||
private enum Row: Int, CaseIterable {
|
||||
case theme
|
||||
case openLinksInNetNewsWire
|
||||
case enableJavaScript
|
||||
case swipeToNextPreviousArticle
|
||||
case enableFullScreenArticles
|
||||
}
|
||||
|
||||
private let openLinksInNetNewsWireSwitch = UISwitch()
|
||||
private let enableJavaScriptSwitch = UISwitch()
|
||||
private let swipeToNextPreviousArticleSwitch = UISwitch()
|
||||
private let enableFullScreenArticlesSwitch = UISwitch()
|
||||
|
||||
private let themeCell = VibrantTableViewCell(style: .value1, reuseIdentifier: nil)
|
||||
|
||||
private var rows = [Row]()
|
||||
private var cells = [Row: UITableViewCell]()
|
||||
|
||||
init() {
|
||||
super.init(style: .insetGrouped)
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
title = NSLocalizedString("Articles", comment: "Articles")
|
||||
|
||||
// The Full Screen Articles row is iPhone-only.
|
||||
rows = Row.allCases.filter { $0 != .enableFullScreenArticles || traitCollection.userInterfaceIdiom == .phone }
|
||||
|
||||
themeCell.textLabel?.text = NSLocalizedString("Theme", comment: "Theme")
|
||||
themeCell.textLabel?.adjustsFontForContentSizeCategory = true
|
||||
themeCell.detailTextLabel?.adjustsFontForContentSizeCategory = true
|
||||
themeCell.accessoryType = .disclosureIndicator
|
||||
|
||||
cells[.theme] = themeCell
|
||||
cells[.openLinksInNetNewsWire] = makeCell(switch: openLinksInNetNewsWireSwitch,
|
||||
title: NSLocalizedString("Open Links in NetNewsWire", comment: "Open Links in NetNewsWire"),
|
||||
footnote: nil,
|
||||
action: #selector(switchOpenLinksInNetNewsWire(_:)))
|
||||
cells[.enableJavaScript] = makeCell(switch: enableJavaScriptSwitch,
|
||||
title: NSLocalizedString("Enable JavaScript", comment: "Enable JavaScript"),
|
||||
footnote: NSLocalizedString("Some content, such as videos and embedded social media posts, may require JavaScript to work correctly.", comment: "Some content, such as videos and embedded social media posts, may require JavaScript to work correctly."),
|
||||
action: #selector(switchEnableJavaScript(_:)))
|
||||
cells[.swipeToNextPreviousArticle] = makeCell(switch: swipeToNextPreviousArticleSwitch,
|
||||
title: NSLocalizedString("Enable Horizontal Swipe to Previous and Next Article", comment: "Enable Horizontal Swipe to Previous and Next Article"),
|
||||
footnote: nil,
|
||||
action: #selector(switchSwipeToNextPreviousArticle(_:)))
|
||||
cells[.enableFullScreenArticles] = makeCell(switch: enableFullScreenArticlesSwitch,
|
||||
title: NSLocalizedString("Enable Full Screen Articles", comment: "Enable Full Screen Articles"),
|
||||
footnote: NSLocalizedString("Tap the article top bar to enter Full Screen. Tap the top or bottom to exit.", comment: "Tap the article top bar to enter Full Screen. Tap the top or bottom to exit."),
|
||||
action: #selector(switchEnableFullScreenArticles(_:)))
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
themeCell.detailTextLabel?.text = ArticleThemesManager.shared.currentTheme.name
|
||||
openLinksInNetNewsWireSwitch.isOn = !AppDefaults.useSystemBrowser
|
||||
enableJavaScriptSwitch.isOn = AppDefaults.isArticleContentJavascriptEnabled
|
||||
swipeToNextPreviousArticleSwitch.isOn = AppDefaults.articleSwipeNavigationEnabled
|
||||
enableFullScreenArticlesSwitch.isOn = AppDefaults.articleFullscreenAvailable
|
||||
}
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
|
||||
}
|
||||
|
||||
// MARK: - UITableViewDataSource
|
||||
|
||||
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return rows.count
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
return cells[rows[indexPath.row]] ?? UITableViewCell()
|
||||
}
|
||||
|
||||
// MARK: - UITableViewDelegate
|
||||
|
||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
switch rows[indexPath.row] {
|
||||
case .theme:
|
||||
let articleThemes = UIStoryboard.settings.instantiateController(ofType: ArticleThemesTableViewController.self)
|
||||
navigationController?.pushViewController(articleThemes, animated: true)
|
||||
default:
|
||||
tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
|
||||
@objc func switchOpenLinksInNetNewsWire(_ sender: UISwitch) {
|
||||
AppDefaults.useSystemBrowser = !sender.isOn
|
||||
}
|
||||
|
||||
@objc func switchEnableJavaScript(_ sender: UISwitch) {
|
||||
AppDefaults.isArticleContentJavascriptEnabled = sender.isOn
|
||||
}
|
||||
|
||||
@objc func switchSwipeToNextPreviousArticle(_ sender: UISwitch) {
|
||||
AppDefaults.articleSwipeNavigationEnabled = sender.isOn
|
||||
}
|
||||
|
||||
@objc func switchEnableFullScreenArticles(_ sender: UISwitch) {
|
||||
AppDefaults.articleFullscreenAvailable = sender.isOn
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private extension ArticlesSettingsViewController {
|
||||
|
||||
/// A plain cell, rather than a vibrant one, so the footnote keeps its secondary color.
|
||||
func makeCell(switch toggle: UISwitch, title: String, footnote: String?, action: Selector) -> UITableViewCell {
|
||||
let cell = UITableViewCell(style: footnote == nil ? .default : .subtitle, reuseIdentifier: nil)
|
||||
cell.selectionStyle = .none
|
||||
cell.textLabel?.text = title
|
||||
cell.textLabel?.numberOfLines = 0
|
||||
cell.textLabel?.adjustsFontForContentSizeCategory = true
|
||||
if let footnote {
|
||||
cell.detailTextLabel?.text = footnote
|
||||
cell.detailTextLabel?.numberOfLines = 0
|
||||
cell.detailTextLabel?.font = .preferredFont(forTextStyle: .footnote)
|
||||
cell.detailTextLabel?.textColor = .secondaryLabel
|
||||
cell.detailTextLabel?.adjustsFontForContentSizeCategory = true
|
||||
}
|
||||
toggle.onTintColor = Assets.Colors.primaryAccent
|
||||
toggle.addTarget(self, action: action, for: .valueChanged)
|
||||
cell.accessoryView = toggle
|
||||
return cell
|
||||
}
|
||||
}
|
||||
@@ -115,192 +115,6 @@
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
<tableViewSection headerTitle="Articles" id="TRr-Ew-IvU">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" id="WFP-zj-Pve" customClass="VibrantBasicTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="20" y="791.5" width="374" height="51"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="WFP-zj-Pve" id="DCX-wc-LSo">
|
||||
<rect key="frame" x="0.0" y="0.0" width="343.5" height="51"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Theme" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bbw-L9-a3X">
|
||||
<rect key="frame" x="20" y="15.5" width="53" height="20.5"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Default" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DUf-DZ-3Nm">
|
||||
<rect key="frame" x="280.5" y="15.5" width="55" height="20.5"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="DUf-DZ-3Nm" firstAttribute="centerY" secondItem="DCX-wc-LSo" secondAttribute="centerY" id="4Bc-RP-0ZF"/>
|
||||
<constraint firstItem="bbw-L9-a3X" firstAttribute="leading" secondItem="DCX-wc-LSo" secondAttribute="leadingMargin" id="KuW-V7-ekH"/>
|
||||
<constraint firstItem="DUf-DZ-3Nm" firstAttribute="trailing" secondItem="DCX-wc-LSo" secondAttribute="trailingMargin" id="dRF-FI-egK"/>
|
||||
<constraint firstItem="bbw-L9-a3X" firstAttribute="centerY" secondItem="DCX-wc-LSo" secondAttribute="centerY" id="vHl-bd-8cN"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="detail" destination="DUf-DZ-3Nm" id="Eak-bS-PpA"/>
|
||||
<outlet property="label" destination="bbw-L9-a3X" id="lGz-7X-px8"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="EYf-v1-lNi" customClass="VibrantBasicTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="20" y="842.5" width="374" height="51.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="EYf-v1-lNi" id="7nz-0Y-HaW">
|
||||
<rect key="frame" x="0.0" y="0.0" width="374" height="51.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" text="Open Links in NetNewsWire" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Wm4-Y1-7nX">
|
||||
<rect key="frame" x="20" y="15" width="265" height="21.5"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dhR-L2-PX3" userLabel="Open Links in NetNewsWire">
|
||||
<rect key="frame" x="293" y="12" width="63" height="28"/>
|
||||
<color key="onTintColor" name="primaryAccentColor"/>
|
||||
<connections>
|
||||
<action selector="switchBrowserPreference:" destination="a0p-rk-skQ" eventType="valueChanged" id="hLC-cV-Wjj"/>
|
||||
</connections>
|
||||
</switch>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="dhR-L2-PX3" firstAttribute="leading" secondItem="Wm4-Y1-7nX" secondAttribute="trailing" constant="8" symbolic="YES" id="9kW-Cm-Jry"/>
|
||||
<constraint firstItem="Wm4-Y1-7nX" firstAttribute="top" secondItem="7nz-0Y-HaW" secondAttribute="topMargin" id="SlQ-r5-8Xc"/>
|
||||
<constraint firstAttribute="bottomMargin" secondItem="Wm4-Y1-7nX" secondAttribute="bottom" id="VUX-rB-00D"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="dhR-L2-PX3" secondAttribute="trailing" id="WPe-Kt-3Wb"/>
|
||||
<constraint firstItem="dhR-L2-PX3" firstAttribute="centerY" secondItem="7nz-0Y-HaW" secondAttribute="centerY" id="gWw-7Q-XcA"/>
|
||||
<constraint firstItem="Wm4-Y1-7nX" firstAttribute="leading" secondItem="7nz-0Y-HaW" secondAttribute="leadingMargin" id="wMz-Ae-No9"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="label" destination="Wm4-Y1-7nX" id="R62-za-yVz"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="awa-ag-hEl" customClass="VibrantTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="20" y="894" width="374" height="110"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="awa-ag-hEl" id="hhU-hw-2Lz">
|
||||
<rect key="frame" x="0.0" y="0.0" width="374" height="110"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" verticalCompressionResistancePriority="751" ambiguous="YES" text="Enable JavaScript" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bO3-aT-4AW" userLabel="Enable JavaScript">
|
||||
<rect key="frame" x="20" y="11" width="135.5" height="15.5"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" ambiguous="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="Djo-HE-LWS">
|
||||
<rect key="frame" x="293" y="6" width="63" height="28"/>
|
||||
<color key="onTintColor" name="primaryAccentColor"/>
|
||||
<connections>
|
||||
<action selector="switchJavaScriptPreference:" destination="a0p-rk-skQ" eventType="valueChanged" id="r26-11-OEX"/>
|
||||
</connections>
|
||||
</switch>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" ambiguous="YES" text="Some content, such as videos and embedded social media posts, may require JavaScript to work correctly." textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FkT-O9-gpj">
|
||||
<rect key="frame" x="20" y="33" width="263" height="0.0"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="Djo-HE-LWS" firstAttribute="top" relation="greaterThanOrEqual" secondItem="hhU-hw-2Lz" secondAttribute="top" constant="6" id="3es-j1-AEs"/>
|
||||
<constraint firstItem="FkT-O9-gpj" firstAttribute="top" secondItem="bO3-aT-4AW" secondAttribute="bottom" constant="6.5" id="AWi-qZ-jjq"/>
|
||||
<constraint firstItem="FkT-O9-gpj" firstAttribute="leading" secondItem="hhU-hw-2Lz" secondAttribute="leadingMargin" id="ILm-gL-eT3"/>
|
||||
<constraint firstItem="FkT-O9-gpj" firstAttribute="bottom" secondItem="hhU-hw-2Lz" secondAttribute="bottomMargin" id="Z8D-AJ-KoP"/>
|
||||
<constraint firstItem="bO3-aT-4AW" firstAttribute="leading" secondItem="hhU-hw-2Lz" secondAttribute="leadingMargin" id="bpp-cc-P7J"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="Djo-HE-LWS" secondAttribute="trailing" id="dmf-Re-xTV"/>
|
||||
<constraint firstItem="bO3-aT-4AW" firstAttribute="top" secondItem="hhU-hw-2Lz" secondAttribute="topMargin" id="kpO-4b-iXd"/>
|
||||
<constraint firstItem="Djo-HE-LWS" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="bO3-aT-4AW" secondAttribute="trailing" constant="8" id="lgg-z7-JQE"/>
|
||||
<constraint firstItem="Djo-HE-LWS" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="FkT-O9-gpj" secondAttribute="trailing" constant="8" id="prK-Kv-ZYU"/>
|
||||
<constraint firstItem="Djo-HE-LWS" firstAttribute="centerY" secondItem="bO3-aT-4AW" secondAttribute="centerY" id="qmu-hG-G05"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="Sw1-pe-Cel" customClass="VibrantBasicTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="20" y="1004" width="374" height="51.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Sw1-pe-Cel" id="Sw1-pe-Cnt">
|
||||
<rect key="frame" x="0.0" y="0.0" width="374" height="51.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" text="Enable Horizontal Swipe to Previous and Next Article" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Sw1-pe-Lbl">
|
||||
<rect key="frame" x="20" y="15" width="265" height="21.5"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Sw1-pe-Swt" userLabel="Enable Horizontal Swipe to Previous and Next Article">
|
||||
<rect key="frame" x="293" y="12" width="63" height="28"/>
|
||||
<color key="onTintColor" name="primaryAccentColor"/>
|
||||
<connections>
|
||||
<action selector="switchSwipeToNextPreviousArticle:" destination="a0p-rk-skQ" eventType="valueChanged" id="Sw1-pe-Act"/>
|
||||
</connections>
|
||||
</switch>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="Sw1-pe-Swt" firstAttribute="leading" secondItem="Sw1-pe-Lbl" secondAttribute="trailing" constant="8" symbolic="YES" id="Sw1-pe-C01"/>
|
||||
<constraint firstItem="Sw1-pe-Lbl" firstAttribute="top" secondItem="Sw1-pe-Cnt" secondAttribute="topMargin" id="Sw1-pe-C02"/>
|
||||
<constraint firstAttribute="bottomMargin" secondItem="Sw1-pe-Lbl" secondAttribute="bottom" id="Sw1-pe-C03"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="Sw1-pe-Swt" secondAttribute="trailing" id="Sw1-pe-C04"/>
|
||||
<constraint firstItem="Sw1-pe-Swt" firstAttribute="centerY" secondItem="Sw1-pe-Cnt" secondAttribute="centerY" id="Sw1-pe-C05"/>
|
||||
<constraint firstItem="Sw1-pe-Lbl" firstAttribute="leading" secondItem="Sw1-pe-Cnt" secondAttribute="leadingMargin" id="Sw1-pe-C06"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="label" destination="Sw1-pe-Lbl" id="Sw1-pe-Out"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="WR6-xo-ty2" customClass="VibrantTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="20" y="1004" width="374" height="92"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="WR6-xo-ty2" id="zX8-l2-bVH">
|
||||
<rect key="frame" x="0.0" y="0.0" width="374" height="92"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" verticalCompressionResistancePriority="751" ambiguous="YES" text="Enable Full Screen Articles" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="79e-5s-vd0">
|
||||
<rect key="frame" x="20" y="11" width="202" height="15.5"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" ambiguous="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="2Md-2E-7Z4">
|
||||
<rect key="frame" x="293" y="6" width="63" height="28"/>
|
||||
<color key="onTintColor" name="primaryAccentColor"/>
|
||||
<connections>
|
||||
<action selector="switchFullscreenArticles:" destination="a0p-rk-skQ" eventType="valueChanged" id="5fa-Ad-e0j"/>
|
||||
</connections>
|
||||
</switch>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" ambiguous="YES" text="Tap the article top bar to enter Full Screen. Tap the top or bottom to exit." textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="a30-nc-ZS4">
|
||||
<rect key="frame" x="20" y="33" width="262.5" height="0.0"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="2Md-2E-7Z4" firstAttribute="centerY" secondItem="79e-5s-vd0" secondAttribute="centerY" id="3KV-rT-Dfb"/>
|
||||
<constraint firstItem="a30-nc-ZS4" firstAttribute="leading" secondItem="zX8-l2-bVH" secondAttribute="leadingMargin" id="52y-SY-gbp"/>
|
||||
<constraint firstItem="79e-5s-vd0" firstAttribute="top" secondItem="zX8-l2-bVH" secondAttribute="topMargin" id="9bF-Q1-sYE"/>
|
||||
<constraint firstItem="2Md-2E-7Z4" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="a30-nc-ZS4" secondAttribute="trailing" constant="8" id="E9l-8S-WBL"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="2Md-2E-7Z4" secondAttribute="trailing" id="ELH-06-H2j"/>
|
||||
<constraint firstItem="2Md-2E-7Z4" firstAttribute="top" relation="greaterThanOrEqual" secondItem="zX8-l2-bVH" secondAttribute="top" constant="6" id="aBe-aC-mva"/>
|
||||
<constraint firstItem="a30-nc-ZS4" firstAttribute="bottom" secondItem="zX8-l2-bVH" secondAttribute="bottomMargin" id="b3g-at-rjh"/>
|
||||
<constraint firstItem="2Md-2E-7Z4" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="79e-5s-vd0" secondAttribute="trailing" constant="8" id="lUn-8D-X20"/>
|
||||
<constraint firstItem="79e-5s-vd0" firstAttribute="leading" secondItem="zX8-l2-bVH" secondAttribute="leadingMargin" id="tdZ-30-ACC"/>
|
||||
<constraint firstItem="a30-nc-ZS4" firstAttribute="top" secondItem="79e-5s-vd0" secondAttribute="bottom" constant="6.5" id="wuJ-LG-d6p"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
<tableViewSection id="Trb-eL-9xZ">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="Sdb-lb-4bR" style="IBUITableViewCellStyleDefault" id="Sdb-Cel-7rY" customClass="VibrantTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
@@ -337,6 +151,23 @@
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="Art-lb-4bR" style="IBUITableViewCellStyleDefault" id="Art-Cel-7rY" customClass="VibrantTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="20" y="1157" width="374" height="51"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Art-Cel-7rY" id="Art-Cnt-2mN">
|
||||
<rect key="frame" x="0.0" y="0.0" width="343.5" height="51"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Articles" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" id="Art-lb-4bR">
|
||||
<rect key="frame" x="20" y="0.0" width="315.5" height="51"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="Apr-lb-4bR" style="IBUITableViewCellStyleDefault" id="Apr-Cel-7rY" customClass="VibrantTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="20" y="1208" width="374" height="51"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
@@ -404,11 +235,6 @@
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
<connections>
|
||||
<outlet property="articleThemeDetailLabel" destination="DUf-DZ-3Nm" id="QHN-Le-zyw"/>
|
||||
<outlet property="enableJavaScriptSwitch" destination="Djo-HE-LWS" id="muL-I5-eDE"/>
|
||||
<outlet property="swipeToNextPreviousArticleSwitch" destination="Sw1-pe-Swt" id="Sw1-pe-Ot2"/>
|
||||
<outlet property="openLinksInNetNewsWire" destination="dhR-L2-PX3" id="z1b-pX-bwG"/>
|
||||
<outlet property="showFullscreenArticlesSwitch" destination="2Md-2E-7Z4" id="lEN-VP-wEO"/>
|
||||
</connections>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="GZq-IX-Qod" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
|
||||
@@ -20,16 +20,16 @@ final class SettingsViewController: UITableViewController {
|
||||
case notifications = 0
|
||||
case accounts = 1
|
||||
case feeds = 2
|
||||
case articles = 3
|
||||
case moreScreens = 4
|
||||
case moreScreens = 3
|
||||
}
|
||||
|
||||
private enum MoreScreensRow: Int {
|
||||
case sidebar = 0
|
||||
case timeline = 1
|
||||
case appearance = 2
|
||||
case troubleshooting = 3
|
||||
case help = 4
|
||||
case articles = 2
|
||||
case appearance = 3
|
||||
case troubleshooting = 4
|
||||
case help = 5
|
||||
}
|
||||
|
||||
private enum FeedsRow: Int {
|
||||
@@ -38,23 +38,10 @@ final class SettingsViewController: UITableViewController {
|
||||
case addNetNewsWireNewsFeed = 2
|
||||
}
|
||||
|
||||
private enum ArticlesRow: Int, CaseIterable {
|
||||
case theme = 0
|
||||
case openLinksInNetNewsWire = 1
|
||||
case enableJavaScript = 2
|
||||
case swipeToNextPreviousArticle = 3
|
||||
case enableFullScreenArticles = 4
|
||||
}
|
||||
|
||||
private weak var opmlAccount: Account?
|
||||
|
||||
@IBOutlet var articleThemeDetailLabel: UILabel!
|
||||
@IBOutlet var showFullscreenArticlesSwitch: UISwitch!
|
||||
@IBOutlet var openLinksInNetNewsWire: UISwitch!
|
||||
@IBOutlet var enableJavaScriptSwitch: UISwitch!
|
||||
@IBOutlet var swipeToNextPreviousArticleSwitch: UISwitch?
|
||||
|
||||
var scrollToArticlesSection = false
|
||||
/// Pushes the Timeline screen on appearing, so a user can turn off the Mark All as Read confirmation.
|
||||
var showTimelineSettings = false
|
||||
weak var presentingParentController: UIViewController?
|
||||
|
||||
override func viewDidLoad() {
|
||||
@@ -76,24 +63,6 @@ final class SettingsViewController: UITableViewController {
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
articleThemeDetailLabel.text = ArticleThemesManager.shared.currentTheme.name
|
||||
|
||||
swipeToNextPreviousArticleSwitch?.isOn = AppDefaults.articleSwipeNavigationEnabled
|
||||
|
||||
if AppDefaults.articleFullscreenAvailable {
|
||||
showFullscreenArticlesSwitch.isOn = true
|
||||
} else {
|
||||
showFullscreenArticlesSwitch.isOn = false
|
||||
}
|
||||
|
||||
if AppDefaults.isArticleContentJavascriptEnabled {
|
||||
enableJavaScriptSwitch.isOn = true
|
||||
} else {
|
||||
enableJavaScriptSwitch.isOn = false
|
||||
}
|
||||
|
||||
openLinksInNetNewsWire.isOn = !AppDefaults.useSystemBrowser
|
||||
|
||||
let buildLabel = CopyableLabel(frame: CGRect(x: 32.0, y: 0.0, width: 0.0, height: 0.0))
|
||||
buildLabel.font = UIFont.systemFont(ofSize: 11.0)
|
||||
buildLabel.textColor = UIColor.gray
|
||||
@@ -103,18 +72,16 @@ final class SettingsViewController: UITableViewController {
|
||||
let wrapperView = UIView(frame: CGRect(x: 0, y: 0, width: tableView.bounds.width, height: buildLabel.frame.height + 10.0))
|
||||
wrapperView.addSubview(buildLabel)
|
||||
tableView.tableFooterView = wrapperView
|
||||
|
||||
}
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
self.tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
|
||||
|
||||
if scrollToArticlesSection {
|
||||
tableView.scrollToRow(at: IndexPath(row: 0, section: Section.articles.rawValue), at: .top, animated: true)
|
||||
scrollToArticlesSection = false
|
||||
if showTimelineSettings {
|
||||
showTimelineSettings = false
|
||||
navigationController?.pushViewController(TimelineSettingsViewController(), animated: true)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: UITableView
|
||||
@@ -130,9 +97,6 @@ final class SettingsViewController: UITableViewController {
|
||||
return defaultNumberOfRows - 1
|
||||
}
|
||||
return defaultNumberOfRows
|
||||
case .articles:
|
||||
// The Full Screen Articles row is iPhone-only.
|
||||
return traitCollection.userInterfaceIdiom == .phone ? ArticlesRow.allCases.count : ArticlesRow.allCases.count - 1
|
||||
default:
|
||||
return super.tableView(tableView, numberOfRowsInSection: section)
|
||||
}
|
||||
@@ -202,20 +166,14 @@ final class SettingsViewController: UITableViewController {
|
||||
default:
|
||||
break
|
||||
}
|
||||
case .articles:
|
||||
switch ArticlesRow(rawValue: indexPath.row) {
|
||||
case .theme:
|
||||
let articleThemes = UIStoryboard.settings.instantiateController(ofType: ArticleThemesTableViewController.self)
|
||||
self.navigationController?.pushViewController(articleThemes, animated: true)
|
||||
default:
|
||||
break
|
||||
}
|
||||
case .moreScreens:
|
||||
switch MoreScreensRow(rawValue: indexPath.row) {
|
||||
case .sidebar:
|
||||
self.navigationController?.pushViewController(SidebarSettingsViewController(), animated: true)
|
||||
case .timeline:
|
||||
self.navigationController?.pushViewController(TimelineSettingsViewController(), animated: true)
|
||||
case .articles:
|
||||
self.navigationController?.pushViewController(ArticlesSettingsViewController(), animated: true)
|
||||
case .appearance:
|
||||
self.navigationController?.pushViewController(AppearanceSettingsViewController(), animated: true)
|
||||
case .troubleshooting:
|
||||
@@ -258,30 +216,6 @@ final class SettingsViewController: UITableViewController {
|
||||
dismiss(animated: true)
|
||||
}
|
||||
|
||||
@IBAction func switchFullscreenArticles(_ sender: Any) {
|
||||
if showFullscreenArticlesSwitch.isOn {
|
||||
AppDefaults.articleFullscreenAvailable = true
|
||||
} else {
|
||||
AppDefaults.articleFullscreenAvailable = false
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func switchBrowserPreference(_ sender: Any) {
|
||||
if openLinksInNetNewsWire.isOn {
|
||||
AppDefaults.useSystemBrowser = false
|
||||
} else {
|
||||
AppDefaults.useSystemBrowser = true
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func switchSwipeToNextPreviousArticle(_ sender: UISwitch) {
|
||||
AppDefaults.articleSwipeNavigationEnabled = sender.isOn
|
||||
}
|
||||
|
||||
@IBAction func switchJavaScriptPreference(_ sender: Any) {
|
||||
AppDefaults.isArticleContentJavascriptEnabled = enableJavaScriptSwitch.isOn
|
||||
}
|
||||
|
||||
// MARK: - Notifications
|
||||
|
||||
@objc func contentSizeCategoryDidChange() {
|
||||
|
||||
Reference in new issue
Block a user