Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Hiding dashboard cards: add Personalize Home Tab screen #20369
Hiding dashboard cards: add Personalize Home Tab screen #20369
Changes from all commits
00ee6ce
a6eaa97
99b7f22
da4f699
2b9a082
d5b1676
e23baec
e7ef530
fb7d8d6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
not a blocker: Could a
UIButton
's text and images properties and insets simplify this by avoiding separate subviews? I'm curious about your thoughts 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.
Making
UIButton
look like this isn't easy. By default, it displays the image on the left side, and there is no (good) way to set flexible spacing for the image. I wish it was as easy to use as the SwiftUIButton
.There is a new
UIButton.Configuration
that almost gets you there, but it's iOS 15+ only.There is a way to do it with negative image/title insets, but then again, there is flexible spacing. I could use
layoutSubviews
to adjust the spacing dynamically based on the container and the title size. But it would've been over-complicated.I considered using a simple gesture recognizer for handling taps on this card, but
UIButton
has a nice highlighted state and works better for accessibility.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.
Thanks for sharing! I agree about
UIButton
image/title insets being complicated.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.
@kean Sorry for being late to the party here, but what do you think about doing something like this?
This will help us avoid not adding future cards to the personalize screen if applicable, especially for developers unaware of these new changes.
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.
I like that. The
personalizableCards
were initially defined as an array because the order was important – it didn't match the cards' order on the Dashboard. But I just confirmed late last week that it could and should match.I'm planning to generate this array based on whether the
BlogDashboardPersonalizationService
defines a key for a card:The keys are also defined using a
switch
, so the compiler will surface it to any developers adding new cards.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 will achieve the same thing I had in mind 👍
The only issue is we'll have to make
BlogDashboardPersonalizationService.makeKey
public for this reason alone. It might make more sense to movepersonalizableCards
toBlogDashboardPersonalizationService
at that point. This way, we'll have all the personalization logic in one place. Just something to think about 👍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.
My personal recommendation would be to change
makeKey()
into a computed propertyDashboardCard.personalizeKey
defined in a private extension inBlogDashboardPersonalizationService.swift
. This will enhance the verbosity of the code.And move
personalizableCards
toBlogDashboardPersonalizationService
.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.
I opened a draft PR with this change: #20466.
Makes total sense, thanks!