Continue renaming webFeed to feed.

This commit is contained in:
Brent Simmons
2024-11-01 21:58:47 -07:00
parent acabaf8f94
commit fac4eded60
32 changed files with 151 additions and 151 deletions

View File

@@ -11,14 +11,14 @@ import Articles
import RSParser
public extension Notification.Name {
static let WebFeedSettingDidChange = Notification.Name(rawValue: "FeedSettingDidChangeNotification")
static let FeedSettingDidChange = Notification.Name(rawValue: "FeedSettingDidChangeNotification")
}
public extension Feed {
static let WebFeedSettingUserInfoKey = "feedSetting"
static let FeedSettingUserInfoKey = "feedSetting"
struct WebFeedSettingKey {
struct FeedSettingKey {
public static let homePageURL = "homePageURL"
public static let iconURL = "iconURL"
public static let faviconURL = "faviconURL"
@@ -41,8 +41,8 @@ extension Feed {
}
func postFeedSettingDidChangeNotification(_ codingKey: WebFeedMetadata.CodingKeys) {
let userInfo = [Feed.WebFeedSettingUserInfoKey: codingKey.stringValue]
NotificationCenter.default.post(name: .WebFeedSettingDidChange, object: self, userInfo: userInfo)
let userInfo = [Feed.FeedSettingUserInfoKey: codingKey.stringValue]
NotificationCenter.default.post(name: .FeedSettingDidChange, object: self, userInfo: userInfo)
}
}

View File

@@ -34,8 +34,8 @@ final class AppDefaults {
static let subscribeToFeedsInDefaultBrowser = "subscribeToFeedsInDefaultBrowser"
static let articleTextSize = "articleTextSize"
static let refreshInterval = "refreshInterval"
static let addWebFeedAccountID = "addWebFeedAccountID"
static let addWebFeedFolderName = "addWebFeedFolderName"
static let addFeedAccountID = "addFeedAccountID"
static let addFeedFolderName = "addFeedFolderName"
static let addFolderAccountID = "addFolderAccountID"
static let importOPMLAccountID = "importOPMLAccountID"
static let exportOPMLAccountID = "exportOPMLAccountID"
@@ -148,21 +148,21 @@ final class AppDefaults {
}
}
var addWebFeedAccountID: String? {
var addFeedAccountID: String? {
get {
return AppDefaults.string(for: Key.addWebFeedAccountID)
return AppDefaults.string(for: Key.addFeedAccountID)
}
set {
AppDefaults.setString(for: Key.addWebFeedAccountID, newValue)
AppDefaults.setString(for: Key.addFeedAccountID, newValue)
}
}
var addWebFeedFolderName: String? {
var addFeedFolderName: String? {
get {
return AppDefaults.string(for: Key.addWebFeedFolderName)
return AppDefaults.string(for: Key.addFeedFolderName)
}
set {
AppDefaults.setString(for: Key.addWebFeedFolderName, newValue)
AppDefaults.setString(for: Key.addFeedFolderName, newValue)
}
}

View File

@@ -221,7 +221,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
mainWindowController?.window?.center()
}
NotificationCenter.default.addObserver(self, selector: #selector(webFeedSettingDidChange(_:)), name: .WebFeedSettingDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(feedSettingDidChange(_:)), name: .FeedSettingDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(userDefaultsDidChange(_:)), name: UserDefaults.didChangeNotification, object: nil)
DispatchQueue.main.async {
@@ -349,11 +349,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
}
}
@objc func webFeedSettingDidChange(_ note: Notification) {
guard let feed = note.object as? Feed, let key = note.userInfo?[Feed.WebFeedSettingUserInfoKey] as? String else {
@objc func feedSettingDidChange(_ note: Notification) {
guard let feed = note.object as? Feed, let key = note.userInfo?[Feed.FeedSettingUserInfoKey] as? String else {
return
}
if key == Feed.WebFeedSettingKey.homePageURL || key == Feed.WebFeedSettingKey.faviconURL {
if key == Feed.FeedSettingKey.homePageURL || key == Feed.FeedSettingKey.faviconURL {
let _ = faviconDownloader.favicon(for: feed)
}
}

View File

@@ -64,7 +64,7 @@ class AddWebFeedWindowController : NSWindowController, AddFeedWindowController {
if let account = initialAccount {
FolderTreeMenu.select(account: account, folder: initialFolder, in: folderPopupButton)
} else if let container = AddWebFeedDefaultContainer.defaultContainer {
} else if let container = AddFeedDefaultContainer.defaultContainer {
if let folder = container as? Folder, let account = folder.account {
FolderTreeMenu.select(account: account, folder: folder, in: folderPopupButton)
} else {
@@ -97,7 +97,7 @@ class AddWebFeedWindowController : NSWindowController, AddFeedWindowController {
}
guard let container = selectedContainer() else { return }
AddWebFeedDefaultContainer.saveDefaultContainer(container)
AddFeedDefaultContainer.saveDefaultContainer(container)
delegate?.addFeedWindowController(self, userEnteredURL: url, userEnteredTitle: userEnteredTitle, container: container)

View File

@@ -616,7 +616,7 @@ extension MainWindowController: TimelineContainerViewControllerDelegate {
if let articles = articles {
if articles.count == 1 {
activityManager.reading(feed: nil, article: articles.first)
if articles.first?.webFeed?.isArticleExtractorAlwaysOn ?? false {
if articles.first?.feed?.isArticleExtractorAlwaysOn ?? false {
detailState = .loading
startArticleExtractorForCurrentLink()
} else {
@@ -633,8 +633,8 @@ extension MainWindowController: TimelineContainerViewControllerDelegate {
detailViewController?.setState(detailState, mode: mode)
}
func timelineRequestedWebFeedSelection(_: TimelineContainerViewController, webFeed: Feed) {
sidebarViewController?.selectFeed(webFeed)
func timelineRequestedFeedSelection(_: TimelineContainerViewController, feed: Feed) {
sidebarViewController?.selectFeed(feed)
}
func timelineInvalidatedRestorationState(_: TimelineContainerViewController) {
@@ -1144,7 +1144,7 @@ private extension MainWindowController {
return currentLink != nil
}
if currentTimelineViewController?.selectedArticles.first?.webFeed != nil {
if currentTimelineViewController?.selectedArticles.first?.feed != nil {
toolbarButton.isEnabled = true
}
@@ -1171,7 +1171,7 @@ private extension MainWindowController {
return currentLink != nil
}
if currentTimelineViewController?.selectedArticles.first?.webFeed != nil {
if currentTimelineViewController?.selectedArticles.first?.feed != nil {
toolbarButton.isEnabled = true
}
@@ -1426,10 +1426,10 @@ private extension MainWindowController {
func buildNewSidebarItemMenu() -> NSMenu {
let menu = NSMenu()
let newWebFeedItem = NSMenuItem()
newWebFeedItem.title = NSLocalizedString("New Feed…", comment: "New Feed")
newWebFeedItem.action = Selector(("showAddFeedWindow:"))
menu.addItem(newWebFeedItem)
let newFeedItem = NSMenuItem()
newFeedItem.title = NSLocalizedString("New Feed…", comment: "New Feed")
newFeedItem.action = Selector(("showAddFeedWindow:"))
menu.addItem(newFeedItem)
let newFolderFeedItem = NSMenuItem()
newFolderFeedItem.title = NSLocalizedString("New Folder…", comment: "New Folder")

View File

@@ -11,9 +11,9 @@ import Articles
import Account
import RSCore
typealias PasteboardWebFeedDictionary = [String: String]
typealias PasteboardFeedDictionary = [String: String]
struct PasteboardWebFeed: Hashable {
struct PasteboardFeed: Hashable {
private struct Key {
static let url = "URL"
@@ -23,12 +23,12 @@ struct PasteboardWebFeed: Hashable {
// Internal
static let accountID = "accountID"
static let accountType = "accountType"
static let webFeedID = "webFeedID"
static let feedID = "feedID"
static let editedName = "editedName"
}
let url: String
let webFeedID: String?
let feedID: String?
let homePageURL: String?
let name: String?
let editedName: String?
@@ -36,9 +36,9 @@ struct PasteboardWebFeed: Hashable {
let accountType: AccountType?
let isLocalFeed: Bool
init(url: String, webFeedID: String?, homePageURL: String?, name: String?, editedName: String?, accountID: String?, accountType: AccountType?) {
init(url: String, feedID: String?, homePageURL: String?, name: String?, editedName: String?, accountID: String?, accountType: AccountType?) {
self.url = url.normalizedURL
self.webFeedID = webFeedID
self.feedID = feedID
self.homePageURL = homePageURL?.normalizedURL
self.name = name
self.editedName = editedName
@@ -49,7 +49,7 @@ struct PasteboardWebFeed: Hashable {
// MARK: - Reading
init?(dictionary: PasteboardWebFeedDictionary) {
init?(dictionary: PasteboardFeedDictionary) {
guard let url = dictionary[Key.url] else {
return nil
}
@@ -57,7 +57,7 @@ struct PasteboardWebFeed: Hashable {
let homePageURL = dictionary[Key.homePageURL]
let name = dictionary[Key.name]
let accountID = dictionary[Key.accountID]
let webFeedID = dictionary[Key.webFeedID]
let feedID = dictionary[Key.feedID]
let editedName = dictionary[Key.editedName]
var accountType: AccountType? = nil
@@ -65,7 +65,7 @@ struct PasteboardWebFeed: Hashable {
accountType = AccountType(rawValue: accountTypeInt)
}
self.init(url: url, webFeedID: webFeedID, homePageURL: homePageURL, name: name, editedName: editedName, accountID: accountID, accountType: accountType)
self.init(url: url, feedID: feedID, homePageURL: homePageURL, name: name, editedName: editedName, accountID: accountID, accountType: accountType)
}
init?(pasteboardItem: NSPasteboardItem) {
@@ -77,7 +77,7 @@ struct PasteboardWebFeed: Hashable {
pasteboardType = WebFeedPasteboardWriter.webFeedUTIType
}
if let foundType = pasteboardType {
if let feedDictionary = pasteboardItem.propertyList(forType: foundType) as? PasteboardWebFeedDictionary {
if let feedDictionary = pasteboardItem.propertyList(forType: foundType) as? PasteboardFeedDictionary {
self.init(dictionary: feedDictionary)
return
}
@@ -94,7 +94,7 @@ struct PasteboardWebFeed: Hashable {
if let foundType = pasteboardType {
if let possibleURLString = pasteboardItem.string(forType: foundType) {
if possibleURLString.mayBeURL {
self.init(url: possibleURLString, webFeedID: nil, homePageURL: nil, name: nil, editedName: nil, accountID: nil, accountType: nil)
self.init(url: possibleURLString, feedID: nil, homePageURL: nil, name: nil, editedName: nil, accountID: nil, accountType: nil)
return
}
}
@@ -103,18 +103,18 @@ struct PasteboardWebFeed: Hashable {
return nil
}
static func pasteboardFeeds(with pasteboard: NSPasteboard) -> Set<PasteboardWebFeed>? {
static func pasteboardFeeds(with pasteboard: NSPasteboard) -> Set<PasteboardFeed>? {
guard let items = pasteboard.pasteboardItems else {
return nil
}
let webFeeds = items.compactMap { PasteboardWebFeed(pasteboardItem: $0) }
let webFeeds = items.compactMap { PasteboardFeed(pasteboardItem: $0) }
return webFeeds.isEmpty ? nil : Set(webFeeds)
}
// MARK: - Writing
func exportDictionary() -> PasteboardWebFeedDictionary {
var d = PasteboardWebFeedDictionary()
func exportDictionary() -> PasteboardFeedDictionary {
var d = PasteboardFeedDictionary()
d[Key.url] = url
d[Key.homePageURL] = homePageURL ?? ""
if let nameForDisplay = editedName ?? name {
@@ -123,24 +123,24 @@ struct PasteboardWebFeed: Hashable {
return d
}
func internalDictionary() -> PasteboardWebFeedDictionary {
var d = PasteboardWebFeedDictionary()
d[PasteboardWebFeed.Key.webFeedID] = webFeedID
d[PasteboardWebFeed.Key.url] = url
func internalDictionary() -> PasteboardFeedDictionary {
var d = PasteboardFeedDictionary()
d[PasteboardFeed.Key.feedID] = feedID
d[PasteboardFeed.Key.url] = url
if let homePageURL = homePageURL {
d[PasteboardWebFeed.Key.homePageURL] = homePageURL
d[PasteboardFeed.Key.homePageURL] = homePageURL
}
if let name = name {
d[PasteboardWebFeed.Key.name] = name
d[PasteboardFeed.Key.name] = name
}
if let editedName = editedName {
d[PasteboardWebFeed.Key.editedName] = editedName
d[PasteboardFeed.Key.editedName] = editedName
}
if let accountID = accountID {
d[PasteboardWebFeed.Key.accountID] = accountID
d[PasteboardFeed.Key.accountID] = accountID
}
if let accountType = accountType {
d[PasteboardWebFeed.Key.accountType] = String(accountType.rawValue)
d[PasteboardFeed.Key.accountType] = String(accountType.rawValue)
}
return d
}
@@ -196,15 +196,15 @@ extension Feed: @retroactive PasteboardWriterOwner {
private extension WebFeedPasteboardWriter {
var pasteboardFeed: PasteboardWebFeed {
return PasteboardWebFeed(url: webFeed.url, webFeedID: webFeed.webFeedID, homePageURL: webFeed.homePageURL, name: webFeed.name, editedName: webFeed.editedName, accountID: webFeed.account?.accountID, accountType: webFeed.account?.type)
var pasteboardFeed: PasteboardFeed {
return PasteboardFeed(url: webFeed.url, feedID: webFeed.webFeedID, homePageURL: webFeed.homePageURL, name: webFeed.name, editedName: webFeed.editedName, accountID: webFeed.account?.accountID, accountType: webFeed.account?.type)
}
var exportDictionary: PasteboardWebFeedDictionary {
var exportDictionary: PasteboardFeedDictionary {
return pasteboardFeed.exportDictionary()
}
var internalDictionary: PasteboardWebFeedDictionary {
var internalDictionary: PasteboardFeedDictionary {
return pasteboardFeed.internalDictionary()
}
}

View File

@@ -52,7 +52,7 @@ struct PasteboardFolder: Hashable {
}
if let foundType = pasteboardType {
if let folderDictionary = pasteboardItem.propertyList(forType: foundType) as? PasteboardWebFeedDictionary {
if let folderDictionary = pasteboardItem.propertyList(forType: foundType) as? PasteboardFeedDictionary {
self.init(dictionary: folderDictionary)
return
}
@@ -72,7 +72,7 @@ struct PasteboardFolder: Hashable {
// MARK: - Writing
func internalDictionary() -> PasteboardFolderDictionary {
var d = PasteboardWebFeedDictionary()
var d = PasteboardFeedDictionary()
d[PasteboardFolder.Key.name] = name
if let folderID = folderID {
d[PasteboardFolder.Key.folderID] = folderID
@@ -131,7 +131,7 @@ private extension FolderPasteboardWriter {
return PasteboardFolder(name: folder.name ?? "", folderID: String(folder.folderID), accountID: folder.account?.accountID)
}
var internalDictionary: PasteboardWebFeedDictionary {
var internalDictionary: PasteboardFeedDictionary {
return pasteboardFolder.internalDictionary()
}
}

View File

@@ -55,7 +55,7 @@ import Account
func outlineView(_ outlineView: NSOutlineView, validateDrop info: NSDraggingInfo, proposedItem item: Any?, proposedChildIndex index: Int) -> NSDragOperation {
let draggedFolders = PasteboardFolder.pasteboardFolders(with: info.draggingPasteboard)
let draggedFeeds = PasteboardWebFeed.pasteboardFeeds(with: info.draggingPasteboard)
let draggedFeeds = PasteboardFeed.pasteboardFeeds(with: info.draggingPasteboard)
if (draggedFolders == nil && draggedFeeds == nil) || (draggedFolders != nil && draggedFeeds != nil) {
return SidebarOutlineDataSource.dragOperationNone
}
@@ -91,7 +91,7 @@ import Account
func outlineView(_ outlineView: NSOutlineView, acceptDrop info: NSDraggingInfo, item: Any?, childIndex index: Int) -> Bool {
let draggedFolders = PasteboardFolder.pasteboardFolders(with: info.draggingPasteboard)
let draggedFeeds = PasteboardWebFeed.pasteboardFeeds(with: info.draggingPasteboard)
let draggedFeeds = PasteboardFeed.pasteboardFeeds(with: info.draggingPasteboard)
if (draggedFolders == nil && draggedFeeds == nil) || (draggedFolders != nil && draggedFeeds != nil) {
return false
}
@@ -145,7 +145,7 @@ private extension SidebarOutlineDataSource {
case empty, singleLocal, singleNonLocal, multipleLocal, multipleNonLocal, mixed
}
func draggedFeedContentsType(_ draggedFeeds: Set<PasteboardWebFeed>) -> DraggedFeedsContentsType {
func draggedFeedContentsType(_ draggedFeeds: Set<PasteboardFeed>) -> DraggedFeedsContentsType {
if draggedFeeds.isEmpty {
return .empty
}
@@ -173,14 +173,14 @@ private extension SidebarOutlineDataSource {
return .multipleNonLocal
}
func singleNonLocalFeed(from feeds: Set<PasteboardWebFeed>) -> PasteboardWebFeed? {
func singleNonLocalFeed(from feeds: Set<PasteboardFeed>) -> PasteboardFeed? {
guard feeds.count == 1, let feed = feeds.first else {
return nil
}
return feed.isLocalFeed ? nil : feed
}
func validateSingleNonLocalFeedDrop(_ outlineView: NSOutlineView, _ draggedFeed: PasteboardWebFeed, _ parentNode: Node, _ index: Int) -> NSDragOperation {
func validateSingleNonLocalFeedDrop(_ outlineView: NSOutlineView, _ draggedFeed: PasteboardFeed, _ parentNode: Node, _ index: Int) -> NSDragOperation {
// A non-local feed should always drag on to an Account or Folder node, with NSOutlineViewDropOnItemIndex since we dont know where it would sort till we read the feed.
guard let dropTargetNode = ancestorThatCanAcceptNonLocalFeed(parentNode) else {
return SidebarOutlineDataSource.dragOperationNone
@@ -191,7 +191,7 @@ private extension SidebarOutlineDataSource {
return .copy
}
func validateSingleLocalFeedDrop(_ outlineView: NSOutlineView, _ draggedFeed: PasteboardWebFeed, _ parentNode: Node, _ index: Int) -> NSDragOperation {
func validateSingleLocalFeedDrop(_ outlineView: NSOutlineView, _ draggedFeed: PasteboardFeed, _ parentNode: Node, _ index: Int) -> NSDragOperation {
// A local feed should always drag on to an Account or Folder node, and we can provide an index.
guard let dropTargetNode = ancestorThatCanAcceptLocalFeed(parentNode) else {
return SidebarOutlineDataSource.dragOperationNone
@@ -212,7 +212,7 @@ private extension SidebarOutlineDataSource {
return localDragOperation(parentNode: parentNode)
}
func validateLocalFeedsDrop(_ outlineView: NSOutlineView, _ draggedFeeds: Set<PasteboardWebFeed>, _ parentNode: Node, _ index: Int) -> NSDragOperation {
func validateLocalFeedsDrop(_ outlineView: NSOutlineView, _ draggedFeeds: Set<PasteboardFeed>, _ parentNode: Node, _ index: Int) -> NSDragOperation {
// Local feeds should always drag on to an Account or Folder node, and index should be NSOutlineViewDropOnItemIndex since we cant provide multiple indexes.
guard let dropTargetNode = ancestorThatCanAcceptLocalFeed(parentNode) else {
return SidebarOutlineDataSource.dragOperationNone
@@ -370,7 +370,7 @@ private extension SidebarOutlineDataSource {
}
}
func acceptLocalFeedsDrop(_ outlineView: NSOutlineView, _ draggedFeeds: Set<PasteboardWebFeed>, _ parentNode: Node, _ index: Int) -> Bool {
func acceptLocalFeedsDrop(_ outlineView: NSOutlineView, _ draggedFeeds: Set<PasteboardFeed>, _ parentNode: Node, _ index: Int) -> Bool {
guard let draggedNodes = draggedNodes else {
return false
}
@@ -473,7 +473,7 @@ private extension SidebarOutlineDataSource {
return true
}
func acceptSingleNonLocalFeedDrop(_ outlineView: NSOutlineView, _ draggedFeed: PasteboardWebFeed, _ parentNode: Node, _ index: Int) -> Bool {
func acceptSingleNonLocalFeedDrop(_ outlineView: NSOutlineView, _ draggedFeed: PasteboardFeed, _ parentNode: Node, _ index: Int) -> Bool {
guard nodeIsDropTarget(parentNode), index == NSOutlineViewDropOnItemIndex else {
return false
}
@@ -490,11 +490,11 @@ private extension SidebarOutlineDataSource {
return true
}
func nodeHasChildRepresentingDraggedFeed(_ parentNode: Node, _ draggedFeed: PasteboardWebFeed) -> Bool {
func nodeHasChildRepresentingDraggedFeed(_ parentNode: Node, _ draggedFeed: PasteboardFeed) -> Bool {
return nodeHasChildRepresentingAnyDraggedFeed(parentNode, Set([draggedFeed]))
}
func nodeRepresentsAnyDraggedFeed(_ node: Node, _ draggedFeeds: Set<PasteboardWebFeed>) -> Bool {
func nodeRepresentsAnyDraggedFeed(_ node: Node, _ draggedFeeds: Set<PasteboardFeed>) -> Bool {
guard let feed = node.representedObject as? Feed else {
return false
}
@@ -532,7 +532,7 @@ private extension SidebarOutlineDataSource {
return nodeAccount(node)?.accountID
}
func nodeHasChildRepresentingAnyDraggedFeed(_ parentNode: Node, _ draggedFeeds: Set<PasteboardWebFeed>) -> Bool {
func nodeHasChildRepresentingAnyDraggedFeed(_ parentNode: Node, _ draggedFeeds: Set<PasteboardFeed>) -> Bool {
for node in parentNode.childNodes {
if nodeRepresentsAnyDraggedFeed(node, draggedFeeds) {
return true
@@ -541,11 +541,11 @@ private extension SidebarOutlineDataSource {
return false
}
func violatesAccountSpecificBehavior(_ dropTargetNode: Node, _ draggedFeed: PasteboardWebFeed) -> Bool {
func violatesAccountSpecificBehavior(_ dropTargetNode: Node, _ draggedFeed: PasteboardFeed) -> Bool {
return violatesAccountSpecificBehavior(dropTargetNode, Set([draggedFeed]))
}
func violatesAccountSpecificBehavior(_ dropTargetNode: Node, _ draggedFeeds: Set<PasteboardWebFeed>) -> Bool {
func violatesAccountSpecificBehavior(_ dropTargetNode: Node, _ draggedFeeds: Set<PasteboardFeed>) -> Bool {
if violatesDisallowFeedInRootFolder(dropTargetNode) {
return true
}
@@ -573,7 +573,7 @@ private extension SidebarOutlineDataSource {
return false
}
func violatesDisallowFeedCopyInRootFolder(_ dropTargetNode: Node, _ draggedFeeds: Set<PasteboardWebFeed>) -> Bool {
func violatesDisallowFeedCopyInRootFolder(_ dropTargetNode: Node, _ draggedFeeds: Set<PasteboardFeed>) -> Bool {
guard let dropTargetAccount = nodeAccount(dropTargetNode), dropTargetAccount.behaviors.contains(.disallowFeedCopyInRootFolder) else {
return false
}
@@ -591,7 +591,7 @@ private extension SidebarOutlineDataSource {
return false
}
func violatesDisallowFeedInMultipleFolders(_ dropTargetNode: Node, _ draggedFeeds: Set<PasteboardWebFeed>) -> Bool {
func violatesDisallowFeedInMultipleFolders(_ dropTargetNode: Node, _ draggedFeeds: Set<PasteboardFeed>) -> Bool {
guard let dropTargetAccount = nodeAccount(dropTargetNode), dropTargetAccount.behaviors.contains(.disallowFeedInMultipleFolders) else {
return false
}
@@ -611,7 +611,7 @@ private extension SidebarOutlineDataSource {
return false
}
func indexWhereDraggedFeedWouldAppear(_ parentNode: Node, _ draggedFeed: PasteboardWebFeed) -> Int {
func indexWhereDraggedFeedWouldAppear(_ parentNode: Node, _ draggedFeed: PasteboardFeed) -> Int {
let draggedFeedWrapper = PasteboardFeedObjectWrapper(pasteboardFeed: draggedFeed)
let draggedFeedNode = Node(representedObject: draggedFeedWrapper, parent: nil)
let nodes = parentNode.childNodes + [draggedFeedNode]
@@ -640,9 +640,9 @@ final class PasteboardFeedObjectWrapper: DisplayNameProvider {
var nameForDisplay: String {
return pasteboardFeed.editedName ?? pasteboardFeed.name ?? ""
}
let pasteboardFeed: PasteboardWebFeed
let pasteboardFeed: PasteboardFeed
init(pasteboardFeed: PasteboardWebFeed) {
init(pasteboardFeed: PasteboardFeed) {
self.pasteboardFeed = pasteboardFeed
}
}

View File

@@ -76,7 +76,7 @@ protocol SidebarDelegate: AnyObject {
NotificationCenter.default.addObserver(self, selector: #selector(batchUpdateDidPerform(_:)), name: .BatchUpdateDidPerform, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(webFeedIconDidBecomeAvailable(_:)), name: .FeedIconDidBecomeAvailable, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(webFeedSettingDidChange(_:)), name: .WebFeedSettingDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(webFeedSettingDidChange(_:)), name: .FeedSettingDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange(_:)), name: .DisplayNameDidChange, object: nil)
DistributedNotificationCenter.default().addObserver(self, selector: #selector(appleSideBarDefaultIconSizeChanged(_:)), name: .appleSideBarDefaultIconSizeChanged, object: nil)
@@ -199,10 +199,10 @@ protocol SidebarDelegate: AnyObject {
}
@objc func webFeedSettingDidChange(_ note: Notification) {
guard let webFeed = note.object as? Feed, let key = note.userInfo?[Feed.WebFeedSettingUserInfoKey] as? String else {
guard let webFeed = note.object as? Feed, let key = note.userInfo?[Feed.FeedSettingUserInfoKey] as? String else {
return
}
if key == Feed.WebFeedSettingKey.homePageURL || key == Feed.WebFeedSettingKey.faviconURL {
if key == Feed.FeedSettingKey.homePageURL || key == Feed.FeedSettingKey.faviconURL {
configureCellsForRepresentedObject(webFeed)
}
}

View File

@@ -96,7 +96,7 @@ private extension ArticlePasteboardWriter {
s += "Date: \(article.logicalDatePublished)\n\n"
if let feed = article.webFeed {
if let feed = article.feed {
s += "Feed: \(feed.nameForDisplay)\n"
if let homePageURL = feed.homePageURL {
s += "Home page: \(homePageURL)\n"
@@ -143,7 +143,7 @@ private extension ArticlePasteboardWriter {
d[Key.articleID] = article.articleID
d[Key.uniqueID] = article.uniqueID
if let feed = article.webFeed {
if let feed = article.feed {
d[Key.feedURL] = feed.url
}

View File

@@ -12,7 +12,7 @@ import Articles
protocol TimelineContainerViewControllerDelegate: AnyObject {
func timelineSelectionDidChange(_: TimelineContainerViewController, articles: [Article]?, mode: TimelineSourceMode)
func timelineRequestedWebFeedSelection(_: TimelineContainerViewController, webFeed: Feed)
func timelineRequestedFeedSelection(_: TimelineContainerViewController, feed: Feed)
func timelineInvalidatedRestorationState(_: TimelineContainerViewController)
}
@@ -142,7 +142,7 @@ extension TimelineContainerViewController: TimelineDelegate {
}
func timelineRequestedWebFeedSelection(_: TimelineViewController, webFeed: Feed) {
delegate?.timelineRequestedWebFeedSelection(self, webFeed: webFeed)
delegate?.timelineRequestedFeedSelection(self, feed: webFeed)
}
func timelineInvalidatedRestorationState(_: TimelineViewController) {

View File

@@ -163,7 +163,7 @@ private extension TimelineViewController {
menu.addSeparatorIfNeeded()
if articles.count == 1, let feed = articles.first!.webFeed {
if articles.count == 1, let feed = articles.first!.feed {
if !(representedObjects?.contains(where: { $0 as? Feed == feed }) ?? false) {
menu.addItem(selectFeedInSidebarMenuItem(feed))
}

View File

@@ -601,7 +601,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
guard let article = articles.articleAtRow(row) else {
return false
}
return feed == article.webFeed
return feed == article.feed
}
if let indexesToReload = indexesToReload {
reloadCells(for: indexesToReload)
@@ -879,7 +879,7 @@ extension TimelineViewController: NSTableViewDelegate {
private func configureTimelineCell(_ cell: TimelineTableCellView, article: Article) {
cell.objectValue = article
let iconImage = article.iconImage()
cell.cellData = TimelineCellData(article: article, showFeedName: showFeedNames, feedName: article.webFeed?.nameForDisplay, byline: article.byline(), iconImage: iconImage, showIcon: showIcons, featuredImage: nil)
cell.cellData = TimelineCellData(article: article, showFeedName: showFeedNames, feedName: article.feed?.nameForDisplay, byline: article.byline(), iconImage: iconImage, showIcon: showIcons, featuredImage: nil)
}
private func iconFor(_ article: Article) -> IconImage? {

View File

@@ -143,7 +143,7 @@ class ScriptableArticle: NSObject, UniqueIdScriptingObject, ScriptingObjectConta
@objc(feed)
var feed: ScriptableWebFeed? {
guard let parentFeed = self.article.webFeed,
guard let parentFeed = self.article.feed,
let account = parentFeed.account
else { return nil }

View File

@@ -30,7 +30,7 @@ extension NSApplication : ScriptingObjectContainer {
func currentArticle() -> ScriptableArticle? {
var scriptableArticle: ScriptableArticle?
if let currentArticle = appDelegate.scriptingCurrentArticle {
if let feed = currentArticle.webFeed {
if let feed = currentArticle.feed {
let scriptableFeed = ScriptableWebFeed(feed, container:self)
scriptableArticle = ScriptableArticle(currentArticle, container:scriptableFeed)
}
@@ -42,7 +42,7 @@ extension NSApplication : ScriptingObjectContainer {
func selectedArticles() -> NSArray {
let articles = appDelegate.scriptingSelectedArticles
let scriptableArticles:[ScriptableArticle] = articles.compactMap { article in
if let feed = article.webFeed {
if let feed = article.feed {
let scriptableFeed = ScriptableWebFeed(feed, container:self)
return ScriptableArticle(article, container:scriptableFeed)
} else {

View File

@@ -229,7 +229,7 @@
51A1699D235E10D700EB091F /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A16993235E10D600EB091F /* SettingsViewController.swift */; };
51A1699F235E10D700EB091F /* AboutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A16995235E10D600EB091F /* AboutViewController.swift */; };
51A169A0235E10D700EB091F /* FeedbinAccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A16996235E10D700EB091F /* FeedbinAccountViewController.swift */; };
51A66685238075AE00CB272D /* AddWebFeedDefaultContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A66684238075AE00CB272D /* AddWebFeedDefaultContainer.swift */; };
51A66685238075AE00CB272D /* AddFeedDefaultContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A66684238075AE00CB272D /* AddFeedDefaultContainer.swift */; };
51A737AE24DB19730015FA66 /* RSCore in Frameworks */ = {isa = PBXBuildFile; productRef = 51A737AD24DB19730015FA66 /* RSCore */; };
51A737AF24DB19730015FA66 /* RSCore in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 51A737AD24DB19730015FA66 /* RSCore */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
51A737BF24DB197F0015FA66 /* RSDatabase in Frameworks */ = {isa = PBXBuildFile; productRef = 51A737BE24DB197F0015FA66 /* RSDatabase */; };
@@ -245,7 +245,7 @@
51A9A5ED2380D6000033AADF /* AppAssets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51C45254226507D200C03939 /* AppAssets.swift */; };
51A9A5EE2380D6080033AADF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 84C9FC9B2262A1A900D921D6 /* Assets.xcassets */; };
51A9A5EF2380D63B0033AADF /* IconImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 516AE9DE2372269A007DEEAA /* IconImage.swift */; };
51A9A5F32380DE530033AADF /* AddWebFeedDefaultContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A66684238075AE00CB272D /* AddWebFeedDefaultContainer.swift */; };
51A9A5F32380DE530033AADF /* AddFeedDefaultContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A66684238075AE00CB272D /* AddFeedDefaultContainer.swift */; };
51A9A5F52380F6A60033AADF /* ModalNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A9A5F42380F6A60033AADF /* ModalNavigationController.swift */; };
51A9A60A2382FD240033AADF /* PoppableGestureRecognizerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A9A6092382FD240033AADF /* PoppableGestureRecognizerDelegate.swift */; };
51AB8AB323B7F4C6008F147D /* WebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51AB8AB223B7F4C6008F147D /* WebViewController.swift */; };
@@ -438,7 +438,7 @@
8483630B2262A3F000DA1D35 /* RenameSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = 848363092262A3F000DA1D35 /* RenameSheet.xib */; };
8483630E2262A3FE00DA1D35 /* MainWindow.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8483630C2262A3FE00DA1D35 /* MainWindow.storyboard */; };
848B937221C8C5540038DC0D /* CrashReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848B937121C8C5540038DC0D /* CrashReporter.swift */; };
848D578E21543519005FFAD5 /* PasteboardWebFeed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848D578D21543519005FFAD5 /* PasteboardWebFeed.swift */; };
848D578E21543519005FFAD5 /* PasteboardFeed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848D578D21543519005FFAD5 /* PasteboardFeed.swift */; };
848F6AE51FC29CFB002D422E /* FaviconDownloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848F6AE41FC29CFA002D422E /* FaviconDownloader.swift */; };
849A97431ED9EAA9007D329B /* AddFolderWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97421ED9EAA9007D329B /* AddFolderWindowController.swift */; };
849A97531ED9EAC0007D329B /* AddFeedController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97511ED9EAC0007D329B /* AddFeedController.swift */; };
@@ -921,7 +921,7 @@
51A16993235E10D600EB091F /* SettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = "<group>"; };
51A16995235E10D600EB091F /* AboutViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AboutViewController.swift; sourceTree = "<group>"; };
51A16996235E10D700EB091F /* FeedbinAccountViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FeedbinAccountViewController.swift; sourceTree = "<group>"; };
51A66684238075AE00CB272D /* AddWebFeedDefaultContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddWebFeedDefaultContainer.swift; sourceTree = "<group>"; };
51A66684238075AE00CB272D /* AddFeedDefaultContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddFeedDefaultContainer.swift; sourceTree = "<group>"; };
51A9A5E32380C8870033AADF /* ShareFolderPickerAccountCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ShareFolderPickerAccountCell.xib; sourceTree = "<group>"; };
51A9A5E52380C8B20033AADF /* ShareFolderPickerFolderCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ShareFolderPickerFolderCell.xib; sourceTree = "<group>"; };
51A9A5E72380CA130033AADF /* ShareFolderPickerCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareFolderPickerCell.swift; sourceTree = "<group>"; };
@@ -1080,7 +1080,7 @@
8483630A2262A3F000DA1D35 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Mac/Base.lproj/RenameSheet.xib; sourceTree = SOURCE_ROOT; };
8483630D2262A3FE00DA1D35 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Mac/Base.lproj/MainWindow.storyboard; sourceTree = SOURCE_ROOT; };
848B937121C8C5540038DC0D /* CrashReporter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CrashReporter.swift; sourceTree = "<group>"; };
848D578D21543519005FFAD5 /* PasteboardWebFeed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasteboardWebFeed.swift; sourceTree = "<group>"; };
848D578D21543519005FFAD5 /* PasteboardFeed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasteboardFeed.swift; sourceTree = "<group>"; };
848F6AE41FC29CFA002D422E /* FaviconDownloader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FaviconDownloader.swift; sourceTree = "<group>"; };
849A97421ED9EAA9007D329B /* AddFolderWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddFolderWindowController.swift; sourceTree = "<group>"; };
849A97511ED9EAC0007D329B /* AddFeedController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AddFeedController.swift; path = AddFeed/AddFeedController.swift; sourceTree = "<group>"; };
@@ -1919,7 +1919,7 @@
849A97561ED9EB0D007D329B /* Extensions */ = {
isa = PBXGroup;
children = (
51A66684238075AE00CB272D /* AddWebFeedDefaultContainer.swift */,
51A66684238075AE00CB272D /* AddFeedDefaultContainer.swift */,
849A97731ED9EC04007D329B /* ArticleStringFormatter.swift */,
849A97581ED9EB0D007D329B /* ArticleUtilities.swift */,
5108F6B52375E612001ABC45 /* CacheCleaner.swift */,
@@ -1939,7 +1939,7 @@
isa = PBXGroup;
children = (
84AD1EA92031617300BC20B7 /* PasteboardFolder.swift */,
848D578D21543519005FFAD5 /* PasteboardWebFeed.swift */,
848D578D21543519005FFAD5 /* PasteboardFeed.swift */,
51868BF0254386630011A17B /* SidebarDeleteItemsAlert.swift */,
84AD1EBB2032AF5C00BC20B7 /* SidebarOutlineDataSource.swift */,
849A97601ED9EB96007D329B /* SidebarOutlineView.swift */,
@@ -3174,7 +3174,7 @@
51C4CFF224D37D1F00AF9874 /* Secrets.swift in Sources */,
51C452A022650A1900C03939 /* FeedIconDownloader.swift in Sources */,
51C4529E22650A1900C03939 /* ImageDownloader.swift in Sources */,
51A66685238075AE00CB272D /* AddWebFeedDefaultContainer.swift in Sources */,
51A66685238075AE00CB272D /* AddFeedDefaultContainer.swift in Sources */,
176813E92564BAE200D98635 /* WidgetDeepLinks.swift in Sources */,
51B5C87723F22B8200032075 /* ExtensionContainers.swift in Sources */,
51C45292226509C800C03939 /* TodayFeedDelegate.swift in Sources */,
@@ -3313,7 +3313,7 @@
D57BE6E0204CD35F00D11AAC /* NSScriptCommand+NetNewsWire.swift in Sources */,
D553738B20186C20006D8857 /* Article+Scriptability.swift in Sources */,
845EE7C11FC2488C00854A1F /* SmartFeed.swift in Sources */,
51A9A5F32380DE530033AADF /* AddWebFeedDefaultContainer.swift in Sources */,
51A9A5F32380DE530033AADF /* AddFeedDefaultContainer.swift in Sources */,
84702AA41FA27AC0006B8943 /* MarkStatusCommand.swift in Sources */,
D5907D7F2004AC00005947E5 /* NSApplication+Scriptability.swift in Sources */,
8405DD9C22153BD7008CE1BF /* NSView-Extensions.swift in Sources */,
@@ -3385,7 +3385,7 @@
849A97431ED9EAA9007D329B /* AddFolderWindowController.swift in Sources */,
8405DDA522168C62008CE1BF /* TimelineContainerViewController.swift in Sources */,
844B5B671FEA18E300C7C76A /* MainWIndowKeyboardHandler.swift in Sources */,
848D578E21543519005FFAD5 /* PasteboardWebFeed.swift in Sources */,
848D578E21543519005FFAD5 /* PasteboardFeed.swift in Sources */,
5144EA2F2279FAB600D19003 /* AccountsDetailViewController.swift in Sources */,
849A97801ED9EC42007D329B /* DetailViewController.swift in Sources */,
173A64172547BE0900267F6E /* AccountType+Helpers.swift in Sources */,

View File

@@ -235,7 +235,7 @@ private extension ActivityManager {
#endif
func makeKeywords(_ article: Article) -> [String] {
let feedNameKeywords = makeKeywords(article.webFeed?.nameForDisplay)
let feedNameKeywords = makeKeywords(article.feed?.nameForDisplay)
let articleTitleKeywords = makeKeywords(ArticleStringFormatter.truncatedTitle(article))
return feedNameKeywords + articleTitleKeywords
}

View File

@@ -241,8 +241,8 @@ private extension ArticleRenderer {
d["dateline_style"] = "articleDateline"
}
d["feed_link_title"] = article.webFeed?.nameForDisplay ?? ""
d["feed_link"] = article.webFeed?.homePageURL ?? ""
d["feed_link_title"] = article.feed?.nameForDisplay ?? ""
d["feed_link"] = article.feed?.homePageURL ?? ""
d["byline"] = byline()
@@ -261,7 +261,7 @@ private extension ArticleRenderer {
}
func byline() -> String {
guard let authors = article?.authors ?? article?.webFeed?.authors, !authors.isEmpty else {
guard let authors = article?.authors ?? article?.feed?.authors, !authors.isEmpty else {
return ""
}
@@ -269,7 +269,7 @@ private extension ArticleRenderer {
// This code assumes that multiple authors would never match the feed name so that
// if there feed owner has an article co-author all authors are given the byline.
if authors.count == 1, let author = authors.first {
if author.name == article?.webFeed?.nameForDisplay {
if author.name == article?.feed?.nameForDisplay {
return ""
}
}
@@ -333,10 +333,10 @@ private extension Article {
var baseURL: URL? {
var s = link
if s == nil {
s = webFeed?.homePageURL
s = feed?.homePageURL
}
if s == nil {
s = webFeed?.url
s = feed?.url
}
guard let urlString = s else {

View File

@@ -50,7 +50,7 @@ private extension SendToMarsEditCommand {
let body = article.contentHTML ?? article.contentText ?? article.summary
let authorName = article.authors?.first?.name
let sender = SendToBlogEditorApp(targetDescriptor: targetDescriptor, title: article.title, body: body, summary: article.summary, link: article.externalLink, permalink: article.link, subject: nil, creator: authorName, commentsURL: nil, guid: article.uniqueID, sourceName: article.webFeed?.nameForDisplay, sourceHomeURL: article.webFeed?.homePageURL, sourceFeedURL: article.webFeed?.url)
let sender = SendToBlogEditorApp(targetDescriptor: targetDescriptor, title: article.title, body: body, summary: article.summary, link: article.externalLink, permalink: article.link, subject: nil, creator: authorName, commentsURL: nil, guid: article.uniqueID, sourceName: article.feed?.nameForDisplay, sourceHomeURL: article.feed?.homePageURL, sourceFeedURL: article.feed?.url)
let _ = sender.send()
}

View File

@@ -65,10 +65,10 @@ private extension Article {
// Feed name, or feed name + author name (if author is specified per-article).
// Includes trailing space.
if let feedName = webFeed?.nameForDisplay, let authorName = authors?.first?.name {
if let feedName = feed?.nameForDisplay, let authorName = authors?.first?.name {
return feedName + ", " + authorName + ": "
}
if let feedName = webFeed?.nameForDisplay {
if let feedName = feed?.nameForDisplay {
return feedName + ": "
}
return ""

View File

@@ -9,12 +9,12 @@
import Foundation
import Account
struct AddWebFeedDefaultContainer {
struct AddFeedDefaultContainer {
static var defaultContainer: Container? {
if let accountID = AppDefaults.shared.addWebFeedAccountID, let account = AccountManager.shared.activeAccounts.first(where: { $0.accountID == accountID }) {
if let folderName = AppDefaults.shared.addWebFeedFolderName, let folder = account.existingFolder(withDisplayName: folderName) {
if let accountID = AppDefaults.shared.addFeedAccountID, let account = AccountManager.shared.activeAccounts.first(where: { $0.accountID == accountID }) {
if let folderName = AppDefaults.shared.addFeedFolderName, let folder = account.existingFolder(withDisplayName: folderName) {
return folder
} else {
return substituteContainerIfNeeded(account: account)
@@ -28,11 +28,11 @@ struct AddWebFeedDefaultContainer {
}
static func saveDefaultContainer(_ container: Container) {
AppDefaults.shared.addWebFeedAccountID = container.account?.accountID
AppDefaults.shared.addFeedAccountID = container.account?.accountID
if let folder = container as? Folder {
AppDefaults.shared.addWebFeedFolderName = folder.nameForDisplay
AppDefaults.shared.addFeedFolderName = folder.nameForDisplay
} else {
AppDefaults.shared.addWebFeedFolderName = nil
AppDefaults.shared.addFeedFolderName = nil
}
}

View File

@@ -42,7 +42,7 @@ private func accountAndArticlesDictionary(_ articles: Set<Article>) -> [String:
extension Article {
var webFeed: Feed? {
var feed: Feed? {
return account?.existingWebFeed(withWebFeedID: webFeedID)
}
@@ -139,7 +139,7 @@ extension Article {
}
func byline() -> String {
guard let authors = authors ?? webFeed?.authors, !authors.isEmpty else {
guard let authors = authors ?? feed?.authors, !authors.isEmpty else {
return ""
}
@@ -147,7 +147,7 @@ extension Article {
// This code assumes that multiple authors would never match the feed name so that
// if there feed owner has an article co-author all authors are given the byline.
if authors.count == 1, let author = authors.first {
if author.name == webFeed?.nameForDisplay {
if author.name == feed?.nameForDisplay {
return ""
}
}
@@ -215,7 +215,7 @@ extension Article {
extension Article: SortableArticle {
var sortableName: String {
return webFeed?.name ?? ""
return feed?.name ?? ""
}
var sortableDate: Date {

View File

@@ -52,7 +52,7 @@ class IconImageCache {
if let iconImage = imageForAuthors(article.authors) {
return iconImage
}
guard let feed = article.webFeed else {
guard let feed = article.feed else {
return nil
}
return imageForFeed(feed)

View File

@@ -12,8 +12,8 @@ struct ShareDefaultContainer {
static func defaultContainer(containers: ExtensionContainers) -> ExtensionContainer? {
if let accountID = AppDefaults.shared.addWebFeedAccountID, let account = containers.accounts.first(where: { $0.accountID == accountID }) {
if let folderName = AppDefaults.shared.addWebFeedFolderName, let folder = account.folders.first(where: { $0.name == folderName }) {
if let accountID = AppDefaults.shared.addFeedAccountID, let account = containers.accounts.first(where: { $0.accountID == accountID }) {
if let folderName = AppDefaults.shared.addFeedFolderName, let folder = account.folders.first(where: { $0.name == folderName }) {
return folder
} else {
return substituteContainerIfNeeded(account: account)
@@ -27,11 +27,11 @@ struct ShareDefaultContainer {
}
static func saveDefaultContainer(_ container: ExtensionContainer) {
AppDefaults.shared.addWebFeedAccountID = container.accountID
AppDefaults.shared.addFeedAccountID = container.accountID
if let folder = container as? ExtensionFolder {
AppDefaults.shared.addWebFeedFolderName = folder.name
AppDefaults.shared.addFeedFolderName = folder.name
} else {
AppDefaults.shared.addWebFeedFolderName = nil
AppDefaults.shared.addFeedFolderName = nil
}
}

View File

@@ -26,7 +26,7 @@ final class UserNotificationManager: NSObject {
}
for article in articles {
if !article.status.read, let webFeed = article.webFeed, webFeed.isNotifyAboutNewArticles ?? false {
if !article.status.read, let webFeed = article.feed, webFeed.isNotifyAboutNewArticles ?? false {
sendNotification(webFeed: webFeed, article: article)
}
}

View File

@@ -59,7 +59,7 @@ class AddFeedViewController: UITableViewController {
nameTextField.text = initialFeedName
nameTextField.delegate = self
if let defaultContainer = AddWebFeedDefaultContainer.defaultContainer {
if let defaultContainer = AddFeedDefaultContainer.defaultContainer {
container = defaultContainer
} else {
addButton.isEnabled = false
@@ -165,7 +165,7 @@ extension AddFeedViewController: AddFeedFolderViewControllerDelegate {
func didSelect(container: Container) {
self.container = container
updateFolderLabel()
AddWebFeedDefaultContainer.saveDefaultContainer(container)
AddFeedDefaultContainer.saveDefaultContainer(container)
}
}

View File

@@ -52,8 +52,8 @@ final class AppDefaults {
static let articleFullscreenEnabled = "articleFullscreenEnabled"
static let confirmMarkAllAsRead = "confirmMarkAllAsRead"
static let lastRefresh = "lastRefresh"
static let addWebFeedAccountID = "addWebFeedAccountID"
static let addWebFeedFolderName = "addWebFeedFolderName"
static let addFeedAccountID = "addFeedAccountID"
static let addFeedFolderName = "addFeedFolderName"
static let addFolderAccountID = "addFolderAccountID"
static let useSystemBrowser = "useSystemBrowser"
static let currentThemeName = "currentThemeName"
@@ -86,21 +86,21 @@ final class AppDefaults {
}
}
var addWebFeedAccountID: String? {
var addFeedAccountID: String? {
get {
return AppDefaults.string(for: Key.addWebFeedAccountID)
return AppDefaults.string(for: Key.addFeedAccountID)
}
set {
AppDefaults.setString(for: Key.addWebFeedAccountID, newValue)
AppDefaults.setString(for: Key.addFeedAccountID, newValue)
}
}
var addWebFeedFolderName: String? {
var addFeedFolderName: String? {
get {
return AppDefaults.string(for: Key.addWebFeedFolderName)
return AppDefaults.string(for: Key.addFeedFolderName)
}
set {
AppDefaults.setString(for: Key.addWebFeedFolderName, newValue)
AppDefaults.setString(for: Key.addFeedFolderName, newValue)
}
}

View File

@@ -21,7 +21,7 @@ class ContextMenuPreviewViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
blogNameLabel.text = article.webFeed?.nameForDisplay ?? ""
blogNameLabel.text = article.feed?.nameForDisplay ?? ""
blogAuthorLabel.text = article.byline()
articleTitleLabel.text = article.title ?? ""

View File

@@ -113,7 +113,7 @@ class WebViewController: UIViewController {
if article != self.article {
self.article = article
if updateView {
if article?.webFeed?.isArticleExtractorAlwaysOn ?? false {
if article?.feed?.isArticleExtractorAlwaysOn ?? false {
startArticleExtractor()
}
windowScrollY = 0
@@ -451,7 +451,7 @@ extension WebViewController: WKScriptMessageHandler {
case MessageName.imageWasClicked:
imageWasClicked(body: message.body as? String)
case MessageName.showFeedInspector:
if let webFeed = article?.webFeed {
if let webFeed = article?.feed {
coordinator.showFeedInspector(for: webFeed)
}
default:

View File

@@ -69,7 +69,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(webFeedIconDidBecomeAvailable(_:)), name: .FeedIconDidBecomeAvailable, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(webFeedSettingDidChange(_:)), name: .WebFeedSettingDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(webFeedSettingDidChange(_:)), name: .FeedSettingDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange), name: UIContentSizeCategory.didChangeNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(willEnterForeground(_:)), name: UIApplication.willEnterForegroundNotification, object: nil)
@@ -137,10 +137,10 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
}
@objc func webFeedSettingDidChange(_ note: Notification) {
guard let webFeed = note.object as? Feed, let key = note.userInfo?[Feed.WebFeedSettingUserInfoKey] as? String else {
guard let webFeed = note.object as? Feed, let key = note.userInfo?[Feed.FeedSettingUserInfoKey] as? String else {
return
}
if key == Feed.WebFeedSettingKey.homePageURL || key == Feed.WebFeedSettingKey.faviconURL {
if key == Feed.FeedSettingKey.homePageURL || key == Feed.FeedSettingKey.faviconURL {
configureCellsForRepresentedObject(webFeed)
}
}

View File

@@ -460,7 +460,7 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
guard let article = dataSource.itemIdentifier(for: indexPath) else {
return
}
if article.webFeed == feed, let cell = tableView.cellForRow(at: indexPath) as? MasterTimelineTableViewCell, let image = iconImageFor(article) {
if article.feed == feed, let cell = tableView.cellForRow(at: indexPath) as? MasterTimelineTableViewCell, let image = iconImageFor(article) {
cell.setIconImage(image)
}
}
@@ -730,7 +730,7 @@ private extension MasterTimelineViewController {
let showFeedNames = coordinator.showFeedNames
let showIcon = coordinator.showIcons && iconImage != nil
cell.cellData = MasterTimelineCellData(article: article, showFeedName: showFeedNames, feedName: article.webFeed?.nameForDisplay, byline: article.byline(), iconImage: iconImage, showIcon: showIcon, featuredImage: featuredImage, numberOfLines: numberOfTextLines, iconSize: iconSize)
cell.cellData = MasterTimelineCellData(article: article, showFeedName: showFeedNames, feedName: article.feed?.nameForDisplay, byline: article.byline(), iconImage: iconImage, showIcon: showIcon, featuredImage: featuredImage, numberOfLines: numberOfTextLines, iconSize: iconSize)
}
@@ -846,7 +846,7 @@ private extension MasterTimelineViewController {
}
func discloseFeedAction(_ article: Article) -> UIAction? {
guard let webFeed = article.webFeed,
guard let webFeed = article.feed,
!coordinator.timelineFeedIsEqualTo(webFeed) else { return nil }
let title = NSLocalizedString("Go to Feed", comment: "Go to Feed")
@@ -857,7 +857,7 @@ private extension MasterTimelineViewController {
}
func discloseFeedAlertAction(_ article: Article, completion: @escaping (Bool) -> Void) -> UIAlertAction? {
guard let webFeed = article.webFeed,
guard let webFeed = article.feed,
!coordinator.timelineFeedIsEqualTo(webFeed) else { return nil }
let title = NSLocalizedString("Go to Feed", comment: "Go to Feed")
@@ -869,7 +869,7 @@ private extension MasterTimelineViewController {
}
func markAllInFeedAsReadAction(_ article: Article, indexPath: IndexPath) -> UIAction? {
guard let webFeed = article.webFeed else { return nil }
guard let webFeed = article.feed else { return nil }
guard let fetchedArticles = try? webFeed.fetchArticles() else {
return nil
}
@@ -892,7 +892,7 @@ private extension MasterTimelineViewController {
}
func markAllInFeedAsReadAlertAction(_ article: Article, indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? {
guard let webFeed = article.webFeed else { return nil }
guard let webFeed = article.feed else { return nil }
guard let fetchedArticles = try? webFeed.fetchArticles() else {
return nil
}

View File

@@ -1197,7 +1197,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
func showFeedInspector() {
let timelineWebFeed = timelineFeed as? Feed
let articleFeed = currentArticle?.webFeed
let articleFeed = currentArticle?.feed
guard let feed = timelineWebFeed ?? articleFeed else {
return
}