mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Rename Feed protocol to SidebarItem. Rename FeedIdentifier to SidebarItemIdentifier. Rename WebFeed to Feed.
This commit is contained in:
@@ -15,7 +15,7 @@ class WebFeedInspectorViewController: UITableViewController {
|
||||
|
||||
static let preferredContentSizeForFormSheetDisplay = CGSize(width: 460.0, height: 500.0)
|
||||
|
||||
var webFeed: WebFeed!
|
||||
var webFeed: Feed!
|
||||
@IBOutlet weak var nameTextField: UITextField!
|
||||
@IBOutlet weak var notifyAboutNewArticlesSwitch: UISwitch!
|
||||
@IBOutlet weak var alwaysShowReaderViewSwitch: UISwitch!
|
||||
|
||||
@@ -13,7 +13,7 @@ import Account
|
||||
extension MasterFeedViewController: UITableViewDragDelegate {
|
||||
|
||||
func tableView(_ tableView: UITableView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] {
|
||||
guard let node = coordinator.nodeFor(indexPath), let webFeed = node.representedObject as? WebFeed else {
|
||||
guard let node = coordinator.nodeFor(indexPath), let webFeed = node.representedObject as? Feed else {
|
||||
return [UIDragItem]()
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ extension MasterFeedViewController: UITableViewDropDelegate {
|
||||
return UITableViewDropProposal(operation: .forbidden)
|
||||
}
|
||||
|
||||
guard let destFeed = coordinator.nodeFor(destIndexPath)?.representedObject as? Feed,
|
||||
guard let destFeed = coordinator.nodeFor(destIndexPath)?.representedObject as? SidebarItem,
|
||||
let destAccount = destFeed.account,
|
||||
let destCell = tableView.cellForRow(at: destIndexPath) else {
|
||||
return UITableViewDropProposal(operation: .forbidden)
|
||||
@@ -31,7 +31,7 @@ extension MasterFeedViewController: UITableViewDropDelegate {
|
||||
// Validate account specific behaviors...
|
||||
if destAccount.behaviors.contains(.disallowFeedInMultipleFolders),
|
||||
let sourceNode = session.localDragSession?.items.first?.localObject as? Node,
|
||||
let sourceWebFeed = sourceNode.representedObject as? WebFeed,
|
||||
let sourceWebFeed = sourceNode.representedObject as? Feed,
|
||||
sourceWebFeed.account?.accountID != destAccount.accountID && destAccount.hasWebFeed(withURL: sourceWebFeed.url) {
|
||||
return UITableViewDropProposal(operation: .forbidden)
|
||||
}
|
||||
@@ -91,7 +91,7 @@ extension MasterFeedViewController: UITableViewDropDelegate {
|
||||
}
|
||||
}()
|
||||
|
||||
guard let destination = destinationContainer, let webFeed = dragNode.representedObject as? WebFeed else { return }
|
||||
guard let destination = destinationContainer, let webFeed = dragNode.representedObject as? Feed else { return }
|
||||
|
||||
if source.account == destination.account {
|
||||
moveWebFeedInAccount(feed: webFeed, sourceContainer: source, destinationContainer: destination)
|
||||
@@ -100,7 +100,7 @@ extension MasterFeedViewController: UITableViewDropDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
func moveWebFeedInAccount(feed: WebFeed, sourceContainer: Container, destinationContainer: Container) {
|
||||
func moveWebFeedInAccount(feed: Feed, sourceContainer: Container, destinationContainer: Container) {
|
||||
guard sourceContainer !== destinationContainer else { return }
|
||||
|
||||
BatchUpdate.shared.start()
|
||||
@@ -115,7 +115,7 @@ extension MasterFeedViewController: UITableViewDropDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
func moveWebFeedBetweenAccounts(feed: WebFeed, sourceContainer: Container, destinationContainer: Container) {
|
||||
func moveWebFeedBetweenAccounts(feed: Feed, sourceContainer: Container, destinationContainer: Container) {
|
||||
|
||||
if let existingFeed = destinationContainer.account?.existingWebFeed(withURL: feed.url) {
|
||||
|
||||
|
||||
@@ -130,17 +130,17 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
||||
}
|
||||
|
||||
@objc func webFeedIconDidBecomeAvailable(_ note: Notification) {
|
||||
guard let webFeed = note.userInfo?[UserInfoKey.webFeed] as? WebFeed else {
|
||||
guard let webFeed = note.userInfo?[UserInfoKey.webFeed] as? Feed else {
|
||||
return
|
||||
}
|
||||
applyToCellsForRepresentedObject(webFeed, configureIcon(_:_:))
|
||||
}
|
||||
|
||||
@objc func webFeedSettingDidChange(_ note: Notification) {
|
||||
guard let webFeed = note.object as? WebFeed, let key = note.userInfo?[WebFeed.WebFeedSettingUserInfoKey] as? String else {
|
||||
guard let webFeed = note.object as? Feed, let key = note.userInfo?[Feed.WebFeedSettingUserInfoKey] as? String else {
|
||||
return
|
||||
}
|
||||
if key == WebFeed.WebFeedSettingKey.homePageURL || key == WebFeed.WebFeedSettingKey.faviconURL {
|
||||
if key == Feed.WebFeedSettingKey.homePageURL || key == Feed.WebFeedSettingKey.faviconURL {
|
||||
configureCellsForRepresentedObject(webFeed)
|
||||
}
|
||||
}
|
||||
@@ -268,7 +268,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
||||
renameAction.backgroundColor = UIColor.systemOrange
|
||||
actions.append(renameAction)
|
||||
|
||||
if let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed {
|
||||
if let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed {
|
||||
let moreTitle = NSLocalizedString("More", comment: "More")
|
||||
let moreAction = UIContextualAction(style: .normal, title: moreTitle) { [weak self] (action, view, completion) in
|
||||
|
||||
@@ -320,10 +320,10 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, contextMenuConfigurationForRowAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? {
|
||||
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else {
|
||||
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? SidebarItem else {
|
||||
return nil
|
||||
}
|
||||
if feed is WebFeed {
|
||||
if feed is Feed {
|
||||
return makeWebFeedContextMenu(indexPath: indexPath, includeDeleteRename: true)
|
||||
} else if feed is Folder {
|
||||
return makeFolderContextMenu(indexPath: indexPath)
|
||||
@@ -795,7 +795,7 @@ private extension MasterFeedViewController {
|
||||
cell.isDisclosureAvailable = false
|
||||
}
|
||||
|
||||
if let feed = node.representedObject as? Feed {
|
||||
if let feed = node.representedObject as? SidebarItem {
|
||||
cell.name = feed.nameForDisplay
|
||||
cell.unreadCount = feed.unreadCount
|
||||
}
|
||||
@@ -812,7 +812,7 @@ private extension MasterFeedViewController {
|
||||
}
|
||||
|
||||
func configureIcon(_ cell: MasterFeedTableViewCell, _ indexPath: IndexPath) {
|
||||
guard let node = coordinator.nodeFor(indexPath), let feed = node.representedObject as? Feed, let feedID = feed.feedID else {
|
||||
guard let node = coordinator.nodeFor(indexPath), let feed = node.representedObject as? SidebarItem, let feedID = feed.sidebarItemID else {
|
||||
return
|
||||
}
|
||||
cell.iconImage = IconImageCache.shared.imageFor(feedID)
|
||||
@@ -832,9 +832,9 @@ private extension MasterFeedViewController {
|
||||
func applyToCellsForRepresentedObject(_ representedObject: AnyObject, _ completion: (MasterFeedTableViewCell, IndexPath) -> Void) {
|
||||
applyToAvailableCells { (cell, indexPath) in
|
||||
if let node = coordinator.nodeFor(indexPath),
|
||||
let representedFeed = representedObject as? Feed,
|
||||
let candidate = node.representedObject as? Feed,
|
||||
representedFeed.feedID == candidate.feedID {
|
||||
let representedFeed = representedObject as? SidebarItem,
|
||||
let candidate = node.representedObject as? SidebarItem,
|
||||
representedFeed.sidebarItemID == candidate.sidebarItemID {
|
||||
completion(cell, indexPath)
|
||||
}
|
||||
}
|
||||
@@ -862,7 +862,7 @@ private extension MasterFeedViewController {
|
||||
if let folder = node.representedObject as? Folder {
|
||||
return folder.account
|
||||
}
|
||||
if let feed = node.representedObject as? WebFeed {
|
||||
if let feed = node.representedObject as? Feed {
|
||||
return feed.account
|
||||
}
|
||||
return nil
|
||||
@@ -1000,7 +1000,7 @@ private extension MasterFeedViewController {
|
||||
}
|
||||
|
||||
func copyFeedPageAction(indexPath: IndexPath) -> UIAction? {
|
||||
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed,
|
||||
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
|
||||
let url = URL(string: webFeed.url) else {
|
||||
return nil
|
||||
}
|
||||
@@ -1013,7 +1013,7 @@ private extension MasterFeedViewController {
|
||||
}
|
||||
|
||||
func copyFeedPageAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? {
|
||||
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed,
|
||||
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
|
||||
let url = URL(string: webFeed.url) else {
|
||||
return nil
|
||||
}
|
||||
@@ -1027,7 +1027,7 @@ private extension MasterFeedViewController {
|
||||
}
|
||||
|
||||
func copyHomePageAction(indexPath: IndexPath) -> UIAction? {
|
||||
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed,
|
||||
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
|
||||
let homePageURL = webFeed.homePageURL,
|
||||
let url = URL(string: homePageURL) else {
|
||||
return nil
|
||||
@@ -1041,7 +1041,7 @@ private extension MasterFeedViewController {
|
||||
}
|
||||
|
||||
func copyHomePageAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? {
|
||||
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed,
|
||||
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
|
||||
let homePageURL = webFeed.homePageURL,
|
||||
let url = URL(string: homePageURL) else {
|
||||
return nil
|
||||
@@ -1056,7 +1056,7 @@ private extension MasterFeedViewController {
|
||||
}
|
||||
|
||||
func markAllAsReadAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? {
|
||||
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed,
|
||||
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
|
||||
webFeed.unreadCount > 0,
|
||||
let articles = try? webFeed.fetchArticles(), let contentView = self.tableView.cellForRow(at: indexPath)?.contentView else {
|
||||
return nil
|
||||
@@ -1096,7 +1096,7 @@ private extension MasterFeedViewController {
|
||||
}
|
||||
|
||||
func getInfoAction(indexPath: IndexPath) -> UIAction? {
|
||||
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed else {
|
||||
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1124,7 +1124,7 @@ private extension MasterFeedViewController {
|
||||
}
|
||||
|
||||
func getInfoAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? {
|
||||
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed else {
|
||||
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1137,7 +1137,7 @@ private extension MasterFeedViewController {
|
||||
}
|
||||
|
||||
func markAllAsReadAction(indexPath: IndexPath) -> UIAction? {
|
||||
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
|
||||
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? SidebarItem,
|
||||
let contentView = self.tableView.cellForRow(at: indexPath)?.contentView,
|
||||
feed.unreadCount > 0 else {
|
||||
return nil
|
||||
@@ -1179,7 +1179,7 @@ private extension MasterFeedViewController {
|
||||
|
||||
|
||||
func rename(indexPath: IndexPath) {
|
||||
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else { return }
|
||||
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? SidebarItem else { return }
|
||||
|
||||
let formatString = NSLocalizedString("Rename “%@”", comment: "Rename feed")
|
||||
let title = NSString.localizedStringWithFormat(formatString as NSString, feed.nameForDisplay) as String
|
||||
@@ -1196,7 +1196,7 @@ private extension MasterFeedViewController {
|
||||
return
|
||||
}
|
||||
|
||||
if let webFeed = feed as? WebFeed {
|
||||
if let webFeed = feed as? Feed {
|
||||
webFeed.rename(to: name) { result in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -1233,7 +1233,7 @@ private extension MasterFeedViewController {
|
||||
}
|
||||
|
||||
func delete(indexPath: IndexPath) {
|
||||
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else { return }
|
||||
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? SidebarItem else { return }
|
||||
|
||||
let title: String
|
||||
let message: String
|
||||
@@ -1271,7 +1271,7 @@ private extension MasterFeedViewController {
|
||||
|
||||
if let folder = deleteNode.representedObject as? Folder {
|
||||
ActivityManager.cleanUp(folder)
|
||||
} else if let feed = deleteNode.representedObject as? WebFeed {
|
||||
} else if let feed = deleteNode.representedObject as? Feed {
|
||||
ActivityManager.cleanUp(feed)
|
||||
}
|
||||
|
||||
|
||||
@@ -453,7 +453,7 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
|
||||
titleView.iconView.iconImage = coordinator.timelineIconImage
|
||||
}
|
||||
|
||||
guard let feed = note.userInfo?[UserInfoKey.webFeed] as? WebFeed else {
|
||||
guard let feed = note.userInfo?[UserInfoKey.webFeed] as? Feed else {
|
||||
return
|
||||
}
|
||||
tableView.indexPathsForVisibleRows?.forEach { indexPath in
|
||||
@@ -631,7 +631,7 @@ private extension MasterTimelineViewController {
|
||||
titleView.label.text = coordinator.timelineFeed?.nameForDisplay
|
||||
updateTitleUnreadCount()
|
||||
|
||||
if coordinator.timelineFeed is WebFeed {
|
||||
if coordinator.timelineFeed is Feed {
|
||||
titleView.buttonize()
|
||||
titleView.addGestureRecognizer(feedTapGestureRecognizer)
|
||||
} else {
|
||||
|
||||
@@ -33,11 +33,11 @@ enum ShowFeedName {
|
||||
|
||||
struct FeedNode: Hashable {
|
||||
var node: Node
|
||||
var feedID: FeedIdentifier
|
||||
var feedID: SidebarItemIdentifier
|
||||
|
||||
init(_ node: Node) {
|
||||
self.node = node
|
||||
self.feedID = (node.representedObject as! Feed).feedID!
|
||||
self.feedID = (node.representedObject as! SidebarItem).sidebarItemID!
|
||||
}
|
||||
|
||||
func hash(into hasher: inout Hasher) {
|
||||
@@ -94,12 +94,12 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
||||
private var lastExpandedTable = Set<ContainerIdentifier>()
|
||||
|
||||
// Which Feeds have the Read Articles Filter enabled
|
||||
private var readFilterEnabledTable = [FeedIdentifier: Bool]()
|
||||
private var readFilterEnabledTable = [SidebarItemIdentifier: Bool]()
|
||||
|
||||
// Flattened tree structure for the Sidebar
|
||||
private var shadowTable = [(sectionID: String, feedNodes: [FeedNode])]()
|
||||
|
||||
private(set) var preSearchTimelineFeed: Feed?
|
||||
private(set) var preSearchTimelineFeed: SidebarItem?
|
||||
private var lastSearchString = ""
|
||||
private var lastSearchScope: SearchScope? = nil
|
||||
private var isSearching: Bool = false
|
||||
@@ -157,7 +157,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
||||
}
|
||||
|
||||
var isReadArticlesFiltered: Bool {
|
||||
if let feedID = timelineFeed?.feedID, let readFilterEnabled = readFilterEnabledTable[feedID] {
|
||||
if let feedID = timelineFeed?.sidebarItemID, let readFilterEnabled = readFilterEnabledTable[feedID] {
|
||||
return readFilterEnabled
|
||||
} else {
|
||||
return timelineDefaultReadFilterType != .none
|
||||
@@ -183,7 +183,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
||||
}
|
||||
|
||||
private var exceptionArticleFetcher: ArticleFetcher?
|
||||
private(set) var timelineFeed: Feed?
|
||||
private(set) var timelineFeed: SidebarItem?
|
||||
|
||||
var timelineMiddleIndexPath: IndexPath?
|
||||
|
||||
@@ -363,7 +363,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
||||
|
||||
if let readArticlesFilterState = windowState[UserInfoKey.readArticlesFilterState] as? [[AnyHashable: AnyHashable]: Bool] {
|
||||
for key in readArticlesFilterState.keys {
|
||||
if let feedIdentifier = FeedIdentifier(userInfo: key) {
|
||||
if let feedIdentifier = SidebarItemIdentifier(userInfo: key) {
|
||||
readFilterEnabledTable[feedIdentifier] = readArticlesFilterState[key]
|
||||
}
|
||||
}
|
||||
@@ -545,7 +545,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
||||
}
|
||||
|
||||
@objc func userDidAddFeed(_ notification: Notification) {
|
||||
guard let webFeed = notification.userInfo?[UserInfoKey.webFeed] as? WebFeed else {
|
||||
guard let webFeed = notification.userInfo?[UserInfoKey.webFeed] as? Feed else {
|
||||
return
|
||||
}
|
||||
discloseWebFeed(webFeed, animations: [.scroll, .navigation])
|
||||
@@ -557,7 +557,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
||||
}
|
||||
|
||||
@objc func accountDidDownloadArticles(_ note: Notification) {
|
||||
guard let feeds = note.userInfo?[Account.UserInfoKey.webFeeds] as? Set<WebFeed> else {
|
||||
guard let feeds = note.userInfo?[Account.UserInfoKey.webFeeds] as? Set<Feed> else {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -625,7 +625,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
||||
}
|
||||
|
||||
func toggleReadArticlesFilter() {
|
||||
guard let feedID = timelineFeed?.feedID else {
|
||||
guard let feedID = timelineFeed?.sidebarItemID else {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -638,10 +638,10 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
||||
refreshTimeline(resetScroll: false)
|
||||
}
|
||||
|
||||
func nodeFor(feedID: FeedIdentifier) -> Node? {
|
||||
func nodeFor(feedID: SidebarItemIdentifier) -> Node? {
|
||||
return treeController.rootNode.descendantNode(where: { node in
|
||||
if let feed = node.representedObject as? Feed {
|
||||
return feed.feedID == feedID
|
||||
if let feed = node.representedObject as? SidebarItem {
|
||||
return feed.sidebarItemID == feedID
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
@@ -783,7 +783,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
||||
return indexPathFor(node)
|
||||
}
|
||||
|
||||
func selectFeed(_ feed: Feed?, animations: Animations = [], deselectArticle: Bool = true, completion: (() -> Void)? = nil) {
|
||||
func selectFeed(_ feed: SidebarItem?, animations: Animations = [], deselectArticle: Bool = true, completion: (() -> Void)? = nil) {
|
||||
let indexPath: IndexPath? = {
|
||||
if let feed = feed, let indexPath = indexPathFor(feed as AnyObject) {
|
||||
return indexPath
|
||||
@@ -807,7 +807,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
||||
selectArticle(nil)
|
||||
}
|
||||
|
||||
if let ip = indexPath, let node = nodeFor(ip), let feed = node.representedObject as? Feed {
|
||||
if let ip = indexPath, let node = nodeFor(ip), let feed = node.representedObject as? SidebarItem {
|
||||
|
||||
self.activityManager.selecting(feed: feed)
|
||||
self.installTimelineControllerIfNecessary(animated: animations.contains(.navigation))
|
||||
@@ -1120,15 +1120,15 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
||||
markArticlesWithUndo([article], statusKey: .starred, flag: !article.status.starred)
|
||||
}
|
||||
|
||||
func timelineFeedIsEqualTo(_ feed: WebFeed) -> Bool {
|
||||
guard let timelineFeed = timelineFeed as? WebFeed else {
|
||||
func timelineFeedIsEqualTo(_ feed: Feed) -> Bool {
|
||||
guard let timelineFeed = timelineFeed as? Feed else {
|
||||
return false
|
||||
}
|
||||
|
||||
return timelineFeed == feed
|
||||
}
|
||||
|
||||
func discloseWebFeed(_ webFeed: WebFeed, initialLoad: Bool = false, animations: Animations = [], completion: (() -> Void)? = nil) {
|
||||
func discloseWebFeed(_ webFeed: Feed, initialLoad: Bool = false, animations: Animations = [], completion: (() -> Void)? = nil) {
|
||||
if isSearching {
|
||||
masterTimelineViewController?.hideSearch()
|
||||
}
|
||||
@@ -1145,10 +1145,10 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
||||
markExpanded(parentFolder)
|
||||
}
|
||||
|
||||
if let webFeedFeedID = webFeed.feedID {
|
||||
if let webFeedFeedID = webFeed.sidebarItemID {
|
||||
self.treeControllerDelegate.addFilterException(webFeedFeedID)
|
||||
}
|
||||
if let parentFolderFeedID = parentFolder?.feedID {
|
||||
if let parentFolderFeedID = parentFolder?.sidebarItemID {
|
||||
self.treeControllerDelegate.addFilterException(parentFolderFeedID)
|
||||
}
|
||||
|
||||
@@ -1196,7 +1196,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
||||
}
|
||||
|
||||
func showFeedInspector() {
|
||||
let timelineWebFeed = timelineFeed as? WebFeed
|
||||
let timelineWebFeed = timelineFeed as? Feed
|
||||
let articleFeed = currentArticle?.webFeed
|
||||
guard let feed = timelineWebFeed ?? articleFeed else {
|
||||
return
|
||||
@@ -1204,7 +1204,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
||||
showFeedInspector(for: feed)
|
||||
}
|
||||
|
||||
func showFeedInspector(for feed: WebFeed) {
|
||||
func showFeedInspector(for feed: Feed) {
|
||||
let feedInspectorNavController =
|
||||
UIStoryboard.inspector.instantiateViewController(identifier: "FeedInspectorNavigationViewController") as! UINavigationController
|
||||
let feedInspectorController = feedInspectorNavController.topViewController as! WebFeedInspectorViewController
|
||||
@@ -1248,7 +1248,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
||||
|
||||
func homePageURLForFeed(_ indexPath: IndexPath) -> URL? {
|
||||
guard let node = nodeFor(indexPath),
|
||||
let feed = node.representedObject as? WebFeed,
|
||||
let feed = node.representedObject as? Feed,
|
||||
let homePageURL = feed.homePageURL,
|
||||
let url = URL(string: homePageURL) else {
|
||||
return nil
|
||||
@@ -1458,7 +1458,7 @@ private extension SceneCoordinator {
|
||||
articleDictionaryNeedsUpdate = false
|
||||
}
|
||||
|
||||
func ensureFeedIsAvailableToSelect(_ feed: Feed, completion: @escaping () -> Void) {
|
||||
func ensureFeedIsAvailableToSelect(_ feed: SidebarItem, completion: @escaping () -> Void) {
|
||||
addToFilterExeptionsIfNecessary(feed)
|
||||
addShadowTableToFilterExceptions()
|
||||
|
||||
@@ -1468,15 +1468,15 @@ private extension SceneCoordinator {
|
||||
})
|
||||
}
|
||||
|
||||
func addToFilterExeptionsIfNecessary(_ feed: Feed?) {
|
||||
if isReadFeedsFiltered, let feedID = feed?.feedID {
|
||||
func addToFilterExeptionsIfNecessary(_ feed: SidebarItem?) {
|
||||
if isReadFeedsFiltered, let feedID = feed?.sidebarItemID {
|
||||
if feed is SmartFeed {
|
||||
treeControllerDelegate.addFilterException(feedID)
|
||||
} else if let folderFeed = feed as? Folder {
|
||||
if folderFeed.account?.existingFolder(withID: folderFeed.folderID) != nil {
|
||||
treeControllerDelegate.addFilterException(feedID)
|
||||
}
|
||||
} else if let webFeed = feed as? WebFeed {
|
||||
} else if let webFeed = feed as? Feed {
|
||||
if webFeed.account?.existingWebFeed(withWebFeedID: webFeed.webFeedID) != nil {
|
||||
treeControllerDelegate.addFilterException(feedID)
|
||||
addParentFolderToFilterExceptions(webFeed)
|
||||
@@ -1485,10 +1485,10 @@ private extension SceneCoordinator {
|
||||
}
|
||||
}
|
||||
|
||||
func addParentFolderToFilterExceptions(_ feed: Feed) {
|
||||
func addParentFolderToFilterExceptions(_ feed: SidebarItem) {
|
||||
guard let node = treeController.rootNode.descendantNodeRepresentingObject(feed as AnyObject),
|
||||
let folder = node.parent?.representedObject as? Folder,
|
||||
let folderFeedID = folder.feedID else {
|
||||
let folderFeedID = folder.sidebarItemID else {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1498,7 +1498,7 @@ private extension SceneCoordinator {
|
||||
func addShadowTableToFilterExceptions() {
|
||||
for section in shadowTable {
|
||||
for feedNode in section.feedNodes {
|
||||
if let feed = feedNode.node.representedObject as? Feed, let feedID = feed.feedID {
|
||||
if let feed = feedNode.node.representedObject as? SidebarItem, let feedID = feed.sidebarItemID {
|
||||
treeControllerDelegate.addFilterException(feedID)
|
||||
}
|
||||
}
|
||||
@@ -1628,10 +1628,10 @@ private extension SceneCoordinator {
|
||||
return ShadowTableChanges(deletes: deletes, inserts: inserts, moves: moves, rowChanges: changes)
|
||||
}
|
||||
|
||||
func shadowTableContains(_ feed: Feed) -> Bool {
|
||||
func shadowTableContains(_ feed: SidebarItem) -> Bool {
|
||||
for section in shadowTable {
|
||||
for feedNode in section.feedNodes {
|
||||
if let nodeFeed = feedNode.node.representedObject as? Feed, nodeFeed.feedID == feed.feedID {
|
||||
if let nodeFeed = feedNode.node.representedObject as? SidebarItem, nodeFeed.sidebarItemID == feed.sidebarItemID {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -1652,7 +1652,7 @@ private extension SceneCoordinator {
|
||||
return indexPathFor(node)
|
||||
}
|
||||
|
||||
func setTimelineFeed(_ feed: Feed?, animated: Bool, completion: (() -> Void)? = nil) {
|
||||
func setTimelineFeed(_ feed: SidebarItem?, animated: Bool, completion: (() -> Void)? = nil) {
|
||||
timelineFeed = feed
|
||||
|
||||
fetchAndReplaceArticlesAsync(animated: animated) {
|
||||
@@ -1663,7 +1663,7 @@ private extension SceneCoordinator {
|
||||
|
||||
func updateShowNamesAndIcons() {
|
||||
|
||||
if timelineFeed is WebFeed {
|
||||
if timelineFeed is Feed {
|
||||
showFeedNames = {
|
||||
for article in articles {
|
||||
if !article.byline().isEmpty {
|
||||
@@ -2074,11 +2074,11 @@ private extension SceneCoordinator {
|
||||
return false
|
||||
}
|
||||
|
||||
func timelineFetcherContainsAnyFeed(_ feeds: Set<WebFeed>) -> Bool {
|
||||
func timelineFetcherContainsAnyFeed(_ feeds: Set<Feed>) -> Bool {
|
||||
|
||||
// Return true if there’s a match or if a folder contains (recursively) one of feeds
|
||||
|
||||
if let feed = timelineFeed as? WebFeed {
|
||||
if let feed = timelineFeed as? Feed {
|
||||
for oneFeed in feeds {
|
||||
if feed.webFeedID == oneFeed.webFeedID || feed.url == oneFeed.url {
|
||||
return true
|
||||
@@ -2242,7 +2242,7 @@ private extension SceneCoordinator {
|
||||
func handleSelectFeed(_ userInfo: [AnyHashable : Any]?) {
|
||||
guard let userInfo = userInfo,
|
||||
let feedIdentifierUserInfo = userInfo[UserInfoKey.feedIdentifier] as? [AnyHashable : AnyHashable],
|
||||
let feedIdentifier = FeedIdentifier(userInfo: feedIdentifierUserInfo) else {
|
||||
let feedIdentifier = SidebarItemIdentifier(userInfo: feedIdentifierUserInfo) else {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -2327,7 +2327,7 @@ private extension SceneCoordinator {
|
||||
|
||||
func restoreFeedSelection(_ userInfo: [AnyHashable : Any], accountID: String, webFeedID: String, articleID: String) -> Bool {
|
||||
guard let feedIdentifierUserInfo = userInfo[UserInfoKey.feedIdentifier] as? [AnyHashable : AnyHashable],
|
||||
let feedIdentifier = FeedIdentifier(userInfo: feedIdentifierUserInfo),
|
||||
let feedIdentifier = SidebarItemIdentifier(userInfo: feedIdentifierUserInfo),
|
||||
let isShowingExtractedArticle = userInfo[UserInfoKey.isShowingExtractedArticle] as? Bool,
|
||||
let articleWindowScrollY = userInfo[UserInfoKey.articleWindowScrollY] as? Int else {
|
||||
return false
|
||||
@@ -2349,7 +2349,7 @@ private extension SceneCoordinator {
|
||||
let found = selectFeedAndArticle(feedIdentifier: feedIdentifier, articleID: articleID, isShowingExtractedArticle: isShowingExtractedArticle, articleWindowScrollY: articleWindowScrollY)
|
||||
if found {
|
||||
treeControllerDelegate.addFilterException(feedIdentifier)
|
||||
if let webFeedNode = nodeFor(feedID: feedIdentifier), let folder = webFeedNode.parent?.representedObject as? Folder, let folderFeedID = folder.feedID {
|
||||
if let webFeedNode = nodeFor(feedID: feedIdentifier), let folder = webFeedNode.parent?.representedObject as? Folder, let folderFeedID = folder.sidebarItemID {
|
||||
treeControllerDelegate.addFilterException(folderFeedID)
|
||||
}
|
||||
}
|
||||
@@ -2379,13 +2379,13 @@ private extension SceneCoordinator {
|
||||
}
|
||||
|
||||
func findWebFeedNode(webFeedID: String, beginningAt startingNode: Node) -> Node? {
|
||||
if let node = startingNode.descendantNode(where: { ($0.representedObject as? WebFeed)?.webFeedID == webFeedID }) {
|
||||
if let node = startingNode.descendantNode(where: { ($0.representedObject as? Feed)?.webFeedID == webFeedID }) {
|
||||
return node
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func selectFeedAndArticle(feedIdentifier: FeedIdentifier, articleID: String, isShowingExtractedArticle: Bool, articleWindowScrollY: Int) -> Bool {
|
||||
func selectFeedAndArticle(feedIdentifier: SidebarItemIdentifier, articleID: String, isShowingExtractedArticle: Bool, articleWindowScrollY: Int) -> Bool {
|
||||
guard let feedNode = nodeFor(feedID: feedIdentifier), let feedIndexPath = indexPathFor(feedNode) else { return false }
|
||||
|
||||
selectFeed(indexPath: feedIndexPath) {
|
||||
|
||||
Reference in New Issue
Block a user