diff --git a/Tusker/Extensions/StatusStateResolver.swift b/Tusker/Extensions/StatusStateResolver.swift index a51d0bb5..34f8bd8a 100644 --- a/Tusker/Extensions/StatusStateResolver.swift +++ b/Tusker/Extensions/StatusStateResolver.swift @@ -11,10 +11,10 @@ import Pachyderm extension StatusState { - func resolveFor(status: StatusMO, height: CGFloat) { + func resolveFor(status: StatusMO, height: CGFloat, textLength: Int? = nil) { let longEnoughToCollapse: Bool if Preferences.shared.collapseLongPosts, - height > 500 { + height > 500 || (textLength != nil && textLength! > 500) { longEnoughToCollapse = true } else { longEnoughToCollapse = false diff --git a/Tusker/Views/Status/BaseStatusTableViewCell.swift b/Tusker/Views/Status/BaseStatusTableViewCell.swift index a314ce89..c85c82b9 100644 --- a/Tusker/Views/Status/BaseStatusTableViewCell.swift +++ b/Tusker/Views/Status/BaseStatusTableViewCell.swift @@ -182,8 +182,8 @@ class BaseStatusTableViewCell: UITableViewCell { updateStatusIconsForPreferences(status) if state.unknown { - layoutIfNeeded() - state.resolveFor(status: status, height: contentTextView.bounds.height) + // for some reason the height here can't be computed correctly, so we fallback to the old hack of just considering raw length + state.resolveFor(status: status, height: 0, textLength: contentTextView.attributedText.length) if state.collapsible! && showStatusAutomatically { state.collapsed = false }