2019-07-05 20:06:31 -07:00
|
|
|
//
|
|
|
|
// SmartFeedDelegate.swift
|
|
|
|
// NetNewsWire
|
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 6/25/19.
|
|
|
|
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
import Account
|
|
|
|
import Articles
|
2019-12-16 22:45:59 -08:00
|
|
|
import ArticlesDatabase
|
2024-03-10 18:17:04 -07:00
|
|
|
import Database
|
2024-03-20 20:49:15 -07:00
|
|
|
import Core
|
2019-07-05 20:06:31 -07:00
|
|
|
|
2024-02-25 21:17:00 -08:00
|
|
|
protocol SmartFeedDelegate: SidebarItemIdentifiable, DisplayNameProvider, ArticleFetcher, SmallIconProvider {
|
2024-03-18 21:08:37 -07:00
|
|
|
|
2024-03-25 12:48:02 -07:00
|
|
|
@MainActor var fetchType: FetchType { get }
|
2024-03-18 21:08:37 -07:00
|
|
|
|
2024-03-25 12:48:02 -07:00
|
|
|
@MainActor func unreadCount(account: Account) async -> Int
|
2019-07-05 20:06:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
extension SmartFeedDelegate {
|
|
|
|
|
2024-03-18 21:08:37 -07:00
|
|
|
@MainActor func fetchArticles() async throws -> Set<Article> {
|
|
|
|
|
|
|
|
try await AccountManager.shared.fetchArticles(fetchType: fetchType)
|
2019-07-05 20:06:31 -07:00
|
|
|
}
|
|
|
|
|
2024-03-18 21:08:37 -07:00
|
|
|
@MainActor func fetchUnreadArticles() async throws -> Set<Article> {
|
|
|
|
|
|
|
|
try await AccountManager.shared.fetchArticles(fetchType: fetchType)
|
2019-07-05 20:06:31 -07:00
|
|
|
}
|
|
|
|
}
|