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

REPLAY-1510 Button image background support #1240

Merged

Conversation

maciejburda
Copy link
Member

@maciejburda maciejburda commented Apr 10, 2023

What and why?

Adds support for image backgrounds for UIButton.

As extra we provided similar solution for any image background that's coming from UIImageView which is direct child
of _UIBarBackground which covers scenarios for UINavigationBar, UITabBar and UIToolbar.

Other considered solution was involving separate recorders, but this would introduce way more complexity.

Once we find reasons for adding separate recorders for any of the classes above we can gradually move the logic from the image generic to control specific image recorder.

How?

Solution is based on UIImageView and UIImage extensions that provide number of flags representing a state of control. These states are taken into account in recording and tinting predicate of the recorder.

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference
  • Add CHANGELOG entry for user facing changes

Custom CI job configuration (optional)

  • Run unit tests
  • Run integration tests
  • Run smoke tests

@maciejburda maciejburda requested a review from a team as a code owner April 10, 2023 15:37
@maciejburda maciejburda force-pushed the maciey/REPLAY-1510-button-image-background-support branch from 6310d8f to 05fe959 Compare April 11, 2023 10:40
Copy link
Member

@ncreated ncreated left a comment

Choose a reason for hiding this comment

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

Looks good 👍👌. No blocking feedback 👌

Once we find reasons for adding separate recorders for any of the classes above we can gradually move the logic from the image generic to control specific image recorder.

I agree - it makes sense, to find simplest solution for this moment (we don't yet know what's ahead of us).

Copy link
Member

Choose a reason for hiding this comment

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

At some point we could benefit from decomposing this snapshot into multiple ones. WDYT @maciejburda ?

Right now it is a single snapshot that lists dozen of images in different configurations. It's not obvious to me:

  • which configurations do we cover vs which not?
  • what exactly to fix if something breaks?
  • how to add new configurations to this snapshot to not override existing ones?

Same as we prefer multiple unit tests over single complex one, I believe that dividing snapshots into smaller chunks could be healthy in the long term.

Copy link
Member Author

@maciejburda maciejburda Apr 12, 2023

Choose a reason for hiding this comment

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

Yeah - perfectly valid point. I started to wonder about this as well.

I'll simplify the snapshot and some labels explaining the use cases, but in the next PR that also touches this storyboard.

@maciejburda maciejburda merged commit 2ea89d8 into develop Apr 12, 2023
@maciejburda maciejburda deleted the maciey/REPLAY-1510-button-image-background-support branch April 12, 2023 08:29
@ncreated ncreated mentioned this pull request Apr 26, 2023
6 tasks
@ncreated ncreated mentioned this pull request May 17, 2023
6 tasks
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