-
Notifications
You must be signed in to change notification settings - Fork 130
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
[POS][Custom payment UI] – Payment processing animation with Lottie #13100
[POS][Custom payment UI] – Payment processing animation with Lottie #13100
Conversation
Generated by 🚫 Danger |
Project dependencies changesThe following changes in project dependencies were detected (configuration list
tree+\--- com.airbnb.android:lottie-compose:5.2.0
+ +--- com.airbnb.android:lottie:5.2.0
+ | +--- androidx.appcompat:appcompat:1.3.1 -> 1.6.1 (*)
+ | \--- com.squareup.okio:okio:1.17.4 -> 3.7.0 (*)
+ +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -> 1.9.10 (*)
+ +--- androidx.compose.foundation:foundation:1.1.1 -> 1.7.1 (*)
+ \--- androidx.compose.ui:ui:1.1.1 -> 1.7.1 (*) |
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## custom-payment-ui-6-use-payment-controller-in-pos #13100 +/- ##
=======================================================================================
- Coverage 40.45% 40.45% -0.01%
- Complexity 6217 6218 +1
=======================================================================================
Files 1295 1295
Lines 75136 75147 +11
Branches 10307 10308 +1
=======================================================================================
+ Hits 30395 30397 +2
- Misses 42088 42099 +11
+ Partials 2653 2651 -2 ☔ View full report in Codecov by Sentry. |
* given order draft created and reader connected, when payment is processed, should show processing state * given order draft created and reader connected, when payment is captured, should show processing state
@@ -260,6 +256,8 @@ class WooPosTotalsViewModel @Inject constructor( | |||
childrenToParentEventSender.sendToParent(ChildToParentEvent.PaymentFailed) | |||
} | |||
|
|||
CardReaderPaymentState.ReFetchingOrder -> Unit |
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.
💡 ReFetchingOrder
state is emitted after PaymentSuccess
state on which we show Payment success screen. ReFetchingOrder
indicates the order is synced in DB. We want to ignore it in POS.
LottieAnimation( | ||
modifier = Modifier.size(256.dp), | ||
composition = tapCardAnimation, | ||
clipSpec = LottieClipSpec.Markers("reader_awaiting_start", "reader_awaiting_end"), |
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.
💡 Marker names refer to makers[] table from woopos_card_ilustration.json
file and point to animation frames we loop animation between.
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 @samiuelson ! Looks great overall. I've left two unrelated comments that don't block merge of this PR.
The animations of the illustrations look great. We'll need to work on both the state transition (transition from one illustration to the other) and screen transitions. These both look significantly smoother on iOS. However, I guess these aren't part of this PR.
I'm leaving the merge to you since I'm not sure if this is dependant on another PR or can be merged immediatelly into [custom-payment-ui-6-use-payment-controller-in-pos](https://github.com/woocommerce/woocommerce-android/tree/custom-payment-ui-6-use-payment-controller-in-pos)
.
...merce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/totals/WooPosTotalsViewModel.kt
Outdated
Show resolved
Hide resolved
@@ -897,6 +866,72 @@ class WooPosTotalsViewModelTest { | |||
assertThat(totalState.readerStatus).isInstanceOf(WooPosTotalsViewState.ReaderStatus.ReadyForPayment::class.java) | |||
} | |||
|
|||
@Test |
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 is not an issue with this PR since this PR is consistent with the remaining unit tests. However, I think it's something we should iterate on rather sooner than later. IMO the body of each tests should contain only changes that are affecting the result of the test.
For example, for test called given order draft created and reader connected, when payment is captured, should show processing state
, the body of the test would IMO ideally prepare only order draft, reader connected, payment capture
. Everything else would be setup using a single preparation method or ideally in @Before
or similar. The current approach increases maintenance cost as well as makes it more time consuming to write additional tests.
If implementing such approach is difficult, it's in my experience usually a flag that the SUT is doing more than it should and should be split into smaller classes.
Wdyt?
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 agree. WooPosTotalsViewModelTest
got quite messy recently. I'll try to clean it up as much as possible in next PR and report an issue to team backlog if needed.
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.
Noice, thanks so much! This should definitely be a team effort considering the tests were written by all of us, so don't hesitate spliting it into tasks.
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 encountered this crash when adding a variation into the cart. I thought it was not related to this PR, so I reported it on Slack. However, it seems it works as expected on trunk
.
- Open POS
- Tap on a variable product
- Tap on a variation
- Tap on checkout
- Notice crash
FATAL EXCEPTION: main Process: com.woocommerce.android.prealpha, PID: 19229 java.lang.NullPointerException at com.woocommerce.android.ui.woopos.home.totals.WooPosTotalsRepository$createOrderWithProducts$3$2.invokeSuspend(WooPosTotalsRepository.kt:47) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111) at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:811) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:715) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:702) Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@686a376, Dispatchers.Main.immediate]
P.S. Maybe this branch is just out-of-date with Trunk and that's why it crashes?
Thanks for the review, @malinajirka. I've updated the branch with the latest trunk and verified the crash is no longer happening. I also addressed comments. Let me know what you think! |
… custom-payment-ui-payment-processing-animation
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.
Awesome, thanks for the follow ups! LGTM 🙇
e9d9360
into
custom-payment-ui-6-use-payment-controller-in-pos
Animated payment states with Lottie
Closes: #13068
Closes: #12826
Description
This PR adds animations for payment states:
See the video below.
Decision on introducing Lottie: p1733860533372109-slack-C070SJRA8DP
Steps to reproduce
Testing information
Design specs: TfaZ4LUkEwEGrxfnEFzvJj-fi-2710_118241
Animation specs: p6riRB-aNq-p2
The tests that have been performed
I tested the payment collection in POS and tried tuning up the animation to match specs as much as possible in reasonable time constraints.
Images/gif
Screen_recording_20241211_154058.mp4
RELEASE-NOTES.txt
if necessary. Use the "[Internal]" label for non-user-facing changes.Reviewer (or Author, in the case of optional code reviews):
Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement: