mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-25 17:12:23 +01:00
Use appDelegate’s coalescing queue for reloading visible cells.
This commit is contained in:
parent
d1137b7192
commit
7bcb8f7d12
@ -57,7 +57,6 @@ class TimelineViewController: NSViewController, UndoableCommandRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var didRegisterForNotifications = false
|
private var didRegisterForNotifications = false
|
||||||
private var reloadAvailableCellsTimer: Timer?
|
|
||||||
private var fetchAndMergeArticlesTimer: Timer?
|
private var fetchAndMergeArticlesTimer: Timer?
|
||||||
|
|
||||||
private var sortDirection = AppDefaults.shared.timelineSortDirection {
|
private var sortDirection = AppDefaults.shared.timelineSortDirection {
|
||||||
@ -583,7 +582,7 @@ extension TimelineViewController: NSTableViewDelegate {
|
|||||||
|
|
||||||
private extension TimelineViewController {
|
private extension TimelineViewController {
|
||||||
|
|
||||||
func reloadAvailableCells() {
|
@objc func reloadAvailableCells() {
|
||||||
|
|
||||||
if let indexesToReload = tableView.indexesOfAvailableRows() {
|
if let indexesToReload = tableView.indexesOfAvailableRows() {
|
||||||
reloadCells(for: indexesToReload)
|
reloadCells(for: indexesToReload)
|
||||||
@ -592,21 +591,7 @@ private extension TimelineViewController {
|
|||||||
|
|
||||||
func queueReloadAvailableCells() {
|
func queueReloadAvailableCells() {
|
||||||
|
|
||||||
invalidateReloadTimer()
|
appDelegate.coalescingQueue.add(self, #selector(reloadAvailableCells))
|
||||||
reloadAvailableCellsTimer = Timer.scheduledTimer(withTimeInterval: 0.1, repeats: false) { (timer) in
|
|
||||||
self.reloadAvailableCells()
|
|
||||||
self.invalidateReloadTimer()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func invalidateReloadTimer() {
|
|
||||||
|
|
||||||
if let timer = reloadAvailableCellsTimer {
|
|
||||||
if timer.isValid {
|
|
||||||
timer.invalidate()
|
|
||||||
}
|
|
||||||
reloadAvailableCellsTimer = nil
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateTableViewRowHeight() {
|
func updateTableViewRowHeight() {
|
||||||
|
Loading…
Reference in New Issue
Block a user