Skip to content

Conversation

iamgabrielma
Copy link
Contributor

@iamgabrielma iamgabrielma commented Oct 13, 2025

Partially closes WOOMOB-1458
Partially closes WOOMOB-1460

Description

This PR centralizes POS surveys notification eligibility and scheduling in a single PointOfSaleNotificationScheduler place, and adds the initial eligibility conditions (feature flag and country).

Testing information

The class is currently unused, in order to test:

  1. Add the following bit to EditableOrderViewModel.onCreateOrderTapped():
    func onCreateOrderTapped() {
        createOrder { [weak self] order, usesGiftCard in
            guard let self else { return }
            self.onFinished(order)
            self.trackCreateOrderSuccess(usesGiftCard: usesGiftCard)
+            Task {
+                await PointOfSaleNotificationScheduler().scheduleLocalNotificationIfEligible(for: .potentialMerchant)
+            }
        } onFailure: { [weak self] error, usesGiftCard in
            guard let self else { return }
            self.fixedNotice = NoticeFactory.createOrderErrorNotice(error, order: self.orderSynchronizer.order)
            self.trackCreateOrderFailure(usesGiftCard: usesGiftCard, error: error)
        }
        trackCreateButtonTapped()
    }
  1. Update PointOfSaleNotificationScheduler.timeIntervalInSeconds.potentialMerchant to 5 seconds or so:
        var timeIntervalInSeconds: Int {
            switch self {
            case .potentialMerchant:
-               return 60
+               return 5
  1. In a physical device, running an US or UK store, go to Orders and create an order.
  2. Observe the notification appearing.

Screenshots

2025-10-14.trigger.notification.on.order.creation.mov

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 13, 2025

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

App NameWooCommerce iOS Prototype
Build Numberpr16238-5eafca4
Version23.4
Bundle IDcom.automattic.alpha.woocommerce
Commit5eafca4
Installation URL7u3605qb0387o
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

Base automatically changed from task/WOOMOB-1459-pos-survey-notif-when-pos-mode to trunk October 13, 2025 08:21
…tionIfEligible async

scheduleLocalNotification calling a Task creates a detached task since the func itself is sync. Since is not running in the task context, this makes tests fail as they finish before the observation closure is called.
@iamgabrielma iamgabrielma marked this pull request as ready for review October 14, 2025 05:24
@iamgabrielma iamgabrielma added type: task An internally driven task. feature: POS labels Oct 14, 2025
@iamgabrielma iamgabrielma added this to the 23.5 milestone Oct 14, 2025
@iamgabrielma iamgabrielma requested a review from staskus October 14, 2025 05:28
Copy link
Contributor

@staskus staskus left a comment

Choose a reason for hiding this comment

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

✅ Nice! Tidy work 👍

}

// periphery: ignore - work in progress
final class PointOfSaleNotificationScheduler: PointOfSaleNotificationScheduling {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit; We haven't renamed everything yet, but I think we decided to call things with POS prefix

Suggested change
final class PointOfSaleNotificationScheduler: PointOfSaleNotificationScheduling {
final class POSNotificationScheduler: POSNotificationScheduling {

@iamgabrielma iamgabrielma merged commit b4147e3 into trunk Oct 15, 2025
13 checks passed
@iamgabrielma iamgabrielma deleted the task/WOOMOB-1458-pos-survey-eligibility-checker branch October 15, 2025 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: POS type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants