2017-12-16 20:16:32 +01:00
|
|
|
//
|
|
|
|
// SmartFeedsController.swift
|
2018-08-29 07:18:24 +02:00
|
|
|
// NetNewsWire
|
2017-12-16 20:16:32 +01:00
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 12/16/17.
|
|
|
|
// Copyright © 2017 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
import RSCore
|
2019-11-21 22:55:50 +01:00
|
|
|
import Account
|
2017-12-16 20:16:32 +01:00
|
|
|
|
2019-11-25 01:29:00 +01:00
|
|
|
final class SmartFeedsController: DisplayNameProvider, ContainerIdentifiable {
|
|
|
|
|
|
|
|
var containerID: ContainerIdentifier? {
|
|
|
|
return ContainerIdentifier.smartFeedController
|
|
|
|
}
|
2017-12-16 20:16:32 +01:00
|
|
|
|
|
|
|
public static let shared = SmartFeedsController()
|
|
|
|
let nameForDisplay = NSLocalizedString("Smart Feeds", comment: "Smart Feeds group title")
|
|
|
|
|
2024-11-02 05:34:08 +01:00
|
|
|
var smartFeeds = [SidebarItem]()
|
2017-12-16 20:16:32 +01:00
|
|
|
let todayFeed = SmartFeed(delegate: TodayFeedDelegate())
|
|
|
|
let unreadFeed = UnreadFeed()
|
|
|
|
let starredFeed = SmartFeed(delegate: StarredFeedDelegate())
|
|
|
|
|
|
|
|
private init() {
|
|
|
|
self.smartFeeds = [todayFeed, unreadFeed, starredFeed]
|
|
|
|
}
|
2019-11-14 22:06:32 +01:00
|
|
|
|
2024-11-02 05:34:08 +01:00
|
|
|
func find(by identifier: SidebarItemIdentifier) -> PseudoFeed? {
|
2019-11-14 22:06:32 +01:00
|
|
|
switch identifier {
|
2019-11-23 19:30:18 +01:00
|
|
|
case .smartFeed(let stringIdentifer):
|
|
|
|
switch stringIdentifer {
|
|
|
|
case String(describing: TodayFeedDelegate.self):
|
|
|
|
return todayFeed
|
|
|
|
case String(describing: UnreadFeed.self):
|
|
|
|
return unreadFeed
|
|
|
|
case String(describing: StarredFeedDelegate.self):
|
|
|
|
return starredFeed
|
|
|
|
default:
|
|
|
|
return nil
|
|
|
|
}
|
2019-11-14 22:06:32 +01:00
|
|
|
default:
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-16 20:16:32 +01:00
|
|
|
}
|