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,7 +255,10 @@ extension NotificationsTableViewController: MenuActionProvider {
extension NotificationsTableViewController: StatusTableViewCellDelegate {
func statusCellCollapsedStateChanged(_ cell: BaseStatusTableViewCell) {
cellHeightChanged()
if #available(iOS 16.0, *) {
} else {
cellHeightChanged()
}
}
}

View File

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

View File

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

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,7 +333,11 @@ class BaseStatusTableViewCell: UITableViewCell {
@IBAction func collapseButtonPressed() {
setCollapsed(!collapsed, animated: true)
delegate?.statusCellCollapsedStateChanged(self)
if #available(iOS 16.0, *) {
invalidateIntrinsicContentSize()
} else {
delegate?.statusCellCollapsedStateChanged(self)
}
}
func setCollapsed(_ collapsed: Bool, animated: Bool) {