Automatically collapse long (> 500 chars) statuses

Closes #12
This commit is contained in:
Shadowfacts 2019-11-17 18:36:19 -05:00
parent eb8afdaab8
commit a92d9ddc6f
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 8 additions and 2 deletions

View File

@ -32,8 +32,7 @@ class GalleryViewController: UIPageViewController, UIPageViewControllerDataSourc
return true return true
} }
override var childForHomeIndicatorAutoHidden: UIViewController? { override var childForHomeIndicatorAutoHidden: UIViewController? {
return return viewControllers?.first
viewControllers?.first
} }
init(attachments: [Attachment], sourcesInfo: [LargeImageViewController.SourceInfo?], startIndex: Int) { init(attachments: [Attachment], sourcesInfo: [LargeImageViewController.SourceInfo?], startIndex: Int) {

View File

@ -152,6 +152,13 @@ class StatusTableViewCell: UITableViewCell {
setCollapsed(collapsible, animated: false) setCollapsed(collapsible, animated: false)
contentWarningLabel.text = status.spoilerText contentWarningLabel.text = status.spoilerText
contentWarningLabel.isHidden = status.spoilerText.isEmpty contentWarningLabel.isHidden = status.spoilerText.isEmpty
if !collapsed,
let text = contentLabel.text,
text.count > 500 {
collapsible = true
setCollapsed(true, animated: false)
}
let pinned = status.pinned ?? false let pinned = status.pinned ?? false
pinImageView.isHidden = !(pinned && showPinned) pinImageView.isHidden = !(pinned && showPinned)