mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Convert addFeed to async await.
This commit is contained in:
@@ -116,13 +116,16 @@ extension SidebarViewController: UITableViewDropDelegate {
|
||||
}
|
||||
|
||||
func moveFeedBetweenAccounts(feed: Feed, sourceContainer: Container, destinationContainer: Container) {
|
||||
|
||||
|
||||
if let existingFeed = destinationContainer.account?.existingFeed(withURL: feed.url) {
|
||||
|
||||
|
||||
BatchUpdate.shared.start()
|
||||
destinationContainer.account?.addFeed(existingFeed, to: destinationContainer) { result in
|
||||
switch result {
|
||||
case .success:
|
||||
|
||||
Task { @MainActor in
|
||||
|
||||
do {
|
||||
try await destinationContainer.account?.addFeed(existingFeed, to: destinationContainer)
|
||||
|
||||
sourceContainer.account?.removeFeed(feed, from: sourceContainer) { result in
|
||||
BatchUpdate.shared.end()
|
||||
switch result {
|
||||
@@ -132,14 +135,15 @@ extension SidebarViewController: UITableViewDropDelegate {
|
||||
self.presentError(error)
|
||||
}
|
||||
}
|
||||
case .failure(let error):
|
||||
|
||||
} catch {
|
||||
BatchUpdate.shared.end()
|
||||
self.presentError(error)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
BatchUpdate.shared.start()
|
||||
destinationContainer.account?.createFeed(url: feed.url, name: feed.editedName, container: destinationContainer, validateFeed: false) { result in
|
||||
switch result {
|
||||
|
||||
Reference in New Issue
Block a user