From b7a4f7e30f3006873cca1357c79da462a4561b02 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 8 Oct 2022 15:03:50 -0400 Subject: [PATCH] Make tapping content warning label toggle expand/collapse --- Tusker/Views/Status/StatusCollectionViewCell.swift | 2 +- Tusker/Views/Status/TimelineStatusCollectionViewCell.swift | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Tusker/Views/Status/StatusCollectionViewCell.swift b/Tusker/Views/Status/StatusCollectionViewCell.swift index d2108875..4e362e84 100644 --- a/Tusker/Views/Status/StatusCollectionViewCell.swift +++ b/Tusker/Views/Status/StatusCollectionViewCell.swift @@ -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 } diff --git a/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift b/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift index 06147d9e..2cce1e7c 100644 --- a/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift +++ b/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift @@ -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