Rename some instances of webfeed as feed.

This commit is contained in:
Brent Simmons committed 2025-11-03 09:42:00 -08:00
1 parent faba422eca
commit 31cfab5dba
8 files changed
+91 -92

No files matched your search

+19 -19
View File
@@ -73,9 +73,9 @@
<element type="article">
<cocoa key="selectedArticles"/>
</element>
<element type="webFeed">
<synonym name="feed"/>
<cocoa key="webFeeds"/>
<element type="feed">
<synonym name="webFeed"/>
<cocoa key="feeds"/>
</element>
</class>
@@ -105,30 +105,30 @@
<property name="active" code="Actv" type="boolean" access="rw" description="Whether or not the account is active">
<cocoa key="scriptingIsActive"/>
</property>
<property name="allWebFeeds" code="Feds" access="r" description="All feeds, including feeds inside folders">
<synonym name="allFeeds"/>
<cocoa key="allWebFeeds"/>
<type type="webFeed" list="yes"/>
<property name="allFeeds" code="Feds" access="r" description="All feeds, including feeds inside folders">
<synonym name="allWebFeeds"/>
<cocoa key="allFeeds"/>
<type type="feed" list="yes"/>
</property>
<property name="opml representation" code="OPML" type="text" access="r" description="OPML representation for the account">
<cocoa key="opmlRepresentation"/>
</property>
<element type="webFeed">
<synonym name="feed"/>
<cocoa key="webFeeds"/>
<element type="feed">
<synonym name="webFeed"/>
<cocoa key="feeds"/>
</element>
<element type="webFeed">
<element type="feed">
<synonym name="allFeeds"/>
<cocoa key="allWebFeeds"/>
<cocoa key="allFeeds"/>
</element>
<element type="folder">
<cocoa key="folders"/>
</element>
</class>
<class name="webFeed" code="Feed" plural="webFeeds" description="An RSS feed">
<synonym name="feed"/>
<cocoa class="ScriptableWebFeed"/>
<class name="feed" code="Feed" plural="feeds" description="An RSS feed">
<synonym name="webFeed"/>
<cocoa class="ScriptableFeed"/>
<property name="name" code="pnam" type="text" access="r" description="The name of the feed">
<cocoa key="name"/>
</property>
@@ -189,9 +189,9 @@
<property name="opml representation" code="OPML" type="text" access="r" description="OPML representation for the folder">
<cocoa key="opmlRepresentation"/>
</property>
<element type="webFeed">
<synonym name="feed"/>
<cocoa key="webFeeds"/>
<element type="feed">
<synonym name="webFeed"/>
<cocoa key="feeds"/>
</element>
<element type="article">
<cocoa key="articles"/>
@@ -245,7 +245,7 @@
<property name="image url" code="IURL" type="text" access="r" description="an image url for the article">
<cocoa key="imageURL"/>
</property>
<property name="feed" code="Feed" type="webFeed" access="r" description="the containing feed">
<property name="feed" code="Feed" type="feed" access="r" description="the containing feed">
<cocoa key="feed"/>
</property>
<element type="author">
+23 -23
View File
@@ -94,31 +94,31 @@ final class ScriptableAccount: NSObject, UniqueIdScriptingObject, ScriptingObjec
// MARK: --- Scriptable elements ---
@objc(webFeeds)
var webFeeds:NSArray {
@objc(feeds)
var feeds:NSArray {
return account.topLevelFeeds.map { ScriptableFeed($0, container:self) } as NSArray
}
@objc(countOfWebFeeds)
func countOfWebFeeds() -> Int {
@objc(countOfFeeds)
func countOfFeeds() -> Int {
return account.topLevelFeeds.count
}
@objc(objectInWebFeedsAtIndex:)
func objectInWebFeedsAtIndex(_ index: Int) -> ScriptableFeed? {
@objc(objectInFeedsAtIndex:)
func objectInFeedsAtIndex(_ index: Int) -> ScriptableFeed? {
let feeds = Array(account.topLevelFeeds)
guard index >= 0 && index < feeds.count else { return nil }
return ScriptableFeed(feeds[index], container: self)
}
@objc(valueInWebFeedsWithUniqueID:)
func valueInWebFeeds(withUniqueID id:String) -> ScriptableFeed? {
@objc(valueInFeedsWithUniqueID:)
func valueInFeeds(withUniqueID id:String) -> ScriptableFeed? {
guard let feed = account.existingFeed(withFeedID: id) else { return nil }
return ScriptableFeed(feed, container:self)
}
@objc(valueInWebFeedsWithName:)
func valueInWebFeeds(withName name:String) -> ScriptableFeed? {
@objc(valueInFeedsWithName:)
func valueInFeeds(withName name:String) -> ScriptableFeed? {
let feeds = Array(account.flattenedFeeds())
guard let feed = feeds.first(where:{$0.name == name}) else { return nil }
return ScriptableFeed(feed, container:self)
@@ -155,35 +155,35 @@ final class ScriptableAccount: NSObject, UniqueIdScriptingObject, ScriptingObjec
// MARK: --- Scriptable properties ---
@objc(allWebFeeds)
var allWebFeeds: NSArray {
@objc(allFeeds)
var allFeeds: NSArray {
let allFeeds = account.flattenedFeeds()
let scriptableWebFeeds = allFeeds.map { webFeed in
return ScriptableFeed(webFeed, container: self)
let scriptableFeeds = allFeeds.map { feed in
return ScriptableFeed(feed, container: self)
}
return scriptableWebFeeds as NSArray
return scriptableFeeds as NSArray
}
@objc(countOfAllWebFeeds)
func countOfAllWebFeeds() -> Int {
@objc(countOfAllFeeds)
func countOfAllFeeds() -> Int {
return account.flattenedFeeds().count
}
@objc(objectInAllWebFeedsAtIndex:)
func objectInAllWebFeedsAtIndex(_ index: Int) -> ScriptableFeed? {
@objc(objectInAllFeedsAtIndex:)
func objectInAllFeedsAtIndex(_ index: Int) -> ScriptableFeed? {
let allFeeds = Array(account.flattenedFeeds())
guard index >= 0 && index < allFeeds.count else { return nil }
return ScriptableFeed(allFeeds[index], container: self)
}
@objc(valueInAllWebFeedsWithUniqueID:)
func valueInAllWebFeeds(withUniqueID id:String) -> ScriptableFeed? {
@objc(valueInAllFeedsWithUniqueID:)
func valueInAllFeeds(withUniqueID id:String) -> ScriptableFeed? {
guard let feed = account.existingFeed(withFeedID: id) else { return nil }
return ScriptableFeed(feed, container:self)
}
@objc(valueInAllWebFeedsWithName:)
func valueInAllWebFeeds(withName name:String) -> ScriptableFeed? {
@objc(valueInAllFeedsWithName:)
func valueInAllFeeds(withName name:String) -> ScriptableFeed? {
let feeds = Array(account.flattenedFeeds())
guard let feed = feeds.first(where:{$0.name == name}) else { return nil }
return ScriptableFeed(feed, container:self)
@@ -94,7 +94,7 @@ extension AppDelegate : AppDelegateAppleEvents {
final class NetNewsWireCreateElementCommand : NSCreateCommand {
override func performDefaultImplementation() -> Any? {
let classDescription = self.createClassDescription
if (classDescription.className == "webFeed") {
if (classDescription.className == "feed") {
return ScriptableFeed.handleCreateElement(command:self)
} else if (classDescription.className == "folder") {
return ScriptableFolder.handleCreateElement(command:self)
@@ -144,6 +144,6 @@ final class ScriptableArticle: NSObject, UniqueIdScriptingObject, ScriptingObjec
@objc(feed)
var feed: ScriptableFeed? {
guard let parentFeed = self.article.feed else { return nil }
return ScriptableFeed.scriptableWebFeed(for: parentFeed)
return ScriptableFeed.scriptableFeed(for: parentFeed)
}
}
+3 -3
View File
@@ -95,8 +95,8 @@ final class ScriptableFolder: NSObject, UniqueIdScriptingObject, ScriptingObject
// MARK: --- Scriptable elements ---
@objc(webFeeds)
var webFeeds:NSArray {
@objc(feeds)
var feeds:NSArray {
let feeds = Array(folder.topLevelFeeds)
return feeds.map { ScriptableFeed($0, container:self) } as NSArray
}
@@ -107,7 +107,7 @@ final class ScriptableFolder: NSObject, UniqueIdScriptingObject, ScriptingObject
let allArticles = feeds.flatMap { feed in
(try? feed.fetchArticles()) ?? Set<Article>()
}
// Sort articles by logical date published like WebFeed does
// Sort articles by logical date published like Feed does
let sortedArticles = allArticles.sorted(by: {
return $0.logicalDatePublished > $1.logicalDatePublished
})
@@ -31,7 +31,7 @@ extension NSApplication : ScriptingObjectContainer {
var scriptableArticle: ScriptableArticle?
if let currentArticle = appDelegate.scriptingCurrentArticle {
if let feed = currentArticle.feed,
let scriptableFeed = ScriptableFeed.scriptableWebFeed(for: feed) {
let scriptableFeed = ScriptableFeed.scriptableFeed(for: feed) {
scriptableArticle = ScriptableArticle(currentArticle, container: scriptableFeed)
}
}
@@ -43,7 +43,7 @@ extension NSApplication : ScriptingObjectContainer {
let articles = appDelegate.scriptingSelectedArticles
let scriptableArticles:[ScriptableArticle] = articles.compactMap { article in
if let feed = article.feed,
let scriptableFeed = ScriptableFeed.scriptableWebFeed(for: feed) {
let scriptableFeed = ScriptableFeed.scriptableFeed(for: feed) {
return ScriptableArticle(article, container:scriptableFeed)
} else {
return nil
@@ -64,7 +64,7 @@ extension NSApplication : ScriptingObjectContainer {
let article = articles[index]
if let feed = article.feed,
let scriptableFeed = ScriptableFeed.scriptableWebFeed(for: feed) {
let scriptableFeed = ScriptableFeed.scriptableFeed(for: feed) {
return ScriptableArticle(article, container: scriptableFeed)
} else {
return nil
@@ -104,7 +104,7 @@ extension NSApplication : ScriptingObjectContainer {
for 'articles of feed "The Shape of Everything" of account "On My Mac"'
*/
func allWebFeeds() -> [Feed] {
func allFeeds() -> [Feed] {
let accounts = AccountManager.shared.activeAccounts
let emptyFeeds:[Feed] = []
return accounts.reduce(emptyFeeds) { (result, nthAccount) -> [Feed] in
@@ -113,29 +113,28 @@ extension NSApplication : ScriptingObjectContainer {
}
}
@objc(webFeeds)
func webFeeds() -> NSArray {
let webFeeds = self.allWebFeeds()
return webFeeds.map { ScriptableFeed($0, container:self) } as NSArray
@objc(feeds)
func feeds() -> NSArray {
allFeeds().map { ScriptableFeed($0, container:self) } as NSArray
}
@objc(countOfWebFeeds)
func countOfWebFeeds() -> Int {
return self.allWebFeeds().count
@objc(countOfFeeds)
func countOfFeeds() -> Int {
allFeeds().count
}
@objc(objectInWebFeedsAtIndex:)
func objectInWebFeedsAtIndex(_ index: Int) -> ScriptableFeed? {
let webFeeds = self.allWebFeeds()
guard index >= 0 && index < webFeeds.count else { return nil }
return ScriptableFeed(webFeeds[index], container: self)
@objc(objectInFeedsAtIndex:)
func objectInFeedsAtIndex(_ index: Int) -> ScriptableFeed? {
let feeds = allFeeds()
guard index >= 0 && index < feeds.count else { return nil }
return ScriptableFeed(feeds[index], container: self)
}
@objc(valueInWebFeedsWithUniqueID:)
func valueInWebFeeds(withUniqueID id:String) -> ScriptableFeed? {
let webFeeds = self.allWebFeeds()
guard let webFeed = webFeeds.first(where:{$0.feedID == id}) else { return nil }
return ScriptableFeed(webFeed, container:self)
@objc(valueInFeedsWithUniqueID:)
func valueInFeeds(withUniqueID id:String) -> ScriptableFeed? {
let feeds = allFeeds()
guard let feed = feeds.first(where:{$0.feedID == id}) else { return nil }
return ScriptableFeed(feed, container:self)
}
}
@@ -36,7 +36,7 @@ final class ScriptableFeed: NSObject, UniqueIdScriptingObject, ScriptingObjectCo
// MARK: --- ScriptingObject protocol ---
var scriptingKey: String {
return "webFeeds"
return "feeds"
}
// MARK: --- UniqueIdScriptingObject protocol ---
@@ -81,7 +81,7 @@ final class ScriptableFeed: NSObject, UniqueIdScriptingObject, ScriptingObjectCo
}
}
class func scriptableWebFeed(for feed: Feed) -> ScriptableFeed? {
class func scriptableFeed(for feed: Feed) -> ScriptableFeed? {
guard let account = feed.account else { return nil }
// Find the proper container hierarchy
@@ -722,19 +722,19 @@ class MainFeedCollectionViewController: UICollectionViewController, UndoableComm
let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel")
let cancelAction = UIAlertAction(title: cancelTitle, style: .cancel)
let addWebFeedActionTitle = NSLocalizedString("Add Web Feed", comment: "Add Web Feed")
let addWebFeedAction = UIAlertAction(title: addWebFeedActionTitle, style: .default) { _ in
let addFeedActionTitle = NSLocalizedString("Add Web Feed", comment: "Add Web Feed")
let addFeedAction = UIAlertAction(title: addFeedActionTitle, style: .default) { _ in
self.coordinator.showAddFeed()
}
let addWebFolderdActionTitle = NSLocalizedString("Add Folder", comment: "Add Folder")
let addWebFolderAction = UIAlertAction(title: addWebFolderdActionTitle, style: .default) { _ in
let addFolderActionTitle = NSLocalizedString("Add Folder", comment: "Add Folder")
let addFolderAction = UIAlertAction(title: addFolderActionTitle, style: .default) { _ in
self.coordinator.showAddFolder()
}
alertController.addAction(addWebFeedAction)
alertController.addAction(addFeedAction)
alertController.addAction(addWebFolderAction)
alertController.addAction(addFolderAction)
alertController.addAction(cancelAction)
alertController.popoverPresentationController?.barButtonItem = sender
@@ -945,8 +945,8 @@ extension MainFeedCollectionViewController {
}
func copyFeedPageAction(indexPath: IndexPath) -> UIAction? {
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
let url = URL(string: webFeed.url) else {
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
let url = URL(string: feed.url) else {
return nil
}
@@ -958,8 +958,8 @@ extension MainFeedCollectionViewController {
}
func copyFeedPageAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? {
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
let url = URL(string: webFeed.url) else {
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
let url = URL(string: feed.url) else {
return nil
}
@@ -972,8 +972,8 @@ extension MainFeedCollectionViewController {
}
func copyHomePageAction(indexPath: IndexPath) -> UIAction? {
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
let homePageURL = webFeed.homePageURL,
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
let homePageURL = feed.homePageURL,
let url = URL(string: homePageURL) else {
return nil
}
@@ -986,8 +986,8 @@ extension MainFeedCollectionViewController {
}
func copyHomePageAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? {
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
let homePageURL = webFeed.homePageURL,
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
let homePageURL = feed.homePageURL,
let url = URL(string: homePageURL) else {
return nil
}
@@ -1001,14 +1001,14 @@ extension MainFeedCollectionViewController {
}
func markAllAsReadAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? {
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
webFeed.unreadCount > 0,
let articles = try? webFeed.fetchArticles(), let contentView = self.collectionView.cellForItem(at: indexPath)?.contentView else {
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
feed.unreadCount > 0,
let articles = try? feed.fetchArticles(), let contentView = self.collectionView.cellForItem(at: indexPath)?.contentView else {
return nil
}
let localizedMenuText = NSLocalizedString("Mark All as Read in “%@”", comment: "Command")
let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, webFeed.nameForDisplay) as String
let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, feed.nameForDisplay) as String
let cancel = {
completion(true)
}
@@ -1041,13 +1041,13 @@ extension MainFeedCollectionViewController {
}
func getInfoAction(indexPath: IndexPath) -> UIAction? {
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else {
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else {
return nil
}
let title = NSLocalizedString("Get Info", comment: "Get Info")
let action = UIAction(title: title, image: AppAssets.infoImage) { [weak self] action in
self?.coordinator.showFeedInspector(for: webFeed)
self?.coordinator.showFeedInspector(for: feed)
}
return action
}
@@ -1069,13 +1069,13 @@ extension MainFeedCollectionViewController {
}
func getInfoAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? {
guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else {
guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else {
return nil
}
let title = NSLocalizedString("Get Info", comment: "Get Info")
let action = UIAlertAction(title: title, style: .default) { [weak self] action in
self?.coordinator.showFeedInspector(for: webFeed)
self?.coordinator.showFeedInspector(for: feed)
completion(true)
}
return action