[MBL-3151] Update profile page to support dynamic type#2817
Conversation
| ) | ||
| self.animateToFilledHeart() | ||
| } | ||
| self.titleLabel.numberOfLines = 0 |
There was a problem hiding this comment.
I wasn't originally planning to update the empty state, but when I saw the tests were still using the old combos I figured it was about time. This was the only change needed to make the empty state look good.
| constant: -Spacing.unit_02 | ||
| ), | ||
| self.savedIconImageView.heightAnchor.constraint(equalToConstant: 17), | ||
| self.savedIconImageView.widthAnchor.constraint(equalToConstant: 17) |
There was a problem hiding this comment.
The image/icon sizes here are pulled straight from the storyboard
| left: Styles.grid(2), | ||
| bottom: Styles.grid(1), | ||
| right: Styles.grid(2) | ||
| ) |
There was a problem hiding this comment.
I converted these to constraints instead, so I could anchor subviews directly to the container view instead of needing to anchor to layout margins
| |> UIView.lens.layer.borderWidth .~ 1.0 | ||
|
|
||
| _ = self.metadataStackView | ||
| |> UIStackView.lens.layoutMargins .~ .init(topBottom: Styles.grid(30), leftRight: Styles.grid(20)) |
There was a problem hiding this comment.
As far as I could tell, this one was ignored
|
|
||
| public enum Nib: String { | ||
| case BackerDashboardEmptyStateCell | ||
| case BackerDashboardProjectCell |
stevestreza-ksr
left a comment
There was a problem hiding this comment.
This is great, nice job!
It would be nice to pull the constants out to a struct or style object, but that's up to you.
📲 What
Update profile page to support dynamic type, primarily by deleting the BackerDashboardProjectCell storyboard and redoing the layout logic using autolayout. I'm also updating the backer dashboard view controller tests to use the new helpers, in order to easily test dynamic type behavior.
🛠 How
I considered trying to match the current UI perfectly (take a look at just commit 1 to see for yourself; I updated BackerDashboard tests as part of this commit so you can see the slight differences) but I swift does something with the layout logic that means that if I perfectly match the border of a cell to the previous version, the spacing of the next cell is off.
Instead, I intentionally updated the spacing in the cell to fit in our
Spacingunits. See commit 2 for these changes (or look at both 1 and 2 together), if you want to see the BackerDashboard screenshot differences before I updated the tests and deleted old screenshots).For the largest font sizes, the choices I made to let the cell grow were: keep the image relative to the top of the cell, and keep the metadata label relative to the bottom of the cell. This generally lets the user see both (except when project titles are really short and don't force the cell to expand). I also decided to let the metadata label use multiple lines instead of truncating; we're not wordbreaking in any kind of smart way, but I still think that's more helpful. Happy to revisit any of these decisions if other people have opinions, though!
👀 See
Jira
✅ Acceptance criteria