Fix issue where new Feeds added to a folder also got left in the account container.

This commit is contained in:
Maurice Parker 2019-05-21 10:26:11 -05:00
parent fb33008b36
commit 8816de4a0e
3 changed files with 9 additions and 1 deletions

View File

@ -35,7 +35,7 @@ final class FeedbinAPICaller: NSObject {
private var transport: Transport!
var credentials: Credentials?
var accountMetadata: AccountMetadata?
weak var accountMetadata: AccountMetadata?
init(transport: Transport) {
super.init()

View File

@ -375,6 +375,7 @@ final class FeedbinAccountDelegate: AccountDelegate {
case .success(let taggingID):
DispatchQueue.main.async {
self?.saveFolderRelationship(for: feed, withFolderName: folder.name ?? "", id: String(taggingID))
account.removeFeed(feed)
folder.addFeed(feed)
completion(.success(()))
}

View File

@ -59,6 +59,8 @@ class AddFeedController: AddFeedWindowControllerDelegate {
return
}
BatchUpdate.shared.start()
account.createFeed(url: url.absoluteString) { [weak self] result in
self?.endShowingProgress()
@ -67,6 +69,7 @@ class AddFeedController: AddFeedWindowControllerDelegate {
case .success(let feed):
self?.processFeed(feed, account: account, folder: folder, url: url, title: title)
case .failure(let error):
BatchUpdate.shared.end()
switch error {
case AccountError.createErrorAlreadySubscribed:
self?.showAlreadySubscribedError(url.absoluteString)
@ -139,8 +142,10 @@ private extension AddFeedController {
folder.addFeed(feed) { result in
switch result {
case .success:
BatchUpdate.shared.end()
NotificationCenter.default.post(name: .UserDidAddFeed, object: self, userInfo: [UserInfoKey.feed: feed])
case .failure(let error):
BatchUpdate.shared.end()
NSApplication.shared.presentError(error)
}
}
@ -148,8 +153,10 @@ private extension AddFeedController {
account.addFeed(feed) { result in
switch result {
case .success:
BatchUpdate.shared.end()
NotificationCenter.default.post(name: .UserDidAddFeed, object: self, userInfo: [UserInfoKey.feed: feed])
case .failure(let error):
BatchUpdate.shared.end()
NSApplication.shared.presentError(error)
}
}