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

Refactor Add support for heightDp, widthDp, showBackground, backgroundColor #577

Merged
merged 18 commits into from
Dec 5, 2024

Conversation

takahirom
Copy link
Owner

No description provided.

Copy link
Contributor

@sergio-sastre sergio-sastre left a comment

Choose a reason for hiding this comment

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

@takahirom
I just left a couple of general remarks.

Feel free to address them if you find them appropriate

roborazziOptions: RoborazziOptions = RoborazziOptions(),
filePath: String,
roborazziOptions: RoborazziOptions = provideRoborazziContext().options,
applierBuilder: RoborazziComposeApplierBuilder = RoborazziComposeApplierBuilder()
Copy link
Contributor

Choose a reason for hiding this comment

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

it is true that it adds some complexity, but brings the benefit of making the api more flexible.

Therefore, I have a couple of points:

  1. We are inconsistent in the way we handle fontSize, UiMode, Locale, device...etc. vs. sized and colored.
    I think it would become much more intuitive if all of them would be handled the same way, e.g.
RoborazziComposeApplierBuilder()
   .sized(
       widthDp = previewInfo.widthDp,
       heightDp = previewInfo.heightDp
     )
     // I'd rather call this background than coloured. Both properties include background inn their names indeed. One could also call them : `show` instead of `showBackground` and `color` instead of `backgroundColor`
     .background( 
       showBackground = previewInfo.showBackground,
       backgroundColor = previewInfo.backgroundColor
     )
     .uiMode(
        configurationUiMode  = previewInfo.uiMode
     )
     .locale(
        bcp47LanguageTag = previewInfo.locale
     )
     ...

I think symmetry in code also makes it more understandable

  1. The name of this variable is a bit ambiguous. I'm not sure what to expect from this as a user of this method. I think something in the direction of previewOptions and RoborazziPreviewOptionsBuilder or composableConfigand RoborazziComposableConfigBuilder is more understandable

Copy link
Owner Author

Choose a reason for hiding this comment

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

Thank you for your review. That makes sense.
I've migrated the settings such as local to the applier and renamed the applier to config.
a899893
https://github.com/takahirom/roborazzi/pull/579/files

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good to me.
The only improvements I’d propose are input validations (e.g. fontScale should not be lower than 0 and the like) and logging messages for invalid inputs.

apart from that feel free to merge 😊

@takahirom takahirom changed the title (Check CI)Refactor Refactor Add support for heightDp, widthDp, showBackground, backgroundColor Dec 5, 2024
@takahirom takahirom merged commit 123dbe7 into main Dec 5, 2024
7 checks passed
@takahirom takahirom deleted the takahirom/refactor-plugable/2024-12-01 branch December 5, 2024 07:23
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