From ea07e6aef6452b83d90bbfc47e6a03584a46df41 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 11 Jul 2022 14:42:49 -0400 Subject: [PATCH] Simplify timeline status cell layout, fix due to missing constraint Fixes crash when re-showing timeline actions after being hidden --- .../Status/TimelineStatusTableViewCell.swift | 19 +-- .../Status/TimelineStatusTableViewCell.xib | 154 +++++++++--------- 2 files changed, 85 insertions(+), 88 deletions(-) diff --git a/Tusker/Views/Status/TimelineStatusTableViewCell.swift b/Tusker/Views/Status/TimelineStatusTableViewCell.swift index a4279252..8114c789 100644 --- a/Tusker/Views/Status/TimelineStatusTableViewCell.swift +++ b/Tusker/Views/Status/TimelineStatusTableViewCell.swift @@ -20,6 +20,7 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell { }() @IBOutlet weak var reblogLabel: EmojiLabel! + @IBOutlet weak var reblogSpacer: UIView! @IBOutlet weak var timestampLabel: UILabel! @IBOutlet weak var pinImageView: UIImageView! @IBOutlet weak var actionsContainerView: UIView! @@ -82,6 +83,7 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell { reblogStatusID = statusID rebloggerID = status.account.id reblogLabel.isHidden = false + reblogSpacer.isHidden = false updateRebloggerLabel(reblogger: status.account) status = rebloggedStatus @@ -91,6 +93,7 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell { reblogStatusID = nil rebloggerID = nil reblogLabel.isHidden = true + reblogSpacer.isHidden = true } super.doUpdateUI(status: status, state: state) @@ -131,8 +134,12 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell { let oldState = actionsContainerView.isHidden if oldState != Preferences.shared.hideActionsInTimeline { updateActionsVisibility() - // not really accurate, but it notifies the vc our height has changed - delegate?.statusCellCollapsedStateChanged(self) + if #available(iOS 16.0, *) { + invalidateIntrinsicContentSize() + } else { + // not really accurate, but it notifies the vc our height has changed + delegate?.statusCellCollapsedStateChanged(self) + } } super.updateStatusIconsForPreferences(status) @@ -141,16 +148,8 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell { private func updateActionsVisibility() { if Preferences.shared.hideActionsInTimeline { actionsContainerView.isHidden = true - actionsContainerHeightConstraint.isActive = false - verticalStackToSuperviewConstraint.isActive = true - verticalStackToActionsContainerConstraint.isActive = false } else { actionsContainerView.isHidden = false - // sometimes this constraint is nil for reasons i can't discern - // not re-activating in that case doesn't seem to make a difference - actionsContainerHeightConstraint?.isActive = true - verticalStackToSuperviewConstraint.isActive = false - verticalStackToActionsContainerConstraint.isActive = true } } diff --git a/Tusker/Views/Status/TimelineStatusTableViewCell.xib b/Tusker/Views/Status/TimelineStatusTableViewCell.xib index 6e1bc080..02b9dc71 100644 --- a/Tusker/Views/Status/TimelineStatusTableViewCell.xib +++ b/Tusker/Views/Status/TimelineStatusTableViewCell.xib @@ -1,9 +1,9 @@ - + - + @@ -15,17 +15,24 @@ - + + + + + + + + - + @@ -109,36 +116,30 @@ - + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. - + - @@ -148,78 +149,18 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - @@ -230,6 +171,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -262,10 +260,10 @@ + -