Use BatchUpdate.shared.
This commit is contained in:
parent
c258a9da5c
commit
0f19fda54d
@ -16,7 +16,6 @@ import Account
|
|||||||
|
|
||||||
let appName = "Evergreen"
|
let appName = "Evergreen"
|
||||||
var currentTheme: VSTheme!
|
var currentTheme: VSTheme!
|
||||||
let batchUpdate = BatchUpdate()
|
|
||||||
|
|
||||||
@NSApplicationMain
|
@NSApplicationMain
|
||||||
class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations {
|
class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations {
|
||||||
|
@ -17,6 +17,8 @@ public extension Notification.Name {
|
|||||||
|
|
||||||
final class BatchUpdate {
|
final class BatchUpdate {
|
||||||
|
|
||||||
|
static let shared = BatchUpdate()
|
||||||
|
|
||||||
private var count = 0
|
private var count = 0
|
||||||
|
|
||||||
var isPerforming: Bool {
|
var isPerforming: Bool {
|
||||||
|
@ -73,7 +73,7 @@ import Account
|
|||||||
outlineView.removeItems(at: selectedRows, inParent: nil, withAnimation: [.slideDown])
|
outlineView.removeItems(at: selectedRows, inParent: nil, withAnimation: [.slideDown])
|
||||||
outlineView.endUpdates()
|
outlineView.endUpdates()
|
||||||
|
|
||||||
batchUpdate.perform {
|
BatchUpdate.shared.perform {
|
||||||
deleteItemsForNodes(nodesToDelete)
|
deleteItemsForNodes(nodesToDelete)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ private extension SidebarViewController {
|
|||||||
|
|
||||||
func rebuildTreeAndReloadDataIfNeeded() {
|
func rebuildTreeAndReloadDataIfNeeded() {
|
||||||
|
|
||||||
if !batchUpdate.isPerforming {
|
if !BatchUpdate.shared.isPerforming {
|
||||||
treeController.rebuild()
|
treeController.rebuild()
|
||||||
outlineView.reloadData()
|
outlineView.reloadData()
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ struct FeedsImporter {
|
|||||||
|
|
||||||
let feedsToImport = feeds(with: feedDictionaries, accountID: account.accountID)
|
let feedsToImport = feeds(with: feedDictionaries, accountID: account.accountID)
|
||||||
|
|
||||||
batchUpdate.perform {
|
BatchUpdate.shared.perform {
|
||||||
for feed in feedsToImport {
|
for feed in feedsToImport {
|
||||||
if !account.hasFeed(with: feed.feedID) {
|
if !account.hasFeed(with: feed.feedID) {
|
||||||
let _ = account.addFeed(feed, to: nil)
|
let _ = account.addFeed(feed, to: nil)
|
||||||
|
@ -38,7 +38,7 @@ struct OPMLImporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let opmlDocument = opmlDocument {
|
if let opmlDocument = opmlDocument {
|
||||||
batchUpdate.perform {
|
BatchUpdate.shared.perform {
|
||||||
account.importOPML(opmlDocument)
|
account.importOPML(opmlDocument)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user