Fix favorites count button changing with when (un)faving

Closes #406
This commit is contained in:
Shadowfacts 2023-07-04 10:25:32 -07:00
parent 8f8e2a2aea
commit bcd487d311
1 changed files with 17 additions and 7 deletions

View File

@ -141,13 +141,23 @@ class ConversationMainStatusCollectionViewCell: UICollectionViewListCell, Status
$0.isPointerInteractionEnabled = true $0.isPointerInteractionEnabled = true
} }
private lazy var actionsCountHStack = UIStackView(arrangedSubviews: [ // using a UIStackView for this does not layout correctly on the first pass
reblogsCountButton, // (everything is shifted slightly to the right for some reason)
favoritesCountButton, // so do it manually, since there are only two subvviews
]).configure { private lazy var actionsCountHStack = UIView().configure {
$0.axis = .horizontal reblogsCountButton.translatesAutoresizingMaskIntoConstraints = false
$0.spacing = 8 $0.addSubview(reblogsCountButton)
$0.distribution = .fillProportionally favoritesCountButton.translatesAutoresizingMaskIntoConstraints = false
$0.addSubview(favoritesCountButton)
NSLayoutConstraint.activate([
reblogsCountButton.leadingAnchor.constraint(equalTo: $0.leadingAnchor),
reblogsCountButton.topAnchor.constraint(equalTo: $0.topAnchor),
reblogsCountButton.bottomAnchor.constraint(equalTo: $0.bottomAnchor),
favoritesCountButton.leadingAnchor.constraint(equalTo: reblogsCountButton.trailingAnchor, constant: 8),
favoritesCountButton.topAnchor.constraint(equalTo: $0.topAnchor),
favoritesCountButton.bottomAnchor.constraint(equalTo: $0.bottomAnchor),
favoritesCountButton.trailingAnchor.constraint(equalTo: $0.trailingAnchor),
])
} }
private let timestampAndClientLabel = UILabel().configure { private let timestampAndClientLabel = UILabel().configure {