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