Use BatchUpdate.shared.

This commit is contained in:
Brent Simmons 2017-10-05 20:38:54 -07:00
parent c258a9da5c
commit 0f19fda54d
5 changed files with 6 additions and 5 deletions

View File

@ -16,7 +16,6 @@ import Account
let appName = "Evergreen"
var currentTheme: VSTheme!
let batchUpdate = BatchUpdate()
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations {

View File

@ -17,6 +17,8 @@ public extension Notification.Name {
final class BatchUpdate {
static let shared = BatchUpdate()
private var count = 0
var isPerforming: Bool {

View File

@ -73,7 +73,7 @@ import Account
outlineView.removeItems(at: selectedRows, inParent: nil, withAnimation: [.slideDown])
outlineView.endUpdates()
batchUpdate.perform {
BatchUpdate.shared.perform {
deleteItemsForNodes(nodesToDelete)
}
@ -164,7 +164,7 @@ private extension SidebarViewController {
func rebuildTreeAndReloadDataIfNeeded() {
if !batchUpdate.isPerforming {
if !BatchUpdate.shared.isPerforming {
treeController.rebuild()
outlineView.reloadData()
}

View File

@ -42,7 +42,7 @@ struct FeedsImporter {
let feedsToImport = feeds(with: feedDictionaries, accountID: account.accountID)
batchUpdate.perform {
BatchUpdate.shared.perform {
for feed in feedsToImport {
if !account.hasFeed(with: feed.feedID) {
let _ = account.addFeed(feed, to: nil)

View File

@ -38,7 +38,7 @@ struct OPMLImporter {
}
if let opmlDocument = opmlDocument {
batchUpdate.perform {
BatchUpdate.shared.perform {
account.importOPML(opmlDocument)
}
}