Skip to content

Conversation

@kidinov
Copy link
Contributor

@kidinov kidinov commented Oct 6, 2025

WOOMOB-1428

Description

This PR adds functionality to show a local push notification to potential Woo POS users after they create an order in the main WooCommerce app. The notification is shown only once per user and only for merchants in the US and UK.

The notification is shown, but click on it is not handled.

The implementation includes:

  • Created WooPosSurveysNotificationSchedular class to handle notification scheduling
  • Integrated notification trigger in OrderCreateEditViewModel after successful order creation
  • Added country restriction to limit notifications to US and UK merchants
  • Used existing notification infrastructure and preferences to track if notification was already shown

Steps to reproduce

  1. Enable the WOO_POS_SURVEYS feature flag
  2. Ensure the store country is set to US or UK
  3. Create a new order in the app
  4. Complete the order creation successfully
  5. Verify that the local notification is scheduled

Testing information

  • The notification should only be shown once per user
  • The notification should only appear for US and UK merchants
  • The notification should only be triggered when the feature flag is enabled
  • The notification should be scheduled after successful order creation, not on order creation failure

The tests that have been performed

  • Verified notification is scheduled after successful order creation
  • Verified notification is not scheduled for merchants outside US/UK
  • Verified notification respects the feature flag
  • Verified notification is only shown once using the preference flag
image
  • 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.

@kidinov kidinov changed the base branch from trunk to woomob-1411-woo-possurveys-prepare-for-sending-a-local-notification-that October 6, 2025 14:36
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 6, 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 Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commitf2ce531
Direct Downloadwoocommerce-wear-prototype-build-pr14703-f2ce531.apk

Base automatically changed from woomob-1411-woo-possurveys-prepare-for-sending-a-local-notification-that to trunk October 6, 2025 15:02
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 7, 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 Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commitf2ce531
Direct Downloadwoocommerce-prototype-build-pr14703-f2ce531.apk

@kidinov kidinov requested a review from samiuelson October 7, 2025 08:45
@kidinov kidinov added this to the 23.5 milestone Oct 7, 2025
@kidinov kidinov marked this pull request as ready for review October 7, 2025 08:46
@samiuelson samiuelson requested a review from Copilot October 7, 2025 16:39
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 adds functionality to show a local push notification to potential WooCommerce POS users after they create an order in the main WooCommerce app. The notification is shown only once per user and only for merchants in the US and UK.

  • Created WooPosSurveysNotificationSchedular class to handle notification scheduling with country restrictions
  • Integrated notification trigger in OrderCreateEditViewModel after successful order creation
  • Added feature flag WOO_POS_SURVEYS to control the notification functionality

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
WooPosSurveysNotificationSchedular.kt New scheduler class handling notification logic with country and feature flag checks
WooPosSurveysNotificationSchedularTest.kt Comprehensive test coverage for the notification scheduler
OrderCreateEditViewModel.kt Integration point to trigger notification after successful order creation
UnifiedOrderEditViewModelTest.kt Test setup updated to include the new notification scheduler dependency
FeatureFlag.kt Added WOO_POS_SURVEYS feature flag

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@samiuelson samiuelson left a comment

Choose a reason for hiding this comment

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

LGTM!

@samiuelson samiuelson enabled auto-merge October 7, 2025 16:46
@samiuelson samiuelson merged commit 83f3c17 into trunk Oct 7, 2025
15 checks passed
@samiuelson samiuelson deleted the woomob-1428-woo-possurveys-show-potential-push-notification-after-order branch October 7, 2025 17:23
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 90.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.39%. Comparing base (4a856cc) to head (f2ce531).
⚠️ Report is 19 commits behind head on trunk.

Files with missing lines Patch % Lines
...oid/ui/orders/creation/OrderCreateEditViewModel.kt 50.00% 0 Missing and 1 partial ⚠️
.../common/util/WooPosSurveysNotificationSchedular.kt 94.11% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #14703      +/-   ##
============================================
+ Coverage     38.37%   38.39%   +0.01%     
- Complexity     9855     9866      +11     
============================================
  Files          2099     2100       +1     
  Lines        117044   117064      +20     
  Branches      15657    15661       +4     
============================================
+ Hits          44913    44941      +28     
+ Misses        67964    67954      -10     
- Partials       4167     4169       +2     

☔ 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants