-
Notifications
You must be signed in to change notification settings - Fork 137
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
Shipping Labels Onboarding: Installation UI #6811
Conversation
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
You can test the changes on this Pull Request by downloading an installable build, or scanning this QR code: |
Codecov Report
@@ Coverage Diff @@
## trunk #6811 +/- ##
============================================
- Coverage 44.91% 44.65% -0.27%
Complexity 2966 2966
============================================
Files 533 533
Lines 29187 29359 +172
Branches 3861 3879 +18
============================================
Hits 13109 13109
- Misses 14861 15033 +172
Partials 1217 1217
Continue to review full report at Codecov.
|
It causes issues as the value is remembered beyond the scope of the step itself
This avoid restarting them on screen rotation
if (it) 0 else 120 | ||
} ?: remember { mutableStateOf(0) } | ||
|
||
private fun AnimatedVisibilityScope.PreInstallationContent(viewState: InstallationState.PreInstallation) { |
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.
Scoping the composables to AnimatedVisibilityScope
gives us access to the animateEnterExit
modifier, which is quite helpful for composing child animations, and not just relying on the AnimatedContent
animation itself.
) | ||
) { | ||
// fill equivalent space as the cross-icon | ||
Spacer(modifier = Modifier.height(dimensionResource(id = R.dimen.major_300))) |
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'm using Spacers to account for the space of the contents of other steps, this is needed to have a smooth animation where views don't jump from their positions.
If you know of a better approach, please suggest it 🙏.
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.
Hmm, setting the InstallationLoadingIndicator
at a fixed margin from the top would the the trick I guess. But then you wouldn't be able to use Spacers with weight for a better distribution of the available space. So I think this approach is perfectly fine and easy to follow with the comment indicating why the extra spacing is needed for each of the cases were you've had to add these.
step.filter { it == Installation } | ||
.first() | ||
|
||
// TODO launch plugin installation |
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.
We can here launch the installation then listen to its state to update the step
, and since step
is saved to the SavedStateHandle, a restoration after a process death for example would restart the installation if it was the step we were in before, which is what we need.
val circleColor = colorResource(id = R.color.woo_purple_20) | ||
val progressColor = colorResource(id = R.color.woo_purple_50) |
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.
Np, but maybe we should add a "semantic" color for these inside values/colors_base.xml
instead of referencing directly colors from wc_colors_base.
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'll keep the usage as is for now, as I don't have a good name to name them besides the woo_purple_...
😄.
We can always fix it later.
) | ||
) { | ||
// fill equivalent space as the cross-icon | ||
Spacer(modifier = Modifier.height(dimensionResource(id = R.dimen.major_300))) |
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.
Hmm, setting the InstallationLoadingIndicator
at a fixed margin from the top would the the trick I guess. But then you wouldn't be able to use Spacers with weight for a better distribution of the available space. So I think this approach is perfectly fine and easy to follow with the comment indicating why the extra spacing is needed for each of the cases were you've had to add these.
} | ||
|
||
@Composable | ||
private fun InstallationInfoLink(onClick: () -> Unit, modifier: Modifier = Modifier) { |
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.
Np, the modifier
param here is unused. it should be added to the Row
container.
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.
Nice catch, fixed in 619a9b7
import com.woocommerce.android.ui.shipping.InstallWCShippingViewModel.ViewState.InstallationState.PreInstallation | ||
|
||
@OptIn(ExperimentalTransitionApi::class) |
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 think you can remove this. AS states no experimental API is in use 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.
Nice catch too, I removed it, it was a leftover from the previous iteration.
Awesome job @hichamboushaba 🙌🏼 This was not an easy animation to achieve. Looks really great! |
Generated by 🚫 dangerJS |
Thanks @JorgeMucientes for the review. |
Part of: #6587
Description
This PR adds the installation UI, with the animations for the transition from the pre-install step, the changes required some refactorings, as I'm learning about Compose animation APIs, and I found out that the usage of
animateEnterExit
made the code a bit cleaner.The additional change is replacing the
cancel
button with a cross-icon as this was confirmed by the design team.NB: the installation itself is not implemented yet.
Testing instructions
You can also run the preview
PreviewInstallWCShippingScreen
if you want to jump directly into the screen.Images/gif
Screen.Recording.2022-06-27.at.19.10.16.mov
RELEASE-NOTES.txt
if necessary.