mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-28 16:26:04 +00:00
Add additional needed KVO accessors.
This commit is contained in:
1 parent
2d8b47075a
commit
0d460d3545
2 files changed
+37
No files matched your search
@@ -99,6 +99,18 @@ final class ScriptableAccount: NSObject, UniqueIdScriptingObject, ScriptingObjec
|
||||
return account.topLevelWebFeeds.map { ScriptableWebFeed($0, container:self) } as NSArray
|
||||
}
|
||||
|
||||
@objc(countOfWebFeeds)
|
||||
func countOfWebFeeds() -> Int {
|
||||
return account.topLevelWebFeeds.count
|
||||
}
|
||||
|
||||
@objc(objectInWebFeedsAtIndex:)
|
||||
func objectInWebFeedsAtIndex(_ index: Int) -> ScriptableWebFeed? {
|
||||
let feeds = Array(account.topLevelWebFeeds)
|
||||
guard index >= 0 && index < feeds.count else { return nil }
|
||||
return ScriptableWebFeed(feeds[index], container: self)
|
||||
}
|
||||
|
||||
@objc(valueInWebFeedsWithUniqueID:)
|
||||
func valueInWebFeeds(withUniqueID id:String) -> ScriptableWebFeed? {
|
||||
guard let feed = account.existingWebFeed(withWebFeedID: id) else { return nil }
|
||||
@@ -119,6 +131,19 @@ final class ScriptableAccount: NSObject, UniqueIdScriptingObject, ScriptingObjec
|
||||
return folders.map { ScriptableFolder($0, container:self) } as NSArray
|
||||
}
|
||||
|
||||
@objc(countOfFolders)
|
||||
func countOfFolders() -> Int {
|
||||
return account.folders?.count ?? 0
|
||||
}
|
||||
|
||||
@objc(objectInFoldersAtIndex:)
|
||||
func objectInFoldersAtIndex(_ index: Int) -> ScriptableFolder? {
|
||||
let foldersSet = account.folders ?? Set<Folder>()
|
||||
let folders = Array(foldersSet)
|
||||
guard index >= 0 && index < folders.count else { return nil }
|
||||
return ScriptableFolder(folders[index], container: self)
|
||||
}
|
||||
|
||||
@objc(valueInFoldersWithUniqueID:)
|
||||
func valueInFolders(withUniqueID id:NSNumber) -> ScriptableFolder? {
|
||||
let folderId = id.intValue
|
||||
|
||||
Reference in new issue
Block a user