NetNewsWire/Shared/SmartFeeds/StarredFeedDelegate.swift

37 lines
935 B
Swift
Raw Normal View History

//
// StarredFeedDelegate.swift
2018-08-29 07:18:24 +02:00
// NetNewsWire
//
// Created by Brent Simmons on 11/19/17.
// Copyright © 2017 Ranchero Software. All rights reserved.
//
import Foundation
import Articles
import ArticlesDatabase
import Account
// Main thread only.
2024-03-25 20:48:02 +01:00
@MainActor struct StarredFeedDelegate: SmartFeedDelegate {
2024-02-26 06:34:22 +01:00
var sidebarItemID: SidebarItemIdentifier? {
return SidebarItemIdentifier.smartFeed(String(describing: StarredFeedDelegate.self))
}
let nameForDisplay = NSLocalizedString("Starred", comment: "Starred pseudo-feed title")
let fetchType: FetchType = .starred(nil)
var smallIcon: IconImage? {
return AppAssets.starredFeedImage
}
2024-03-25 02:49:39 +01:00
func unreadCount(account: Account) async -> Int {
(try? await account.unreadCountForStarredArticles()) ?? 0
}
func fetchUnreadCount(for account: Account, completion: @escaping SingleUnreadCountCompletionBlock) {
2019-12-15 02:01:34 +01:00
account.fetchUnreadCountForStarredArticles(completion)
}
}