Fix long status table view cells not getting collapsed
This commit is contained in:
parent
07c86b6949
commit
527706154a
|
@ -11,10 +11,10 @@ import Pachyderm
|
||||||
|
|
||||||
extension StatusState {
|
extension StatusState {
|
||||||
|
|
||||||
func resolveFor(status: StatusMO, height: CGFloat) {
|
func resolveFor(status: StatusMO, height: CGFloat, textLength: Int? = nil) {
|
||||||
let longEnoughToCollapse: Bool
|
let longEnoughToCollapse: Bool
|
||||||
if Preferences.shared.collapseLongPosts,
|
if Preferences.shared.collapseLongPosts,
|
||||||
height > 500 {
|
height > 500 || (textLength != nil && textLength! > 500) {
|
||||||
longEnoughToCollapse = true
|
longEnoughToCollapse = true
|
||||||
} else {
|
} else {
|
||||||
longEnoughToCollapse = false
|
longEnoughToCollapse = false
|
||||||
|
|
|
@ -182,8 +182,8 @@ class BaseStatusTableViewCell: UITableViewCell {
|
||||||
updateStatusIconsForPreferences(status)
|
updateStatusIconsForPreferences(status)
|
||||||
|
|
||||||
if state.unknown {
|
if state.unknown {
|
||||||
layoutIfNeeded()
|
// 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: contentTextView.bounds.height)
|
state.resolveFor(status: status, height: 0, textLength: contentTextView.attributedText.length)
|
||||||
if state.collapsible! && showStatusAutomatically {
|
if state.collapsible! && showStatusAutomatically {
|
||||||
state.collapsed = false
|
state.collapsed = false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue