Fix long status table view cells not getting collapsed

This commit is contained in:
Shadowfacts 2022-11-26 17:28:55 -05:00
parent 07c86b6949
commit 527706154a
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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
}