-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Remove Rewards Collection View Custom Centering Behavior #793
Conversation
@@ -161,8 +161,7 @@ final class PledgeCTAContainerView: UIView { | |||
self.activityIndicator.centerXAnchor.constraint(equalTo: self.layoutMarginsGuide.centerXAnchor), | |||
self.activityIndicator.centerYAnchor.constraint(equalTo: self.layoutMarginsGuide.centerYAnchor), | |||
self.pledgeCTAButton.heightAnchor.constraint(greaterThanOrEqualToConstant: Layout.Button.minHeight), | |||
self.pledgeCTAButton.widthAnchor.constraint(greaterThanOrEqualToConstant: Layout.Button.minWidth), | |||
self.rootStackView.topAnchor.constraint(equalTo: self.layoutMarginsGuide.topAnchor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This constraint was causing warnings because it conflicts with the constraints applied here:
ed6c895
to
a4626a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good...we'll be able to provide functionality without weird hacks :)
I've noticed that we no longer use ksr_insertSubviewInParent
, we should probably remove it (for one it's super trivial to add it back and we'll clean up the codebase).
super.viewWillTransition(to: size, with: coordinator) | ||
|
||
self.flowLayout?.invalidateLayout() | ||
if itemSize != layout.itemSize { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to compare the sizes? Trying to understand what's going on in here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is. Basically during one of the layout passes, the adjustedContentInsets
change, and our itemSize
depends on those contentInset
values. In order to make sure the itemSize
has all the update-to-date values (and so that it's the right height), we need to do this check.
Kickstarter-iOS/Views/Controllers/RewardsCollectionViewController.swift
Outdated
Show resolved
Hide resolved
extension RewardsCollectionViewController { | ||
override func scrollViewDidScroll(_ scrollView: UIScrollView) { | ||
self.collectionView.visibleCells.compactMap { $0 as? RewardCell }.forEach { | ||
$0.cancelDepress() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is cancelDepress
still being used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh good catch. Hmm @justinswart can you describe the effect of this? I'm not seeing any issues when removing it, the "depress" action seems to cancel when you lift up your finger.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was for when you begin dragging the carousel, Danny wanted the card to lift again as you pan. I was mostly indifferent about it.
self.pledgeButton.rac.hidden = self.viewModel.outputs.pledgeButtonHidden | ||
self.gradientView.rac.hidden = self.viewModel.outputs.gradientHidden |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In regards to consistency should this signal be named gradientViewHidden
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Looks like @justinswart is OK with removing the
cancelDepress
action -
Did you see my question about
ksr_insertSubviewInParent
or was it missed on the conversation tab? -
Just noticed something weird that I wanted to double check...are we aware of the fact that
hiddenPledgeHiddenConstraints
(basically a getter for the array of constraints) causes a side effect by callingself.addBottomViewsMarginConstraints(with: self.layoutMarginsGuide)
?
Cc @Scollaco since he seems to be the author of this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢 🚢 🚢
🚢 🚢 🚢
🚢 🚢 🚢
📲 What
This PR removes our custom "hidden scroll view" implementation of the cell-centering behavior and replaces it with
UIScrollView
s out-of-the-box free-scrolling behavior.🤔 Why
To simplify rewards browsing for the first release of this redesign.
🛠 How
UIScrollView
UIScrollViewDelegate
implementation👀 See
✅ Acceptance criteria