Skip to content

Commit

Permalink
Disable content constraints above large text
Browse files Browse the repository at this point in the history
  • Loading branch information
wargcm committed May 16, 2024
1 parent 9a87518 commit 6c2efd1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions WordPress/Classes/ViewRelated/Reader/ReaderTagCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class ReaderTagCell: UICollectionViewCell {
@IBOutlet weak var spacerView: UIView!
@IBOutlet weak var titleSpacerView: UIView!
@IBOutlet weak var countsLabelSpacerView: UIView!
@IBOutlet private var contentBoundsConstraints: [NSLayoutConstraint]!

private lazy var imageLoader = ImageLoader(imageView: featuredImageView)
private var viewModel: ReaderTagCellViewModel?
Expand All @@ -31,12 +32,15 @@ class ReaderTagCell: UICollectionViewCell {
spacerView.isGhostableDisabled = true
titleSpacerView.isGhostableDisabled = true
countsLabelSpacerView.isGhostableDisabled = true

updateContentConstraints()
}

override func prepareForReuse() {
super.prepareForReuse()
imageLoader.prepareForReuse()
resetHiddenViews()
updateContentConstraints()
}

func configure(parent: UIViewController?, post: ReaderPost, isLoggedIn: Bool) {
Expand Down Expand Up @@ -144,6 +148,11 @@ private extension ReaderTagCell {
menuButton.accessibilityHint = AccessibilityConstants.menuButtonHint
}

func updateContentConstraints() {
let isExtraLargeCategory = traitCollection.preferredContentSizeCategory >= .extraLarge
contentBoundsConstraints.forEach { $0.isActive = !isExtraLargeCategory }
}

}

extension ReaderTagCell: GhostableView {
Expand Down
4 changes: 4 additions & 0 deletions WordPress/Classes/ViewRelated/Reader/ReaderTagCell.xib
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@
<outlet property="summaryLabel" destination="5KT-0Z-POw" id="v2C-Gu-Vcs"/>
<outlet property="titleLabel" destination="DsY-TC-klp" id="Qc5-Ye-hs2"/>
<outlet property="titleSpacerView" destination="pBB-XH-eiv" id="b5m-pu-5kl"/>
<outletCollection property="contentBoundsConstraints" destination="4E1-8Q-Umk" collectionClass="NSMutableArray" id="w51-J3-YwH"/>
<outletCollection property="contentBoundsConstraints" destination="XP1-dF-ShA" collectionClass="NSMutableArray" id="SeC-ny-f9t"/>
<outletCollection property="contentBoundsConstraints" destination="5Us-VT-zN0" collectionClass="NSMutableArray" id="V6S-Lu-3RC"/>
<outletCollection property="contentBoundsConstraints" destination="CNx-el-qmz" collectionClass="NSMutableArray" id="2xj-id-88q"/>
</connections>
<point key="canvasLocation" x="-131.29770992366412" y="-168.3098591549296"/>
</view>
Expand Down

0 comments on commit 6c2efd1

Please sign in to comment.