mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-05 22:37:45 +01:00
Implement mark all as read in feed context menu for timeline
This commit is contained in:
parent
644e9da1c0
commit
2a4a13ed13
@ -81,6 +81,18 @@ struct TimelineContextMenu: View {
|
||||
}
|
||||
}
|
||||
|
||||
if let feed = timelineItem.article.webFeed, timelineModel.canMarkAllAsReadInFeed(feed) {
|
||||
Divider()
|
||||
Button {
|
||||
timelineModel.markAllAsReadInFeed(feed)
|
||||
} label: {
|
||||
Text("Mark All as Read in “\(feed.nameForDisplay)”")
|
||||
#if os(iOS)
|
||||
AppAssets.markAllAsReadImage
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if timelineModel.canOpenIndicatedArticleInBrowser(timelineItem.article) {
|
||||
Divider()
|
||||
Button {
|
||||
|
@ -189,6 +189,19 @@ class TimelineModel: ObservableObject, UndoableCommandRunner {
|
||||
markArticlesWithUndo(articlesToMark, statusKey: .read, flag: true)
|
||||
}
|
||||
|
||||
func canMarkAllAsReadInFeed(_ feed: Feed) -> Bool {
|
||||
guard let articlesSet = try? feed.fetchArticles() else {
|
||||
return false
|
||||
}
|
||||
return Array(articlesSet).canMarkAllAsRead()
|
||||
}
|
||||
|
||||
func markAllAsReadInFeed(_ feed: Feed) {
|
||||
guard let articlesSet = try? feed.fetchArticles() else { return }
|
||||
let articlesToMark = Array(articlesSet)
|
||||
markArticlesWithUndo(articlesToMark, statusKey: .read, flag: true)
|
||||
}
|
||||
|
||||
func toggleStarredStatusForSelectedArticles() {
|
||||
guard !selectedArticles.isEmpty else {
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user