mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Do not mark articles as read on scroll when they were manually toggled
This commit is contained in:
@@ -527,7 +527,10 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
|
||||
return
|
||||
}
|
||||
|
||||
guard let unreadArticlesScrolledAway = coordinator.articles.articlesAbove(article: firstVisibleArticle).unreadArticles() else { return }
|
||||
guard let unreadArticlesScrolledAway = coordinator.articles
|
||||
.articlesAbove(article: firstVisibleArticle)
|
||||
.filter({ !coordinator.articlesWithManuallyChangedReadStatus.contains($0) })
|
||||
.unreadArticles() else { return }
|
||||
|
||||
coordinator.markAllAsRead(unreadArticlesScrolledAway)
|
||||
|
||||
|
||||
@@ -182,6 +182,8 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
||||
private(set) var showFeedNames = ShowFeedName.none
|
||||
private(set) var showIcons = false
|
||||
|
||||
var articlesWithManuallyChangedReadStatus: Set<Article> = Set()
|
||||
|
||||
var prevFeedIndexPath: IndexPath? {
|
||||
guard let indexPath = currentFeedIndexPath else {
|
||||
return nil
|
||||
@@ -783,6 +785,8 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
||||
return
|
||||
}
|
||||
|
||||
articlesWithManuallyChangedReadStatus.removeAll()
|
||||
|
||||
currentFeedIndexPath = indexPath
|
||||
masterFeedViewController.updateFeedSelection(animations: animations)
|
||||
|
||||
@@ -1073,24 +1077,28 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
||||
func markAsReadForCurrentArticle() {
|
||||
if let article = currentArticle {
|
||||
markArticlesWithUndo([article], statusKey: .read, flag: true)
|
||||
articlesWithManuallyChangedReadStatus.insert(article)
|
||||
}
|
||||
}
|
||||
|
||||
func markAsUnreadForCurrentArticle() {
|
||||
if let article = currentArticle {
|
||||
markArticlesWithUndo([article], statusKey: .read, flag: false)
|
||||
articlesWithManuallyChangedReadStatus.insert(article)
|
||||
}
|
||||
}
|
||||
|
||||
func toggleReadForCurrentArticle() {
|
||||
if let article = currentArticle {
|
||||
toggleRead(article)
|
||||
articlesWithManuallyChangedReadStatus.insert(article)
|
||||
}
|
||||
}
|
||||
|
||||
func toggleRead(_ article: Article) {
|
||||
guard !article.status.read || article.isAvailableToMarkUnread else { return }
|
||||
markArticlesWithUndo([article], statusKey: .read, flag: !article.status.read)
|
||||
articlesWithManuallyChangedReadStatus.insert(article)
|
||||
}
|
||||
|
||||
func toggleStarredForCurrentArticle() {
|
||||
|
||||
Reference in New Issue
Block a user