diff --git a/Shared/Localizable.xcstrings b/Shared/Localizable.xcstrings
index 68597235e..2e3348a5c 100644
--- a/Shared/Localizable.xcstrings
+++ b/Shared/Localizable.xcstrings
@@ -368,6 +368,9 @@
"Completed" : {
"comment" : "Completed"
},
+ "Confirm Mark All as Read" : {
+ "comment" : "Confirm Mark All as Read"
+ },
"Continue" : {
"localizations" : {
"es" : {
@@ -725,6 +728,9 @@
"Grayscale Feed Icons" : {
"comment" : "Grayscale Feed Icons"
},
+ "Group by Feed" : {
+ "comment" : "Group by Feed"
+ },
"Help" : {
"comment" : "Help"
},
@@ -822,6 +828,9 @@
"Last Response" : {
"comment" : "Last HTTP Response"
},
+ "Layout" : {
+ "comment" : "Layout"
+ },
"Light" : {
"comment" : "Light"
},
@@ -1136,6 +1145,9 @@
"Refresh Scan" : {
"comment" : "Refresh scan button"
},
+ "Refresh to Clear Read Articles" : {
+ "comment" : "Refresh to Clear Read Articles"
+ },
"Release Notes" : {
"comment" : "Release Notes"
},
@@ -1281,6 +1293,9 @@
"Show notifications for new articles" : {
"comment" : "Show notifications for new articles"
},
+ "Show Previews in Context Menus" : {
+ "comment" : "Show Previews in Context Menus"
+ },
"Show Read Articles" : {
"comment" : "Command"
},
@@ -1365,6 +1380,9 @@
"Smart Feeds" : {
"comment" : "Smart Feeds group title"
},
+ "Sort Oldest to Newest" : {
+ "comment" : "Sort Oldest to Newest"
+ },
"Star" : {
"comment" : "Star"
},
@@ -1495,9 +1513,6 @@
"Timeline" : {
"comment" : "Timeline"
},
- "Timeline Layout" : {
- "comment" : "Timeline Layout"
- },
"Timeline Separator" : {
"comment" : "Toolbar item"
},
diff --git a/iOS/Settings/Settings.storyboard b/iOS/Settings/Settings.storyboard
index bedaa4d91..3f8a6bc2e 100644
--- a/iOS/Settings/Settings.storyboard
+++ b/iOS/Settings/Settings.storyboard
@@ -115,198 +115,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -512,6 +320,23 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -580,45 +405,16 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/iOS/Settings/SettingsViewController.swift b/iOS/Settings/SettingsViewController.swift
index f0aa3917a..230832a3a 100644
--- a/iOS/Settings/SettingsViewController.swift
+++ b/iOS/Settings/SettingsViewController.swift
@@ -20,16 +20,16 @@ final class SettingsViewController: UITableViewController {
case notifications = 0
case accounts = 1
case feeds = 2
- case timeline = 3
- case articles = 4
- case moreScreens = 5
+ case articles = 3
+ case moreScreens = 4
}
private enum MoreScreensRow: Int {
case sidebar = 0
- case appearance = 1
- case troubleshooting = 2
- case help = 3
+ case timeline = 1
+ case appearance = 2
+ case troubleshooting = 3
+ case help = 4
}
private enum FeedsRow: Int {
@@ -38,15 +38,6 @@ final class SettingsViewController: UITableViewController {
case addNetNewsWireNewsFeed = 2
}
- private enum TimelineRow: Int {
- case sortOrder = 0
- case groupByFeed = 1
- case refreshClearsReadArticles = 2
- case confirmMarkAllAsRead = 3
- case showPreviewInTimelineContextMenu = 4
- case timelineLayout = 5
- }
-
private enum ArticlesRow: Int, CaseIterable {
case theme = 0
case openLinksInNetNewsWire = 1
@@ -57,12 +48,7 @@ final class SettingsViewController: UITableViewController {
private weak var opmlAccount: Account?
- @IBOutlet var timelineSortOrderSwitch: UISwitch!
- @IBOutlet var groupByFeedSwitch: UISwitch!
- @IBOutlet var refreshClearsReadArticlesSwitch: UISwitch!
@IBOutlet var articleThemeDetailLabel: UILabel!
- @IBOutlet var confirmMarkAllAsReadSwitch: UISwitch!
- @IBOutlet var showPreviewInTimelineContextMenuSwitch: UISwitch?
@IBOutlet var showFullscreenArticlesSwitch: UISwitch!
@IBOutlet var openLinksInNetNewsWire: UISwitch!
@IBOutlet var enableJavaScriptSwitch: UISwitch!
@@ -90,33 +76,8 @@ final class SettingsViewController: UITableViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
- if AppDefaults.timelineSortDirection == .orderedAscending {
- timelineSortOrderSwitch.isOn = true
- } else {
- timelineSortOrderSwitch.isOn = false
- }
-
- if AppDefaults.timelineGroupByFeed {
- groupByFeedSwitch.isOn = true
- } else {
- groupByFeedSwitch.isOn = false
- }
-
- if AppDefaults.refreshClearsReadArticles {
- refreshClearsReadArticlesSwitch.isOn = true
- } else {
- refreshClearsReadArticlesSwitch.isOn = false
- }
-
articleThemeDetailLabel.text = ArticleThemesManager.shared.currentTheme.name
- if AppDefaults.confirmMarkAllAsRead {
- confirmMarkAllAsReadSwitch.isOn = true
- } else {
- confirmMarkAllAsReadSwitch.isOn = false
- }
-
- showPreviewInTimelineContextMenuSwitch?.isOn = AppDefaults.showPreviewInTimelineContextMenu
swipeToNextPreviousArticleSwitch?.isOn = AppDefaults.articleSwipeNavigationEnabled
if AppDefaults.articleFullscreenAvailable {
@@ -241,14 +202,6 @@ final class SettingsViewController: UITableViewController {
default:
break
}
- case .timeline:
- switch TimelineRow(rawValue: indexPath.row) {
- case .timelineLayout:
- let timeline = UIStoryboard.settings.instantiateController(ofType: TimelineCustomizerCollectionViewController.self)
- self.navigationController?.pushViewController(timeline, animated: true)
- default:
- break
- }
case .articles:
switch ArticlesRow(rawValue: indexPath.row) {
case .theme:
@@ -261,6 +214,8 @@ final class SettingsViewController: UITableViewController {
switch MoreScreensRow(rawValue: indexPath.row) {
case .sidebar:
self.navigationController?.pushViewController(SidebarSettingsViewController(), animated: true)
+ case .timeline:
+ self.navigationController?.pushViewController(TimelineSettingsViewController(), animated: true)
case .appearance:
self.navigationController?.pushViewController(AppearanceSettingsViewController(), animated: true)
case .troubleshooting:
@@ -303,42 +258,6 @@ final class SettingsViewController: UITableViewController {
dismiss(animated: true)
}
- @IBAction func switchTimelineOrder(_ sender: Any) {
- if timelineSortOrderSwitch.isOn {
- AppDefaults.timelineSortDirection = .orderedAscending
- } else {
- AppDefaults.timelineSortDirection = .orderedDescending
- }
- }
-
- @IBAction func switchGroupByFeed(_ sender: Any) {
- if groupByFeedSwitch.isOn {
- AppDefaults.timelineGroupByFeed = true
- } else {
- AppDefaults.timelineGroupByFeed = false
- }
- }
-
- @IBAction func switchClearsReadArticles(_ sender: Any) {
- if refreshClearsReadArticlesSwitch.isOn {
- AppDefaults.refreshClearsReadArticles = true
- } else {
- AppDefaults.refreshClearsReadArticles = false
- }
- }
-
- @IBAction func switchConfirmMarkAllAsRead(_ sender: Any) {
- if confirmMarkAllAsReadSwitch.isOn {
- AppDefaults.confirmMarkAllAsRead = true
- } else {
- AppDefaults.confirmMarkAllAsRead = false
- }
- }
-
- @IBAction func switchShowPreviewInTimelineContextMenu(_ sender: UISwitch) {
- AppDefaults.showPreviewInTimelineContextMenu = sender.isOn
- }
-
@IBAction func switchFullscreenArticles(_ sender: Any) {
if showFullscreenArticlesSwitch.isOn {
AppDefaults.articleFullscreenAvailable = true
diff --git a/iOS/Settings/TimelineCustomizerCollectionViewController.swift b/iOS/Settings/TimelineSettingsViewController.swift
similarity index 78%
rename from iOS/Settings/TimelineCustomizerCollectionViewController.swift
rename to iOS/Settings/TimelineSettingsViewController.swift
index 313480e11..26fe3fd78 100644
--- a/iOS/Settings/TimelineCustomizerCollectionViewController.swift
+++ b/iOS/Settings/TimelineSettingsViewController.swift
@@ -1,5 +1,5 @@
//
-// TimelineCustomizerCollectionViewController.swift
+// TimelineSettingsViewController.swift
// NetNewsWire-iOS
//
// Created by Stuart Breckenridge on 27/01/2026.
@@ -10,10 +10,11 @@ import UIKit
import Articles
import Images
-class TimelineCustomizerCollectionViewController: UICollectionViewController {
+final class TimelineSettingsViewController: UICollectionViewController {
private enum Section: Int, CaseIterable {
- case options
+ case general
+ case layout
case preview
case previewWithThumbnail
case previewWithFeedIcon
@@ -30,8 +31,16 @@ class TimelineCustomizerCollectionViewController: UICollectionViewController {
}
}
+ private enum GeneralRow: Int, CaseIterable {
+ case sortOrder
+ case groupByFeed
+ case refreshClearsReadArticles
+ case confirmMarkAllAsRead
+ case showPreviewInContextMenu
+ }
+
/// Same order as the Mac Timeline settings.
- private enum OptionsRow: Int, CaseIterable {
+ private enum LayoutRow: Int, CaseIterable {
case feedIcons
case feedIconSize
case thumbnails
@@ -73,13 +82,26 @@ class TimelineCustomizerCollectionViewController: UICollectionViewController {
}
// Created up front, since UIKit disallows creating a registration in cellForItemAt.
- private let optionsCellRegistration = UICollectionView.CellRegistration { cell, _, optionsRow in
- TimelineCustomizerCollectionViewController.configureOptionsCell(cell, optionsRow: optionsRow)
+ private let generalCellRegistration = UICollectionView.CellRegistration { cell, _, generalRow in
+ TimelineSettingsViewController.configureGeneralCell(cell, generalRow: generalRow)
+ }
+
+ private let layoutCellRegistration = UICollectionView.CellRegistration { cell, _, layoutRow in
+ TimelineSettingsViewController.configureLayoutCell(cell, layoutRow: layoutRow)
+ }
+
+ init() {
+ // The layout is replaced in configureCollectionView.
+ super.init(collectionViewLayout: UICollectionViewFlowLayout())
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
- title = NSLocalizedString("Timeline Layout", comment: "Timeline Layout")
+ title = NSLocalizedString("Timeline", comment: "Timeline")
NotificationCenter.default.addObserver(self, selector: #selector(handleTimelineFeedIconsDisplayDidChange(_:)), name: .timelineFeedIconsDisplayDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(handleTimelineIconSizeDidChange(_:)), name: .timelineIconSizeDidChange, object: nil)
@@ -93,6 +115,8 @@ class TimelineCustomizerCollectionViewController: UICollectionViewController {
}
private func configureCollectionView() {
+ collectionView.backgroundColor = .systemBackground
+
collectionView.register(
TimelineHeaderView.self,
forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader,
@@ -104,8 +128,9 @@ class TimelineCustomizerCollectionViewController: UICollectionViewController {
let layout = UICollectionViewCompositionalLayout { sectionIndex, layoutEnvironment in
var config = UICollectionLayoutListConfiguration(appearance: .insetGrouped)
config.showsSeparators = false
- let isHidden = Self.isHidden(Section(rawValue: sectionIndex))
- config.headerMode = isHidden ? .none : .supplementary
+ let sectionID = Section(rawValue: sectionIndex)
+ let isHidden = Self.isHidden(sectionID)
+ config.headerMode = (isHidden || sectionID == .general) ? .none : .supplementary
let section = NSCollectionLayoutSection.list(using: config, layoutEnvironment: layoutEnvironment)
if isHidden {
// An empty section still has insets, which would leave a gap.
@@ -128,8 +153,11 @@ class TimelineCustomizerCollectionViewController: UICollectionViewController {
if Self.isHidden(section) {
return 0
}
- if section == .options {
- return OptionsRow.allCases.count
+ if section == .general {
+ return GeneralRow.allCases.count
+ }
+ if section == .layout {
+ return LayoutRow.allCases.count
}
return 1
}
@@ -137,9 +165,12 @@ class TimelineCustomizerCollectionViewController: UICollectionViewController {
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
switch Section(rawValue: indexPath.section) {
- case .options:
- let optionsRow = OptionsRow(rawValue: indexPath.item) ?? .feedIcons
- return collectionView.dequeueConfiguredReusableCell(using: optionsCellRegistration, for: indexPath, item: optionsRow)
+ case .general:
+ let generalRow = GeneralRow(rawValue: indexPath.item) ?? .sortOrder
+ return collectionView.dequeueConfiguredReusableCell(using: generalCellRegistration, for: indexPath, item: generalRow)
+ case .layout:
+ let layoutRow = LayoutRow(rawValue: indexPath.item) ?? .feedIcons
+ return collectionView.dequeueConfiguredReusableCell(using: layoutCellRegistration, for: indexPath, item: layoutRow)
case .preview, .previewWithThumbnail, .previewWithFeedIcon, .previewWithFeedIconAndThumbnail:
return previewCell(section: Section(rawValue: indexPath.section) ?? .preview, indexPath: indexPath)
case .none:
@@ -165,7 +196,9 @@ class TimelineCustomizerCollectionViewController: UICollectionViewController {
switch Section(rawValue: indexPath.section) {
case .preview, .previewWithThumbnail, .previewWithFeedIcon, .previewWithFeedIconAndThumbnail:
header.label.text = Self.previewHeaderTitle(Section(rawValue: indexPath.section) ?? .preview)
- case .options, .none:
+ case .layout:
+ header.label.text = NSLocalizedString("Layout", comment: "Layout")
+ case .general, .none:
header.label.text = nil
}
return header
@@ -183,37 +216,37 @@ class TimelineCustomizerCollectionViewController: UICollectionViewController {
// MARK: Notifications
@objc func handleTimelineFeedIconsDisplayDidChange(_ notification: Notification) {
- reloadOptionsRowsAndPreviews()
+ reloadLayoutRowsAndPreviews()
}
@objc func handleTimelineIconSizeDidChange(_ notification: Notification) {
- reloadOptionsRowsAndPreviews()
+ reloadLayoutRowsAndPreviews()
}
@objc func handleTimelineThumbnailsDisplayDidChange(_ notification: Notification) {
- reloadOptionsRowsAndPreviews()
+ reloadLayoutRowsAndPreviews()
}
@objc func handleTimelineNumberOfLinesDidChange(_ notification: Notification) {
- reloadOptionsRowsAndPreviews()
+ reloadLayoutRowsAndPreviews()
}
@objc func handleTimelineShowFullTitlesDidChange(_ notification: Notification) {
- reloadOptionsRowsAndPreviews()
+ reloadLayoutRowsAndPreviews()
}
@objc func handleTimelineFadeReadArticlesDidChange(_ notification: Notification) {
- reloadOptionsRowsAndPreviews()
+ reloadLayoutRowsAndPreviews()
}
@objc func handleTimelineFeedNameAndDateAboveTitleDidChange(_ notification: Notification) {
- reloadOptionsRowsAndPreviews()
+ reloadLayoutRowsAndPreviews()
}
}
// MARK: - Private
-private extension TimelineCustomizerCollectionViewController {
+private extension TimelineSettingsViewController {
/// Hides a preview that the Feed Icons and Thumbnail Size settings mean would never be seen.
/// Thumbnails don’t hide previews without one, since not every article has a thumbnail.
@@ -272,11 +305,44 @@ private extension TimelineCustomizerCollectionViewController {
return cell
}
- static private func configureOptionsCell(_ cell: TimelineCustomizerOptionsCell, optionsRow: OptionsRow) {
+ static private func configureGeneralCell(_ cell: TimelineSettingsOptionsCell, generalRow: GeneralRow) {
+ var content = UIListContentConfiguration.cell()
+ switch generalRow {
+ case .sortOrder:
+ content.text = NSLocalizedString("Sort Oldest to Newest", comment: "Sort Oldest to Newest")
+ configureSwitch(cell, isOn: AppDefaults.timelineSortDirection == .orderedAscending) { isOn in
+ AppDefaults.timelineSortDirection = isOn ? .orderedAscending : .orderedDescending
+ }
+ case .groupByFeed:
+ content.text = NSLocalizedString("Group by Feed", comment: "Group by Feed")
+ configureSwitch(cell, isOn: AppDefaults.timelineGroupByFeed) { isOn in
+ AppDefaults.timelineGroupByFeed = isOn
+ }
+ case .refreshClearsReadArticles:
+ content.text = NSLocalizedString("Refresh to Clear Read Articles", comment: "Refresh to Clear Read Articles")
+ configureSwitch(cell, isOn: AppDefaults.refreshClearsReadArticles) { isOn in
+ AppDefaults.refreshClearsReadArticles = isOn
+ }
+ case .confirmMarkAllAsRead:
+ content.text = NSLocalizedString("Confirm Mark All as Read", comment: "Confirm Mark All as Read")
+ configureSwitch(cell, isOn: AppDefaults.confirmMarkAllAsRead) { isOn in
+ AppDefaults.confirmMarkAllAsRead = isOn
+ }
+ case .showPreviewInContextMenu:
+ content.text = NSLocalizedString("Show Previews in Context Menus", comment: "Show Previews in Context Menus")
+ configureSwitch(cell, isOn: AppDefaults.showPreviewInTimelineContextMenu) { isOn in
+ AppDefaults.showPreviewInTimelineContextMenu = isOn
+ }
+ }
+ cell.contentConfiguration = content
+ configureBackground(cell)
+ }
+
+ static private func configureLayoutCell(_ cell: TimelineSettingsOptionsCell, layoutRow: LayoutRow) {
// The pop-up menu accessory shows only a chevron, so the value cell’s secondary text shows the current choice.
var content = UIListContentConfiguration.valueCell()
cell.isUserInteractionEnabled = true
- switch optionsRow {
+ switch layoutRow {
case .feedIcons:
content.text = NSLocalizedString("Feed Icons", comment: "Feed Icons")
content.secondaryText = AppDefaults.timelineFeedIconsDisplay.description
@@ -317,7 +383,10 @@ private extension TimelineCustomizerCollectionViewController {
}
}
cell.contentConfiguration = content
+ configureBackground(cell)
+ }
+ static func configureBackground(_ cell: TimelineSettingsOptionsCell) {
cell.configurationUpdateHandler = { cell, state in
var backgroundConfig = UIBackgroundConfiguration.listCell().updated(for: state)
backgroundConfig.backgroundColor = cell.traitCollection.userInterfaceStyle == .dark ? .secondarySystemBackground : .white
@@ -326,7 +395,7 @@ private extension TimelineCustomizerCollectionViewController {
}
}
- static func configureSwitch(_ cell: TimelineCustomizerOptionsCell, isOn: Bool, switchDidChange: @escaping (Bool) -> Void) {
+ static func configureSwitch(_ cell: TimelineSettingsOptionsCell, isOn: Bool, switchDidChange: @escaping (Bool) -> Void) {
cell.switchControl.isOn = isOn
cell.switchDidChange = switchDidChange
cell.accessories = [.customView(configuration: .init(customView: cell.switchControl, placement: .trailing()))]
@@ -403,19 +472,19 @@ private extension TimelineCustomizerCollectionViewController {
}
/// One batch, since reconfiguring alone fails validation when a preview section’s item count has changed.
- func reloadOptionsRowsAndPreviews() {
+ func reloadLayoutRowsAndPreviews() {
collectionView.performBatchUpdates {
- let indexPaths = OptionsRow.allCases.map { IndexPath(item: $0.rawValue, section: Section.options.rawValue) }
+ let indexPaths = LayoutRow.allCases.map { IndexPath(item: $0.rawValue, section: Section.layout.rawValue) }
collectionView.reconfigureItems(at: indexPaths)
reloadPreviews()
}
}
}
-// MARK: - TimelineCustomizerOptionsCell
+// MARK: - TimelineSettingsOptionsCell
/// Keeps one switch for the cell’s lifetime, since a new switch on every reconfigure animates into place.
-final class TimelineCustomizerOptionsCell: UICollectionViewListCell {
+final class TimelineSettingsOptionsCell: UICollectionViewListCell {
var switchDidChange: ((Bool) -> Void)?