Add createFeed method.
This commit is contained in:
parent
1f677ca600
commit
a910841c65
|
@ -60,9 +60,7 @@ class AddFeedController: AddFeedWindowControllerDelegate, FeedFinderDelegate {
|
|||
|
||||
closeAddFeedSheet(NSApplication.ModalResponse.OK)
|
||||
|
||||
assert(folder.account != nil, "Folder must have an account.")
|
||||
let account = folder.account ?? AccountManager.shared.localAccount
|
||||
|
||||
let account = folder.account
|
||||
if account.hasFeed(withURL: url.absoluteString) {
|
||||
showAlreadySubscribedError(url.absoluteString, folder)
|
||||
return
|
||||
|
|
|
@ -106,6 +106,22 @@ public final class Account: DisplayNameProvider, Hashable {
|
|||
return true // TODO
|
||||
}
|
||||
|
||||
public func createFeed(with name: String, userEnteredName: String, url: String) -> Feed {
|
||||
|
||||
// For syncing, this may need to be an async method with a callback,
|
||||
// since it will likely need to call the server.
|
||||
|
||||
if let feed = existingFeed(withURL: url) {
|
||||
feed.editedName = userEnteredName
|
||||
return feed
|
||||
}
|
||||
|
||||
let feed = Feed(accountID: accountID, url: url, feedID: url)
|
||||
feed.name = name
|
||||
feed.editedName = userEnteredName
|
||||
return feed
|
||||
}
|
||||
|
||||
public func canAddFolder(_ folder: Folder, to containingFolder: Folder?) -> Bool {
|
||||
|
||||
return false // TODO
|
||||
|
|
Loading…
Reference in New Issue