diff --git a/Shared/Localizable.xcstrings b/Shared/Localizable.xcstrings index 57da49e86..9744db770 100644 --- a/Shared/Localizable.xcstrings +++ b/Shared/Localizable.xcstrings @@ -891,6 +891,9 @@ "Manually" : { "comment" : "Manually" }, + "Manually only" : { + "comment" : "Mark as Read setting: articles are marked read only by the user" + }, "Mark Above as Read" : { "comment" : "Command" }, @@ -1780,6 +1783,12 @@ "Web accounts sync your feeds across all your devices." : { "comment" : "Web Account" }, + "When selected" : { + "comment" : "Mark as Read setting: articles are marked read when selected" + }, + "When selected or scrolled past" : { + "comment" : "Mark as Read setting: articles are marked read when selected or when scrolled off the top of the timeline" + }, "You can enable NetNewsWire notifications in System Preferences." : { "comment" : "Notifications are not enabled." }, diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 026359a0c..9bcce80e5 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -1252,7 +1252,9 @@ struct SidebarItemNode: Hashable, Sendable { mainTimelineViewController?.didPushArticleViewController = true // Mark article as read before navigating to it, so the read status does not flash unread/read on display - markArticles(Set([article!]), statusKey: .read, flag: true) + if AppDefaults.markReadBehavior != .manual { + markArticles(Set([article!]), statusKey: .read, flag: true) + } mainTimelineViewController?.updateArticleSelection(animations: animations) articleViewController?.article = article diff --git a/iOS/Settings/GeneralSettingsView.swift b/iOS/Settings/GeneralSettingsView.swift index 6b65dc0bf..40fe82ae1 100644 --- a/iOS/Settings/GeneralSettingsView.swift +++ b/iOS/Settings/GeneralSettingsView.swift @@ -26,6 +26,12 @@ struct GeneralSettingsView: View { } } .pickerStyle(.menu) + Picker(String(localized: "Mark as Read", comment: "Command"), selection: Binding(get: { model.markReadBehavior }, set: { AppDefaults.markReadBehavior = $0 })) { + ForEach(MarkReadBehavior.allCases, id: \.self) { markReadBehavior in + Text(String(describing: markReadBehavior)) + } + } + .pickerStyle(.menu) Toggle(String(localized: "Grayscale Feed Icons", comment: "Grayscale Feed Icons"), isOn: Binding(get: { model.grayscaleIcons }, set: { AppDefaults.grayscaleIcons = $0 })) } .settingsAccentTint() @@ -38,11 +44,13 @@ struct GeneralSettingsView: View { private(set) var colorPalette = AppDefaults.userInterfaceColorPalette private(set) var unreadCountDisplay = AppDefaults.unreadCountDisplay + private(set) var markReadBehavior = AppDefaults.markReadBehavior private(set) var grayscaleIcons = AppDefaults.grayscaleIcons init() { NotificationCenter.default.addObserver(self, selector: #selector(handleUserInterfaceColorPaletteDidUpdate(_:)), name: .userInterfaceColorPaletteDidUpdate, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(handleUnreadCountDisplaySettingDidChange(_:)), name: .unreadCountDisplaySettingDidChange, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(handleMarkReadBehaviorDidChange(_:)), name: .markReadBehaviorDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(handleGrayscaleIconsDidChange(_:)), name: .grayscaleIconsDidChange, object: nil) } @@ -54,6 +62,10 @@ struct GeneralSettingsView: View { unreadCountDisplay = AppDefaults.unreadCountDisplay } + @objc func handleMarkReadBehaviorDidChange(_ notification: Notification) { + markReadBehavior = AppDefaults.markReadBehavior + } + @objc func handleGrayscaleIconsDidChange(_ notification: Notification) { grayscaleIcons = AppDefaults.grayscaleIcons } diff --git a/iOS/Settings/MarkReadBehavior+Description.swift b/iOS/Settings/MarkReadBehavior+Description.swift new file mode 100644 index 000000000..7cb505ca8 --- /dev/null +++ b/iOS/Settings/MarkReadBehavior+Description.swift @@ -0,0 +1,22 @@ +// +// MarkReadBehavior+Description.swift +// NetNewsWire +// +// Created by Brent Simmons on 12/5/26. +// + +import Foundation + +extension MarkReadBehavior: CustomStringConvertible { + + var description: String { + switch self { + case .manual: + NSLocalizedString("Manually only", comment: "Mark as Read setting: articles are marked read only by the user") + case .selection: + NSLocalizedString("When selected", comment: "Mark as Read setting: articles are marked read when selected") + case .selectionAndScrolledPast: + NSLocalizedString("When selected or scrolled past", comment: "Mark as Read setting: articles are marked read when selected or when scrolled off the top of the timeline") + } + } +}