Change so that we only show one error dialog when folder moves/copies can't find one or more feeds.
This commit is contained in:
parent
931b1f9afd
commit
afd9a47abd
@ -12,6 +12,18 @@ import Articles
|
|||||||
import RSCore
|
import RSCore
|
||||||
import Account
|
import Account
|
||||||
|
|
||||||
|
public enum SidebarOutlineDataSourceError: LocalizedError {
|
||||||
|
case createErrorNotFound([String])
|
||||||
|
|
||||||
|
public var errorDescription: String? {
|
||||||
|
switch self {
|
||||||
|
case .createErrorNotFound(let feedNames):
|
||||||
|
let message = NSLocalizedString("The following feeds could not be added because they could not be found:\n", comment: "Not found")
|
||||||
|
return "\(message)\(feedNames.joined(separator: ", "))"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@objc final class SidebarOutlineDataSource: NSObject, NSOutlineViewDataSource {
|
@objc final class SidebarOutlineDataSource: NSObject, NSOutlineViewDataSource {
|
||||||
|
|
||||||
let treeController: TreeController
|
let treeController: TreeController
|
||||||
@ -507,6 +519,7 @@ private extension SidebarOutlineDataSource {
|
|||||||
switch result {
|
switch result {
|
||||||
case .success(let destinationFolder):
|
case .success(let destinationFolder):
|
||||||
let group = DispatchGroup()
|
let group = DispatchGroup()
|
||||||
|
var notFoundFeedNames = [String]()
|
||||||
for feed in folder.topLevelWebFeeds {
|
for feed in folder.topLevelWebFeeds {
|
||||||
if let existingFeed = destinationAccount.existingWebFeed(withURL: feed.url) {
|
if let existingFeed = destinationAccount.existingWebFeed(withURL: feed.url) {
|
||||||
group.enter()
|
group.enter()
|
||||||
@ -527,13 +540,20 @@ private extension SidebarOutlineDataSource {
|
|||||||
case .success:
|
case .success:
|
||||||
break
|
break
|
||||||
case .failure(let error):
|
case .failure(let error):
|
||||||
NSApplication.shared.presentError(error)
|
if let accountError = error as? AccountError, case .createErrorNotFound = accountError {
|
||||||
|
notFoundFeedNames.append(feed.nameForDisplay)
|
||||||
|
} else {
|
||||||
|
NSApplication.shared.presentError(error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
group.notify(queue: DispatchQueue.main) {
|
group.notify(queue: DispatchQueue.main) {
|
||||||
completion()
|
completion()
|
||||||
|
if !notFoundFeedNames.isEmpty {
|
||||||
|
NSApplication.shared.presentError(SidebarOutlineDataSourceError.createErrorNotFound(notFoundFeedNames))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case .failure(let error):
|
case .failure(let error):
|
||||||
NSApplication.shared.presentError(error)
|
NSApplication.shared.presentError(error)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user