Restore Mark All As Read in Feed context menu after making it performant
This commit is contained in:
parent
3b8db28f3d
commit
4bf4c6d6c2
|
@ -81,19 +81,17 @@ struct TimelineContextMenu: View {
|
|||
}
|
||||
}
|
||||
|
||||
// This thing isn't lazily initialized and gets called excessively even for things like selecting an article
|
||||
|
||||
// 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 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()
|
||||
|
|
|
@ -238,10 +238,7 @@ class TimelineModel: ObservableObject, UndoableCommandRunner {
|
|||
}
|
||||
|
||||
func canMarkAllAsReadInFeed(_ feed: Feed) -> Bool {
|
||||
guard let articlesSet = try? feed.fetchArticles() else {
|
||||
return false
|
||||
}
|
||||
return Array(articlesSet).canMarkAllAsRead()
|
||||
return feed.unreadCount > 0
|
||||
}
|
||||
|
||||
func markAllAsReadInFeed(_ feed: Feed) {
|
||||
|
|
Loading…
Reference in New Issue