From a92d9ddc6f3dd00a964ae9eb8c07675b92e37c75 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 17 Nov 2019 18:36:19 -0500 Subject: [PATCH] Automatically collapse long (> 500 chars) statuses Closes #12 --- Tusker/Screens/Gallery/GalleryViewController.swift | 3 +-- Tusker/Views/Status/StatusTableViewCell.swift | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Tusker/Screens/Gallery/GalleryViewController.swift b/Tusker/Screens/Gallery/GalleryViewController.swift index 034316f5..d582d7dd 100644 --- a/Tusker/Screens/Gallery/GalleryViewController.swift +++ b/Tusker/Screens/Gallery/GalleryViewController.swift @@ -32,8 +32,7 @@ class GalleryViewController: UIPageViewController, UIPageViewControllerDataSourc return true } override var childForHomeIndicatorAutoHidden: UIViewController? { - return - viewControllers?.first + return viewControllers?.first } init(attachments: [Attachment], sourcesInfo: [LargeImageViewController.SourceInfo?], startIndex: Int) { diff --git a/Tusker/Views/Status/StatusTableViewCell.swift b/Tusker/Views/Status/StatusTableViewCell.swift index b92b801a..5f971bb9 100644 --- a/Tusker/Views/Status/StatusTableViewCell.swift +++ b/Tusker/Views/Status/StatusTableViewCell.swift @@ -152,6 +152,13 @@ class StatusTableViewCell: UITableViewCell { setCollapsed(collapsible, animated: false) contentWarningLabel.text = status.spoilerText 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 pinImageView.isHidden = !(pinned && showPinned)