-
Notifications
You must be signed in to change notification settings - Fork 38
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
Conversation
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.
@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() |
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 true that it adds some complexity, but brings the benefit of making the api more flexible.
Therefore, I have a couple of points:
- 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
- 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
andRoborazziPreviewOptionsBuilder
orcomposableConfig
andRoborazziComposableConfigBuilder
is more understandable
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.
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
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 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 😊
No description provided.