-
Couldn't load subscription status.
- Fork 133
[Woo POS] Move analytics tracking to VM #14815
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
[Woo POS] Move analytics tracking to VM #14815
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.
Pull Request Overview
This PR refactors analytics tracking for the back navigation action in the WooPos cash payment flow by moving the tracking logic from the navigation handler to the ViewModel layer. This improves separation of concerns by keeping UI/navigation logic separate from business logic and analytics tracking.
- Removed analytics tracking from the navigation event handler
- Added analytics tracking to the ViewModel via a new
onBackClicked()method - Simplified the root screen by removing analytics tracker dependency from navigation components
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| WooPosNavigationEventHandler.kt | Removed analytics tracking logic and tracker dependency from GoBack navigation event handling |
| WooPosRootScreen.kt | Removed analytics tracker parameter from root screen composition functions |
| WooPosActivity.kt | Removed analytics tracker parameter when initializing WooPosRootScreen |
| WooPosCashPaymentViewModel.kt | Added new onBackClicked() method to handle analytics tracking for back navigation |
| WooPosCashPaymentScreen.kt | Updated back click handlers to call ViewModel's onBackClicked() method before triggering navigation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
.../src/main/kotlin/com/woocommerce/android/ui/woopos/cashpayment/WooPosCashPaymentViewModel.kt
Show resolved
Hide resolved
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
…ing-in-cash-payment-screen
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #14815 +/- ##
============================================
- Coverage 38.24% 38.23% -0.01%
+ Complexity 10087 10086 -1
============================================
Files 2131 2131
Lines 120416 120420 +4
Branches 16488 16489 +1
============================================
- Hits 46048 46047 -1
- Misses 69711 69716 +5
Partials 4657 4657 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ing-in-cash-payment-screen
| onAmountChanged = { viewModel.onUIEvent(WooPosCashPaymentUIEvent.AmountChanged(it)) }, | ||
| onCompleteOrderClicked = { viewModel.onUIEvent(WooPosCashPaymentUIEvent.CompleteOrderClicked) }, | ||
| onBackClicked = { onNavigationEvent(WooPosNavigationEvent.GoBack) }, | ||
| onBackClicked = { |
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: Shall we extract this lambda to be reused in both cases?
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.
done: 5f2a555
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.
LGMT! Just left one code improvement suggestion
WOOMOB-1567
Description
This PR refactors analytics tracking for the back navigation action in the WooPos cash payment flow by moving the tracking logic from the navigation handler to the ViewModel layer.
Test Steps
It's important to test if the analytics event is tracked correctly in the Cash screen, during back click – both on the top toolbar and the system back:
🔵 Tracked: woocommerceandroid_pos_back_to_checkout_from_cashImages/gif
N/A
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.