Make move animation smoother by wrapping in a BatchUpdate

This commit is contained in:
Maurice Parker 2019-05-21 09:03:28 -05:00
parent d9458c8980
commit e6680a23b9

View File

@ -244,16 +244,19 @@ private extension SidebarOutlineDataSource {
} }
let source = node.parent?.representedObject as? Container let source = node.parent?.representedObject as? Container
let destination = parentNode.representedObject as? Container let destination = parentNode.representedObject as? Container
BatchUpdate.shared.start()
source?.removeFeed(feed) { result in source?.removeFeed(feed) { result in
switch result { switch result {
case .success: case .success:
destination?.addFeed(feed) { result in destination?.addFeed(feed) { result in
switch result { switch result {
case .success: case .success:
BatchUpdate.shared.end()
break break
case .failure(let error): case .failure(let error):
// If the second part of the move failed, try to put the feed back // If the second part of the move failed, try to put the feed back
source?.addFeed(feed) { result in} source?.addFeed(feed) { result in}
BatchUpdate.shared.end()
NSApplication.shared.presentError(error) NSApplication.shared.presentError(error)
} }
} }