forked from shadowfacts/Tusker
Hide public timeline description when user begins scrolling rather than
after cell moves offscreen Fixes description getting dismissed prematurely on iOS 14 and hitching when the cell moves offscreen
This commit is contained in:
parent
e6e5554edf
commit
1e54235ff5
|
@ -252,18 +252,13 @@ class TimelineTableViewController: DiffableTimelineLikeTableViewController<Timel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath) {
|
override func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
|
||||||
if let item = dataSource.itemIdentifier(for: indexPath),
|
super.scrollViewWillBeginDragging(scrollView)
|
||||||
case .publicTimelineDescription(local: _) = item {
|
|
||||||
// trying to remove cells right in didEndDisplaying crashes in UIKit
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
self.tableView.contentOffset.y -= cell.bounds.height
|
|
||||||
|
|
||||||
var snapshot = self.dataSource.snapshot()
|
if isShowingTimelineDescription {
|
||||||
snapshot.deleteItems([item])
|
var snapshot = self.dataSource.snapshot()
|
||||||
self.dataSource.apply(snapshot) {
|
snapshot.deleteSections([.header])
|
||||||
}
|
self.dataSource.apply(snapshot, animatingDifferences: true)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,6 +117,7 @@ class DiffableTimelineLikeTableViewController<Section: Hashable & CaseIterable,
|
||||||
case let .success(snapshot):
|
case let .success(snapshot):
|
||||||
self.dataSource.apply(snapshot, animatingDifferences: false)
|
self.dataSource.apply(snapshot, animatingDifferences: false)
|
||||||
self.state = .loaded
|
self.state = .loaded
|
||||||
|
|
||||||
case let .failure(.client(error)):
|
case let .failure(.client(error)):
|
||||||
self.state = .unloaded
|
self.state = .unloaded
|
||||||
var config = ToastConfiguration(title: "Error Loading")
|
var config = ToastConfiguration(title: "Error Loading")
|
||||||
|
|
Loading…
Reference in New Issue