Adds Mark As Read on Scroll to SwiftUI views.

This commit is contained in:
Stuart Breckenridge
2023-03-14 12:28:14 +08:00
parent 60b6a47c48
commit 3ac8c7057e
3 changed files with 12 additions and 0 deletions

View File

@@ -273,6 +273,7 @@ final class AppDefaults: ObservableObject {
}
set {
AppDefaults.setBool(for: Key.markArticlesAsReadOnScroll, newValue)
AppDefaults.shared.objectWillChange.send()
}
}

View File

@@ -22,6 +22,7 @@ struct DisplayAndBehaviorsView: View {
Section(header: Text("Timeline", comment: "Display & Behaviours: Timeline section header")) {
SettingsViewRows.sortOldestToNewest($appDefaults.timelineSortDirectionBool)
SettingsViewRows.groupByFeed($appDefaults.timelineGroupByFeed)
SettingsViewRows.markAsReadOnScroll($appDefaults.markArticlesAsReadOnScroll)
SettingsViewRows.refreshToClearReadArticles($appDefaults.refreshClearsReadArticles)
SettingsViewRows.timelineLayout
}

View File

@@ -61,6 +61,16 @@ struct SettingsViewRows {
}
}
/// Toggle for determining if articles are marked as read when scrolling the timeline view.
/// - Parameter preference: `Binding<Bool>`
/// - Returns: `some View`
static func markAsReadOnScroll(_ preference: Binding<Bool>) -> some View {
Toggle(isOn: preference) {
Text("Mark As Read on Scroll", comment: "Mark As Read on Scroll")
}
}
/// This row, when tapped, will push the the Manage Extension screen
/// in to view.
static var manageExtensions: some View {