forked from shadowfacts/Tusker
Use new-style self-sizing cells on iOS 16
This commit is contained in:
parent
037b717e60
commit
10f6a68065
|
@ -255,9 +255,12 @@ extension NotificationsTableViewController: MenuActionProvider {
|
||||||
|
|
||||||
extension NotificationsTableViewController: StatusTableViewCellDelegate {
|
extension NotificationsTableViewController: StatusTableViewCellDelegate {
|
||||||
func statusCellCollapsedStateChanged(_ cell: BaseStatusTableViewCell) {
|
func statusCellCollapsedStateChanged(_ cell: BaseStatusTableViewCell) {
|
||||||
|
if #available(iOS 16.0, *) {
|
||||||
|
} else {
|
||||||
cellHeightChanged()
|
cellHeightChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extension NotificationsTableViewController: UITableViewDataSourcePrefetching {
|
extension NotificationsTableViewController: UITableViewDataSourcePrefetching {
|
||||||
func tableView(_ tableView: UITableView, prefetchRowsAt indexPaths: [IndexPath]) {
|
func tableView(_ tableView: UITableView, prefetchRowsAt indexPaths: [IndexPath]) {
|
||||||
|
|
|
@ -265,9 +265,12 @@ extension ProfileStatusesViewController: TuskerNavigationDelegate {
|
||||||
|
|
||||||
extension ProfileStatusesViewController: StatusTableViewCellDelegate {
|
extension ProfileStatusesViewController: StatusTableViewCellDelegate {
|
||||||
func statusCellCollapsedStateChanged(_ cell: BaseStatusTableViewCell) {
|
func statusCellCollapsedStateChanged(_ cell: BaseStatusTableViewCell) {
|
||||||
|
if #available(iOS 16.0, *) {
|
||||||
|
} else {
|
||||||
cellHeightChanged()
|
cellHeightChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extension ProfileStatusesViewController: UITableViewDataSourcePrefetching, StatusTablePrefetching {
|
extension ProfileStatusesViewController: UITableViewDataSourcePrefetching, StatusTablePrefetching {
|
||||||
func tableView(_ tableView: UITableView, prefetchRowsAt indexPaths: [IndexPath]) {
|
func tableView(_ tableView: UITableView, prefetchRowsAt indexPaths: [IndexPath]) {
|
||||||
|
|
|
@ -290,9 +290,12 @@ extension TimelineTableViewController: TuskerNavigationDelegate {
|
||||||
|
|
||||||
extension TimelineTableViewController: StatusTableViewCellDelegate {
|
extension TimelineTableViewController: StatusTableViewCellDelegate {
|
||||||
func statusCellCollapsedStateChanged(_ cell: BaseStatusTableViewCell) {
|
func statusCellCollapsedStateChanged(_ cell: BaseStatusTableViewCell) {
|
||||||
|
if #available(iOS 16.0, *) {
|
||||||
|
} else {
|
||||||
cellHeightChanged()
|
cellHeightChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extension TimelineTableViewController: MenuActionProvider {
|
extension TimelineTableViewController: MenuActionProvider {
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,6 +163,7 @@ class DiffableTimelineLikeTableViewController<Section: Hashable & CaseIterable,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@available(iOS, deprecated: 16.0)
|
||||||
func cellHeightChanged() {
|
func cellHeightChanged() {
|
||||||
// causes the table view to recalculate the cell heights
|
// causes the table view to recalculate the cell heights
|
||||||
tableView.beginUpdates()
|
tableView.beginUpdates()
|
||||||
|
|
|
@ -12,6 +12,7 @@ import Combine
|
||||||
import AVKit
|
import AVKit
|
||||||
|
|
||||||
protocol StatusTableViewCellDelegate: TuskerNavigationDelegate, MenuActionProvider {
|
protocol StatusTableViewCellDelegate: TuskerNavigationDelegate, MenuActionProvider {
|
||||||
|
// @available(iOS, obsoleted: 16.0)
|
||||||
func statusCellCollapsedStateChanged(_ cell: BaseStatusTableViewCell)
|
func statusCellCollapsedStateChanged(_ cell: BaseStatusTableViewCell)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,8 +333,12 @@ class BaseStatusTableViewCell: UITableViewCell {
|
||||||
|
|
||||||
@IBAction func collapseButtonPressed() {
|
@IBAction func collapseButtonPressed() {
|
||||||
setCollapsed(!collapsed, animated: true)
|
setCollapsed(!collapsed, animated: true)
|
||||||
|
if #available(iOS 16.0, *) {
|
||||||
|
invalidateIntrinsicContentSize()
|
||||||
|
} else {
|
||||||
delegate?.statusCellCollapsedStateChanged(self)
|
delegate?.statusCellCollapsedStateChanged(self)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func setCollapsed(_ collapsed: Bool, animated: Bool) {
|
func setCollapsed(_ collapsed: Bool, animated: Bool) {
|
||||||
self.collapsed = collapsed
|
self.collapsed = collapsed
|
||||||
|
|
Loading…
Reference in New Issue