Add mark-read behavior enum and setting.

This commit is contained in:
Brent Simmons committed 2026-12-05 07:54:20 -08:00
1 parent 940b9e5f2e
commit 3acc1fb1eb
2 files changed
+34

No files matched your search

+12
View File
@@ -23,6 +23,7 @@ enum AppDefaults {
static let currentThemeName = "currentThemeName"
static let articleContentJavascriptEnabled = "articleContentJavascriptEnabled"
static let unreadCountDisplay = "unreadCountDisplay"
static let markReadBehavior = "markReadBehavior"
static let timelineThumbnailsDisplay = "timelineThumbnailsDisplay"
static let timelineFeedIconsDisplay = "timelineFeedIconsDisplay"
static let userInterfaceColorPalette = "userInterfaceColorPalette"
@@ -47,6 +48,7 @@ enum AppDefaults {
Key.timelineGroupByFeed: false,
Key.currentThemeName: defaultThemeName,
Key.articleContentJavascriptEnabled: true,
Key.markReadBehavior: MarkReadBehavior.selection.rawValue,
Key.timelineThumbnailsDisplay: TimelineThumbnailsDisplay.none.rawValue,
Key.timelineFeedIconsDisplay: TimelineFeedIconsDisplay.automatic.rawValue,
Key.userInterfaceColorPalette: UserInterfaceColorPalette.automatic.rawValue,
@@ -134,6 +136,16 @@ enum AppDefaults {
}
}
static var markReadBehavior: MarkReadBehavior {
get {
MarkReadBehavior(rawValue: UserDefaults.standard.integer(forKey: Key.markReadBehavior)) ?? .selection
}
set {
UserDefaults.standard.set(newValue.rawValue, forKey: Key.markReadBehavior)
NotificationCenter.default.post(name: .markReadBehaviorDidChange, object: nil)
}
}
static var timelineThumbnailsDisplay: TimelineThumbnailsDisplay {
get {
TimelineThumbnailsDisplay(rawValue: UserDefaults.standard.integer(forKey: Key.timelineThumbnailsDisplay)) ?? .none
+22
View File
@@ -0,0 +1,22 @@
//
// MarkReadBehavior.swift
// NetNewsWire
//
// Created by Brent Simmons on 12/5/26.
//
import Foundation
extension Notification.Name {
static let markReadBehaviorDidChange = Notification.Name("MarkReadBehaviorDidChangeNotification")
}
/// When articles are marked read without the user marking them.
enum MarkReadBehavior: Int, CaseIterable, Codable {
/// Only when the user marks them read.
case manual = 0
/// When selected.
case selection = 1
/// When selected, and when scrolled off the top of the timeline.
case selectionAndScrolledPast = 2
}