Skip to content

Conversation

@joshheald
Copy link
Contributor

@joshheald joshheald commented May 24, 2023

Closes: #9582

Description

N.B. this follows #9801, but changes the logic and display details substantially. If you'd prefer to review both together, feel free to change the base of this PR to trunk.

We've added badges leading to Set up Tap to Pay on iPhone, for eligible devices and stores. This PR resolves the three outstanding logic issues from #9801:

  • The badges will be shown on any store or device, regardless of Tap to Pay support or previous activity.
  • After removal, the badges will return the next time you open the app.
  • Taking a Tap to Pay payment will not remove the badges

Now the badges will only be shown when you are using a supported device, an eligible store, have not previously used Tap to Pay to take a transaction, and will remember when the badges have been dismissed.

Testing instructions

Using an iPhone XS or newer on iOS 16 or above, and a US-based store with WCPay or the Stripe extension

  1. Delete then reinstall the app
  2. Open the app
  3. Observe that the badges are present on the Menu tab, and the Payments row in the menu, and the Set up Tap to Pay on iPhone row in the IPP menu
  4. Tap Set up Tap to Pay on iPhone, then tap back
  5. Observe that all the badges are gone
  6. Force quit then re-open the app
  7. Observe the badges are still gone

Using an iPhone XS or newer on iOS 16 or above, and a US-based store with WCPay or the Stripe extension

  1. Delete then reinstall the app
  2. Open the app
  3. Observe that the badges are present on the Menu tab, and the Payments row in the menu, and the Set up Tap to Pay on iPhone row in the IPP menu
  4. Tap Collect Payment and collect a payment using Tap to Pay on iPhone
  5. Observe that all the badges are gone

Using an iPhone X or older, or an iPad, or any device running iOS 15, and a US-based store with WCPay or the Stripe extension

  1. Delete then reinstall the app
  2. Open the app
  3. Observe that the badges are not present on the Menu tab, and the Payments row in the menu, and the Set up Tap to Pay on iPhone row in the IPP menu

Using an iPhone XS or newer on iOS 16 or above, and a CA or GB-based store with WCPay

  1. Delete then reinstall the app
  2. Open the app
  3. Observe that the badges are not present on the Menu tab, and the Payments row in the menu, and the Set up Tap to Pay on iPhone row in the IPP menu

Screenshots


  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@joshheald joshheald added type: enhancement A request for an enhancement. feature: mobile payments Related to mobile payments / card present payments / Woo Payments. labels May 24, 2023
@joshheald joshheald added this to the 13.8 milestone May 24, 2023
@joshheald joshheald changed the base branch from trunk to issue/9582-badge-hub-menu-to-highlight-tap-to-pay May 24, 2023 17:30
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented May 24, 2023

You can test the changes from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr9812-2eccabb on your iPhone

If you need access to App Center, please ask a maintainer to add you.

Base automatically changed from issue/9582-badge-hub-menu-to-highlight-tap-to-pay to trunk May 25, 2023 09:48
@joshheald joshheald marked this pull request as ready for review May 25, 2023 10:08
@joshheald joshheald requested a review from iamgabrielma May 25, 2023 10:08
@joshheald joshheald enabled auto-merge May 25, 2023 10:10
@iamgabrielma iamgabrielma self-assigned this May 25, 2023
Copy link
Contributor

@iamgabrielma iamgabrielma left a comment

Choose a reason for hiding this comment

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

Tests well!

✅ Using an iPhone XS or newer on iOS 16 or above, and a US-based store with WCPay or the Stripe extension
✅ Using an iPhone XS or newer on iOS 16 or above, and a US-based store with WCPay or the Stripe extension
✅ Using an iPhone X or older, or an iPad, or any device running iOS 15, and a US-based store with WCPay or the Stripe extension
✅ Using an iPhone XS or newer on iOS 16 or above, and a CA or GB-based store with WCPay

LGTM! Just shared a couple of comments that can be tackled separately, if needed.

observePlanName()
listenToNewFeatureBadgeReloadRequired()
retrieveShouldShowNewFeatureBadgeOnPaymentsValue()
tapToPayBadgePromotionChecker.$shouldShowTapToPayBadges.share().assign(to: &$shouldShowNewFeatureBadgeOnPayments)
Copy link
Contributor

Choose a reason for hiding this comment

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

💯

Should we wrap this line in a method? Sort of "bind/observe badge changes"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it is a bit wordy. I'll add this to a list to do when I have a little time.


listenToNewFeatureBadgeReloadRequired()
retrieveShouldShowNewFeatureBadgeOnHubMenuTabValue()
tapToPayBadgePromotionChecker.$shouldShowTapToPayBadges.share().assign(to: &$shouldShowNewFeatureBadgeOnHubMenuTab)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as HubMenuViewModel: Should we wrap this line in a method? Sort of "bind/observe badge changes"?


private var cancellables = Set<AnyCancellable>()

let tapToPayBadgePromotionChecker: TapToPayBadgePromotionChecker = TapToPayBadgePromotionChecker()
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps for another PR: Should we abstract this class into some PromotionChecker protocol to keep it detached from the specific TTP promotion checker? It could make sense also inject the protocol in the initializer for testability and to use this common protocol in the future for other feature announcements.


private let willPresentReviewDetailsFromPushNotification: () async -> Void

private let tapToPayBadgePromotionChecker: TapToPayBadgePromotionChecker
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as with MainTabViewModel regarding abstracting this class into a protocol, as would seem that we're leaking implementation details about the badges into the HubMenu navigation coordinator responsibility.

@joshheald joshheald merged commit dedf976 into trunk May 26, 2023
@joshheald joshheald deleted the issue/9582-only-badge-tap-to-pay-on-eligible-devices branch May 26, 2023 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: mobile payments Related to mobile payments / card present payments / Woo Payments. type: enhancement A request for an enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Mobile Payments] Badge hub menu to show that Tap to Pay exists

4 participants