mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-06 20:28:48 +00:00
Rename some instances of webfeed as feed.
This commit is contained in:
1 parent
faba422eca
commit
31cfab5dba
8 files changed
+91
-92
No files matched your search
@@ -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)
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user