Skip to content

Conversation

@itsmeichigo
Copy link
Contributor

Closes WOOMOB-1851

Description

In a past project we added the support the register a single token to get push notifications for all stores. However, in the current codebase we still have some confusing logic:

  • Current site ID is sent to the network layer even though it's no longer needed to register PN tokens.
  • Unregistration requests are made when switching stores even though the same token is used for all stores.

This PR cleans up the logic:

  • Removes the redundant selected_blog_id in the request and the related param in methods to avoid confusion.
  • Removes the unregistration request when switching stores.

I'm keeping the registration request when switching stores for simplicity. It's recommended by Apple to re-register often in case tokens are invalidated remotely by Apple, and WPCom server can disregard the request if an existing token is re-registered.

Test Steps

  • Log in to a test store with a WPCom account that is connected to more than 1 stores in a physical device.
  • Put your device to sleep.
  • Place an order on the store that you're currently selecting on the app (let's call this store A). Confirm that you get notification about the new order.
  • Open the app and switch to another store (store B) and put the device back to sleep.
  • Place an order on store B. Confirm that you get notification for this order.
  • Placer another order on store A. Confirm that you get notification for this order.

Screenshots

N/A


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

@itsmeichigo itsmeichigo added this to the 23.9 milestone Dec 4, 2025
@itsmeichigo itsmeichigo added the type: task An internally driven task. label Dec 4, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 4, 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 Numberpr16434-e591de3
Version23.8
Bundle IDcom.automattic.alpha.woocommerce
Commite591de3
Installation URL6lems67uf3sdo
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@itsmeichigo itsmeichigo marked this pull request as ready for review December 4, 2025 10:40
@adborbas adborbas self-assigned this Dec 4, 2025
@adborbas
Copy link
Contributor

adborbas commented Dec 4, 2025

@itsmeichigo, how can I enable push notifications in the PR build? I seem only to receive them in the store build.

@itsmeichigo
Copy link
Contributor Author

how can I enable push notifications in the PR build? I seem only to receive them in the store build.

@adborbas I don't think the alpha build supports notifications 🤔 Can you build the app to your device in debug mode? Debug build supports notifications.

Copy link
Contributor

@adborbas adborbas left a comment

Choose a reason for hiding this comment

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

Nice, work as described!

@itsmeichigo itsmeichigo merged commit cde9d37 into trunk Dec 5, 2025
14 checks passed
@itsmeichigo itsmeichigo deleted the woomob-1851-ios-do-not-unregister-device-upon-store-switching branch December 5, 2025 07:39
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants