Skip to content

Issue/woomob 1909 add new local feature flag for woo notifications disabled by#15157

Merged
JorgeMucientes merged 12 commits intotrunkfrom
issue/woomob-1909-add-new-local-feature-flag-for-woo-notifications-disabled-by
Jan 16, 2026
Merged

Issue/woomob 1909 add new local feature flag for woo notifications disabled by#15157
JorgeMucientes merged 12 commits intotrunkfrom
issue/woomob-1909-add-new-local-feature-flag-for-woo-notifications-disabled-by

Conversation

@JorgeMucientes
Copy link
Contributor

@JorgeMucientes JorgeMucientes commented Jan 5, 2026

Closes: WOOMOB-1909
CLoses: WOOMOB-1910

Description

This PR introduces a new feature flag for the new Woo core PN system and wires it into the existing registration logic so that, when enabled, the app uses the new PN registration endpoint instead of the WP.com one.

This PR doesn't include the changes required to display any PN sent through the new system. Neither includes any fallback strategy for cases where PN toke registration fails. That is the reason why the feature flag is disabled by default for now.
NOT included in this PRs:

  • Add fall back strategy
  • Unregister WP.com PN token if successfully registered in the new Woo core system
  • Remove PN token using the new endpoint on user log out.

Test Steps

  1. Install the .zip file version of WooCoomerce containing the new PN registration endpoint.
  2. Make a clean install of the app with the feature flag set to true.
  3. Log in using WP.com credentials
  4. Kill the app
  5. Restart it with the network inspector enabled
  6. Using network inspector verify that the new PN successfully registers

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jan 5, 2026

📲 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
Commit67b77dd
Direct Downloadwoocommerce-wear-prototype-build-pr15157-67b77dd.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jan 5, 2026

📲 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
Commit67b77dd
Direct Downloadwoocommerce-prototype-build-pr15157-67b77dd.apk

@JorgeMucientes JorgeMucientes added this to the 23.9 milestone Jan 5, 2026
@JorgeMucientes JorgeMucientes requested a review from irfano January 6, 2026 08:52
message = "Registering FCM token in Woo Core instance${if (BuildConfig.DEBUG) ": $token" else ""}"
)
selectedSite.getIfExists()?.let {
val uuid = appPrefsWrapper.wooCorePushDeviceUUID.orNullIfEmpty() ?: generateAndStoreUUID()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now we are reusing the existing logic to create the device UUID. Asked Hannah here: https://wp.me/pe5sF9-4OM#comment-5081 if the current strategy is good enough.


WOO_POS_LOCAL_CATALOG_FILE_APPROACH -> false
WOO_POS_LOCAL_CATALOG_FILE_APPROACH,
WOO_PUSH_NOTIFICATIONS_SYSTEM -> false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Disabled by default for now to avoid breaking PN for all devs until the endpoint starts working

@JorgeMucientes JorgeMucientes added unit-tests-exemption feature: notifications Related to notifications or notifs. labels Jan 6, 2026
@JorgeMucientes JorgeMucientes marked this pull request as ready for review January 6, 2026 09:21
@irfano irfano self-assigned this Jan 7, 2026
…g-for-woo-notifications-disabled-by

# Conflicts:
#	WooCommerce/src/main/kotlin/com/woocommerce/android/AppPrefs.kt
@codecov-commenter
Copy link

codecov-commenter commented Jan 8, 2026

Codecov Report

❌ Patch coverage is 21.21212% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.68%. Comparing base (0f44b09) to head (67b77dd).

Files with missing lines Patch % Lines
...d/notifications/push/PushNotificationRepository.kt 0.00% 20 Missing ⚠️
...rc/main/kotlin/com/woocommerce/android/AppPrefs.kt 0.00% 4 Missing ⚠️
...merce/android/notifications/push/RegisterDevice.kt 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #15157      +/-   ##
============================================
- Coverage     38.69%   38.68%   -0.01%     
  Complexity    10548    10548              
============================================
  Files          2192     2193       +1     
  Lines        124712   124741      +29     
  Branches      17243    17248       +5     
============================================
+ Hits          48258    48260       +2     
- Misses        71576    71602      +26     
- Partials       4878     4879       +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.

Copy link
Contributor

@irfano irfano left a comment

Choose a reason for hiding this comment

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

LGTM! I just have one question before approving: why do we need to kill and restart the app to trigger the push-tokens endpoint? Shouldn’t it be triggered right after the first login?

@wpmobilebot wpmobilebot modified the milestones: 23.9, 24.0 Jan 9, 2026
@wpmobilebot
Copy link
Collaborator

Version 23.9 has now entered code-freeze, so the milestone of this PR has been updated to 24.0.

@JorgeMucientes
Copy link
Contributor Author

JorgeMucientes commented Jan 15, 2026

LGTM! I just have one question before approving: why do we need to kill and restart the app to trigger the push-tokens endpoint? Shouldn’t it be triggered right after the first login?

So the problem is that this new enpoint requires a site to be selected first in order to register the PN token. So, on log in, by the time RegisterDevice.invoke() is called, there's no selected site yet. But this is not a big deal given PN token registration will be attempted the next time you resume the app (you don't actually have to kill the app, just send it to the background).

@JorgeMucientes JorgeMucientes requested a review from irfano January 15, 2026 19:17
Copy link
Contributor

@irfano irfano left a comment

Choose a reason for hiding this comment

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

So, on log in, by the time RegisterDevice.invoke() is called, there's no selected site yet. But this is not a big deal given PN token registration will be attempted the next time you resume the app (you don't actually have to kill the app, just send it to the background).

This is also the current behavior for the wpcom push registration, right? If so, we can keep improving it outside this project’s scope.

@JorgeMucientes
Copy link
Contributor Author

This is also the current behavior for the wpcom push registration, right? If so, we can keep improving it outside this project’s scope.

Not really @irfano. Because registering for WP.com push notifications doesn't require a site to be selected. So the device registration for WP.com system will happen right away. In any case agree we can improve this in subsequent PRs and I don't think is a big deal tbh, as soon as they resume the app from background the next time they'll get registered.

@JorgeMucientes JorgeMucientes merged commit 3030fdf into trunk Jan 16, 2026
19 checks passed
@JorgeMucientes JorgeMucientes deleted the issue/woomob-1909-add-new-local-feature-flag-for-woo-notifications-disabled-by branch January 16, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: notifications Related to notifications or notifs. unit-tests-exemption

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants