From 13197054bfa8edae406be31adab5eba6f7104b3f Mon Sep 17 00:00:00 2001 From: Kiel Gillard Date: Wed, 9 Oct 2019 19:44:52 +1100 Subject: [PATCH] Implement restore folders. Not sure how to test this. --- .../Feedly/FeedlyAccountDelegate.swift | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Frameworks/Account/Feedly/FeedlyAccountDelegate.swift b/Frameworks/Account/Feedly/FeedlyAccountDelegate.swift index 59e98841b..34e596440 100644 --- a/Frameworks/Account/Feedly/FeedlyAccountDelegate.swift +++ b/Frameworks/Account/Feedly/FeedlyAccountDelegate.swift @@ -452,7 +452,29 @@ final class FeedlyAccountDelegate: AccountDelegate { } func restoreFolder(for account: Account, folder: Folder, completion: @escaping (Result) -> Void) { - fatalError() + let group = DispatchGroup() + + for feed in folder.topLevelFeeds { + + folder.topLevelFeeds.remove(feed) + + group.enter() + restoreFeed(for: account, feed: feed, container: folder) { result in + group.leave() + switch result { + case .success: + break + case .failure(let error): + os_log(.error, log: self.log, "Restore folder feed error: %@.", error.localizedDescription) + } + } + + } + + group.notify(queue: .main) { + account.addFolder(folder) + completion(.success(())) + } } func markArticles(for account: Account, articles: Set
, statusKey: ArticleStatus.Key, flag: Bool) -> Set
? {