Skip to content

Conversation

@samiuelson
Copy link
Contributor

@samiuelson samiuelson commented Oct 24, 2025

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.

  • 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

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_cash

Images/gif

N/A

  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

@samiuelson samiuelson requested a review from Copilot October 24, 2025 07:53
Copy link
Contributor

Copilot AI left a 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.

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 24, 2025

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App NameWooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commit5f2a555
Direct Downloadwoocommerce-wear-prototype-build-pr14815-5f2a555.apk

@samiuelson samiuelson added this to the 23.6 milestone Oct 24, 2025
@samiuelson samiuelson added the type: task An internally driven task. label Oct 24, 2025
@samiuelson samiuelson requested a review from kidinov October 24, 2025 08:02
@samiuelson samiuelson marked this pull request as ready for review October 24, 2025 08:02
@samiuelson samiuelson added the type: technical debt Represents or solves tech debt of the project. label Oct 24, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 24, 2025

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App NameWooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commit5f2a555
Direct Downloadwoocommerce-prototype-build-pr14815-5f2a555.apk

@codecov-commenter
Copy link

codecov-commenter commented Oct 24, 2025

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.23%. Comparing base (ae1a066) to head (5f2a555).
⚠️ Report is 88 commits behind head on trunk.

Files with missing lines Patch % Lines
...i/woopos/cashpayment/WooPosCashPaymentViewModel.kt 0.00% 4 Missing ⚠️
...ocommerce/android/ui/woopos/root/WooPosActivity.kt 0.00% 1 Missing ⚠️
...os/root/navigation/WooPosNavigationEventHandler.kt 0.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kidinov kidinov self-assigned this Oct 28, 2025
onAmountChanged = { viewModel.onUIEvent(WooPosCashPaymentUIEvent.AmountChanged(it)) },
onCompleteOrderClicked = { viewModel.onUIEvent(WooPosCashPaymentUIEvent.CompleteOrderClicked) },
onBackClicked = { onNavigationEvent(WooPosNavigationEvent.GoBack) },
onBackClicked = {
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done: 5f2a555

Copy link
Contributor

@kidinov kidinov left a 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

@samiuelson samiuelson enabled auto-merge October 28, 2025 14:11
@samiuelson samiuelson merged commit 29b6bae into trunk Oct 28, 2025
17 checks passed
@samiuelson samiuelson deleted the woomob-1567-woo-pos-improve-analytics-tracking-in-cash-payment-screen branch October 28, 2025 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: task An internally driven task. type: technical debt Represents or solves tech debt of the project.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants