Use new-style self-sizing cells on iOS 16

This commit is contained in:
Shadowfacts 2022-06-27 14:25:22 -07:00
parent 037b717e60
commit 10f6a68065
5 changed files with 19 additions and 4 deletions

View File

@ -255,8 +255,11 @@ extension NotificationsTableViewController: MenuActionProvider {
extension NotificationsTableViewController: StatusTableViewCellDelegate {
func statusCellCollapsedStateChanged(_ cell: BaseStatusTableViewCell) {
if #available(iOS 16.0, *) {
} else {
cellHeightChanged()
}
}
}
extension NotificationsTableViewController: UITableViewDataSourcePrefetching {

View File

@ -265,8 +265,11 @@ extension ProfileStatusesViewController: TuskerNavigationDelegate {
extension ProfileStatusesViewController: StatusTableViewCellDelegate {
func statusCellCollapsedStateChanged(_ cell: BaseStatusTableViewCell) {
if #available(iOS 16.0, *) {
} else {
cellHeightChanged()
}
}
}
extension ProfileStatusesViewController: UITableViewDataSourcePrefetching, StatusTablePrefetching {

View File

@ -290,8 +290,11 @@ extension TimelineTableViewController: TuskerNavigationDelegate {
extension TimelineTableViewController: StatusTableViewCellDelegate {
func statusCellCollapsedStateChanged(_ cell: BaseStatusTableViewCell) {
if #available(iOS 16.0, *) {
} else {
cellHeightChanged()
}
}
}
extension TimelineTableViewController: MenuActionProvider {

View File

@ -163,6 +163,7 @@ class DiffableTimelineLikeTableViewController<Section: Hashable & CaseIterable,
}
}
@available(iOS, deprecated: 16.0)
func cellHeightChanged() {
// causes the table view to recalculate the cell heights
tableView.beginUpdates()

View File

@ -12,6 +12,7 @@ import Combine
import AVKit
protocol StatusTableViewCellDelegate: TuskerNavigationDelegate, MenuActionProvider {
// @available(iOS, obsoleted: 16.0)
func statusCellCollapsedStateChanged(_ cell: BaseStatusTableViewCell)
}
@ -332,8 +333,12 @@ class BaseStatusTableViewCell: UITableViewCell {
@IBAction func collapseButtonPressed() {
setCollapsed(!collapsed, animated: true)
if #available(iOS 16.0, *) {
invalidateIntrinsicContentSize()
} else {
delegate?.statusCellCollapsedStateChanged(self)
}
}
func setCollapsed(_ collapsed: Bool, animated: Bool) {
self.collapsed = collapsed