Make tapping content warning label toggle expand/collapse

This commit is contained in:
Shadowfacts 2022-10-08 15:03:50 -04:00
parent ba1300b1b7
commit b7a4f7e30f
2 changed files with 3 additions and 2 deletions

View File

@ -22,7 +22,7 @@ protocol StatusCollectionViewCell: UICollectionViewCell {
var displayNameLabel: EmojiLabel { get }
var usernameLabel: UILabel { get }
var contentWarningLabel: EmojiLabel { get }
var collapseButton: UIButton { get }
var collapseButton: StatusCollapseButton { get }
var contentContainer: StatusContentContainer { get }
var replyButton: UIButton { get }
var favoriteButton: UIButton { get }

View File

@ -122,10 +122,11 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
]), size: 0)
// this needs to have a higher priorty than the content container's zero height constraint
$0.setContentHuggingPriority(.defaultHigh, for: .vertical)
$0.isUserInteractionEnabled = true
$0.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(collapseButtonPressed)))
}
private(set) lazy var collapseButton = UIButton(configuration: {
private(set) lazy var collapseButton = StatusCollapseButton(configuration: {
var config = UIButton.Configuration.filled()
config.image = UIImage(systemName: "chevron.down")
return config