Merge pull request #792 from j-f1/hide-empty-status-text

Hide post contentMetaText when it is empty
This commit is contained in:
Nathan Mattes 2022-12-21 20:58:36 +01:00 committed by GitHub
commit c85e503a71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -312,16 +312,18 @@ extension StatusView.ViewModel {
}
statusView.contentMetaText.paragraphStyle = paragraphStyle
if let content = content {
if let content = content, !(content.string.isEmpty && content.entities.isEmpty) {
statusView.contentMetaText.configure(
content: content
)
statusView.contentMetaText.textView.accessibilityTraits = [.staticText]
statusView.contentMetaText.textView.accessibilityElementsHidden = false
statusView.contentMetaText.textView.isHidden = false
} else {
statusView.contentMetaText.reset()
statusView.contentMetaText.textView.accessibilityLabel = ""
statusView.contentMetaText.textView.isHidden = true
}
statusView.contentMetaText.textView.alpha = isContentReveal ? 1 : 0 // keep the frame size and only display when revealing