Don't use KVO for updating timeline gap cell
This commit is contained in:
parent
a3e64703ab
commit
765b5e1a7c
|
@ -44,7 +44,6 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
|||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
private var userActivityNeedsUpdate = PassthroughSubject<Void, Never>()
|
||||
private var contentOffsetObservation: NSKeyValueObservation?
|
||||
// the last time this VC disappeared or the scene was backgrounded while it was active, used to decide if we want to check for present when reappearing
|
||||
private var disappearedAt: Date?
|
||||
|
||||
|
@ -140,13 +139,6 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
|||
collectionView.refreshControl!.addTarget(self, action: #selector(refresh), for: .valueChanged)
|
||||
#endif
|
||||
|
||||
contentOffsetObservation = collectionView.observe(\.contentOffset) { [weak self] _, _ in
|
||||
if let indexPath = self?.dataSource.indexPath(for: .gap),
|
||||
let cell = self?.collectionView.cellForItem(at: indexPath) as? TimelineGapCollectionViewCell {
|
||||
cell.update()
|
||||
}
|
||||
}
|
||||
|
||||
filterer.filtersChanged = { [unowned self] actionsChanged in
|
||||
self.reapplyFilters(actionsChanged: actionsChanged)
|
||||
}
|
||||
|
@ -1339,6 +1331,13 @@ extension TimelineViewController: UICollectionViewDelegate {
|
|||
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
|
||||
userActivityNeedsUpdate.send()
|
||||
}
|
||||
|
||||
func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
if let indexPath = dataSource.indexPath(for: .gap),
|
||||
let cell = collectionView.cellForItem(at: indexPath) as? TimelineGapCollectionViewCell {
|
||||
cell.update()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension TimelineViewController: UICollectionViewDragDelegate {
|
||||
|
|
Loading…
Reference in New Issue