Add a SmartFeedType to smart feeds so the sidebar can tell them apart.
This commit is contained in:
parent
62258683c8
commit
cf1b3843ee
|
@ -455,7 +455,7 @@ extension MainWindowController: NSSearchFieldDelegate {
|
|||
return
|
||||
}
|
||||
lastSentSearchString = searchString
|
||||
let smartFeed = SmartFeed(delegate: SearchFeedDelegate(searchString: searchString))
|
||||
let smartFeed = SmartFeed(delegate: SearchFeedDelegate(searchString: searchString), type: .search)
|
||||
timelineContainerViewController?.setRepresentedObjects([smartFeed], mode: .search)
|
||||
searchSmartFeed = smartFeed
|
||||
}
|
||||
|
|
|
@ -11,12 +11,22 @@ import RSCore
|
|||
import Articles
|
||||
import Account
|
||||
|
||||
enum SmartFeedType {
|
||||
case today
|
||||
case allUnread
|
||||
case starred
|
||||
case search
|
||||
case custom
|
||||
}
|
||||
|
||||
final class SmartFeed: PseudoFeed {
|
||||
|
||||
var nameForDisplay: String {
|
||||
return delegate.nameForDisplay
|
||||
}
|
||||
|
||||
let type: SmartFeedType
|
||||
|
||||
var unreadCount = 0 {
|
||||
didSet {
|
||||
if unreadCount != oldValue {
|
||||
|
@ -34,8 +44,9 @@ final class SmartFeed: PseudoFeed {
|
|||
private let delegate: SmartFeedDelegate
|
||||
private var unreadCounts = [String: Int]()
|
||||
|
||||
init(delegate: SmartFeedDelegate) {
|
||||
init(delegate: SmartFeedDelegate, type: SmartFeedType) {
|
||||
self.delegate = delegate
|
||||
self.type = type
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
|
||||
queueFetchUnreadCounts() // Fetch unread count at startup
|
||||
}
|
||||
|
|
|
@ -15,9 +15,9 @@ final class SmartFeedsController: DisplayNameProvider {
|
|||
let nameForDisplay = NSLocalizedString("Smart Feeds", comment: "Smart Feeds group title")
|
||||
|
||||
var smartFeeds = [AnyObject]()
|
||||
let todayFeed = SmartFeed(delegate: TodayFeedDelegate())
|
||||
let todayFeed = SmartFeed(delegate: TodayFeedDelegate(), type: .today)
|
||||
let unreadFeed = UnreadFeed()
|
||||
let starredFeed = SmartFeed(delegate: StarredFeedDelegate())
|
||||
let starredFeed = SmartFeed(delegate: StarredFeedDelegate(), type: .starred)
|
||||
|
||||
private init() {
|
||||
|
||||
|
|
Loading…
Reference in New Issue