Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frontpage-recommendations-externalAd-layout #1371

Merged
merged 5 commits into from
Aug 15, 2024

Conversation

adriansergheev
Copy link
Collaborator

@adriansergheev adriansergheev commented Aug 15, 2024

Why?

the previous fix worked only for FinniversKit
In the actual app we still had issues from time to time due to a missing constraint

What?

reverts #1324 and fixes the actual issue

Version Change

  • minor

UI Changes

  • see snapshot tests

@adriansergheev adriansergheev force-pushed the frontpage-recommendations-layout branch from 7b87ec9 to 7f470b1 Compare August 15, 2024 10:54
@adriansergheev adriansergheev marked this pull request as ready for review August 15, 2024 10:56
@@ -176,6 +183,7 @@ public class ExternalAdRecommendationCell: UICollectionViewCell, AdRecommendatio
titleLabel.topAnchor.constraint(equalTo: subtitleLabel.bottomAnchor, constant: ExternalAdRecommendationCell.titleTopMargin),
titleLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
titleLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
titleLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

Copy link
Contributor

@ninarg ninarg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job finding the bug 🎉

let imageHeightMinimumConstraint = imageContentView.heightAnchor.constraint(equalTo: imageContentView.widthAnchor, multiplier: ExternalAdRecommendationCell.minImageAspectRatio)
let imageHeightMaximumConstraint = imageContentView.heightAnchor.constraint(lessThanOrEqualTo: imageContentView.widthAnchor, multiplier: ExternalAdRecommendationCell.maxImageAspectRatio)

imageHeightMinimumConstraint.priority = .defaultHigh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why we set these min and max height constraints, instead of setting the actual height based on image size when configuring the cell with the model 🤔 But I see we do the same in StandardAdRecommendationCell, so if it works there it should work here as well 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when we got a new report, i decided to revert my previous changes from here and attempt to fix it from scratch
then i noticed that the label had a constraint missing! added it and it seemed to make auto layout happy!
now i wonder why i did not see it last time...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome 👍 haha not easy to see this stuff 👁️

@@ -176,6 +183,7 @@ public class ExternalAdRecommendationCell: UICollectionViewCell, AdRecommendatio
titleLabel.topAnchor.constraint(equalTo: subtitleLabel.bottomAnchor, constant: ExternalAdRecommendationCell.titleTopMargin),
titleLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
titleLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
titleLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

@adriansergheev adriansergheev merged commit 9005270 into master Aug 15, 2024
1 check passed
@adriansergheev adriansergheev deleted the frontpage-recommendations-layout branch August 15, 2024 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants