Fixed duplicate adds for local account folder feed adds. Issue #701

This commit is contained in:
Maurice Parker 2019-05-26 12:17:38 -05:00
parent c61949bc04
commit 32712533d1
3 changed files with 2 additions and 6 deletions

View File

@ -388,8 +388,6 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
feed.name = name feed.name = name
feed.homePageURL = homePageURL feed.homePageURL = homePageURL
addFeed(feed)
return feed return feed
} }

View File

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

View File

@ -138,11 +138,10 @@ final class LocalAccountDelegate: AccountDelegate {
} }
func addFeed(for account: Account, to container: Container, with feed: Feed, completion: @escaping (Result<Void, Error>) -> Void) { func addFeed(for account: Account, to container: Container, with feed: Feed, completion: @escaping (Result<Void, Error>) -> Void) {
if let account = container as? Account {
account.addFeed(feed)
}
if let folder = container as? Folder { if let folder = container as? Folder {
folder.addFeed(feed) folder.addFeed(feed)
} else if let account = container as? Account {
account.addFeed(feed)
} }
completion(.success(())) completion(.success(()))
} }