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
Commitcfcb961
Direct Downloadwoocommerce-wear-prototype-build-pr14815-cfcb961.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

📲 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
Commitcfcb961
Direct Downloadwoocommerce-prototype-build-pr14815-cfcb961.apk

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.23%. Comparing base (27b6bed) to head (cfcb961).
⚠️ Report is 2 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.23%   38.23%   -0.01%     
- Complexity    10085    10086       +1     
============================================
  Files          2129     2129              
  Lines        120421   120425       +4     
  Branches      16489    16490       +1     
============================================
+ Hits          46047    46048       +1     
- Misses        69718    69722       +4     
+ Partials       4656     4655       -1     

☔ 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.

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.

3 participants