Skip to content

Comments

[Push Notifications] Check Jetpack connection status on Continue tap#15400

Open
hichamboushaba wants to merge 12 commits intotrunkfrom
issue/WOOMOB-2270-jetpack-status
Open

[Push Notifications] Check Jetpack connection status on Continue tap#15400
hichamboushaba wants to merge 12 commits intotrunkfrom
issue/WOOMOB-2270-jetpack-status

Conversation

@hichamboushaba
Copy link
Member

@hichamboushaba hichamboushaba commented Feb 20, 2026

Closes WOOMOB-2270

Note

  • Sorry for the size of the PR, the big part of the changes are Compose code and tests, I couldn't split it further.
  • The text still mentions WordPress.com account, I didn't want to modify it in this PR, I'll update the wording in the PR that removes the login flow.
  • We don't have designs for the error screen, so I just used a generic error for now, we can update it if needed later.
  • We don't pass connection status to the steps screen yet, I'll handle that in a separate PR.

Description

Check Jetpack connection status and WooCommerce version on the push notifications introduction screen to determine what to show the user.

Fetching happens on screen open , with a skeleton shimmer shown while loading. The ViewState is modeled as a sealed interface with five variants:

  1. Loading → skeleton shimmer placeholder
  2. NotConnected (site not registered / unknown) → intro screen with "Continue" button → WPCom login
  3. UpdateRequired (connected, WC version incompatible) → "Update plugin" screen → connection steps
  4. GenericError (connected + WC compatible, or fetch failure) → error screen with "Contact Support"
  5. ForbiddenError (403) → error explaining the user needs to ask their store admin

A site is considered "connected" if it has site level connection with Jetpack, this matches: the Jetpack status is AccountConnected or AccountNotConnected with JetpackSiteRegistrationStatus.REGISTERED.

I also added a close button to the dialog.

Test Steps

Requirements

  • Enable the PN M2 feature flag.
  • Sign in using site credentials.

Jetpack not connected

  1. Open the app
  2. Tap on the Push Notification setup card in the dashboard.
  3. Confirm the intro dialog shows the connection information.

Jetpack Connected and Woo outdated

  1. Connect your site to Jetpack.
  2. Make sure you have a Woo version less than PUSH_NOTIFICATIONS_MIN_WC_VERSION (set to 10.6.0 for now)
  3. Tap on the Push Notification setup card in the dashboard.
  4. Confirm the intro dialog shows the plugin update content.

Jetpack Connected and Woo up-to-date

  1. Connect your site to Jetpack.
  2. Modify PUSH_NOTIFICATIONS_MIN_WC_VERSION to be lower than your current plugin version.
  3. Tap on the Push Notification setup card in the dashboard.
  4. Confirm the intro dialog shows the error screen.

No permissions for checking Jetpack status

  1. Sign in using a Shop Manager account.
  2. Tap on the Push Notification setup card in the dashboard.
  3. Confirm the intro dialog shows the forbidden error screen.

Images/gif

Screenshot_20260220_144906 Screenshot_20260220_144827 Screenshot_20260220_144651 Screenshot_20260220_145013
  • 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.

@dangermattic
Copy link
Collaborator

dangermattic commented Feb 20, 2026

1 Error
🚫 PR is not assigned to a milestone.
1 Warning
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

@hichamboushaba hichamboushaba force-pushed the issue/WOOMOB-2270-jetpack-status branch 5 times, most recently from ce5d1c6 to 6e4d16b Compare February 20, 2026 15:11
@hichamboushaba hichamboushaba added type: enhancement A request for an enhancement. feature: notifications Related to notifications or notifs. labels Feb 20, 2026
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

Adds connection/version gating to the Push Notifications introduction dialog by fetching Jetpack connection status and active WooCommerce plugin version on screen open, then rendering different UI states (loading, not connected, update required, forbidden, generic error) and wiring navigation/actions accordingly.

Changes:

  • Introduces ViewState + fetch logic in WooPushNotificationsIntroductionViewModel to determine what the intro dialog should show.
  • Refactors the Compose intro UI into state-driven content (loading skeleton, intro/update, error variants) and adds a close button.
  • Adds/updates unit tests and string resources for the new states and CTAs.

Reviewed changes

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

Show a summary per file
File Description
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/pushnotifications/introduction/WooPushNotificationsIntroductionViewModel.kt Adds state machine + Jetpack/Woo version checks + new events.
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/pushnotifications/introduction/WooPushNotificationsIntroductionScreen.kt Updates Compose UI to render based on ViewState, adds loading skeleton + error UI + top bar close.
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/pushnotifications/introduction/WooPushNotificationsIntroductionDialog.kt Hooks Compose screen to the ViewModel and handles new navigation/help events.
WooCommerce/src/main/kotlin/com/woocommerce/android/model/JetpackStatus.kt Adds isSiteConnected convenience property for site-level Jetpack connection interpretation.
WooCommerce/src/main/res/values/strings.xml Adds new strings for error/update-required variants and CTAs.
WooCommerce/src/test/kotlin/com/woocommerce/android/ui/pushnotifications/introduction/WooPushNotificationsIntroductionViewModelTest.kt Adds coverage for the new view states and events.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hichamboushaba hichamboushaba force-pushed the issue/WOOMOB-2270-jetpack-status branch 2 times, most recently from 46bceb4 to a68e831 Compare February 20, 2026 15:50
Add connection check logic to the introduction ViewModel:
- Fetch Jetpack status and WC plugin version on Continue
- Route to WPCom login if site is not registered
- Route to connection steps if WC version is incompatible
- Show error state if WC version is compatible or fetch fails
- Show forbidden error if user lacks permissions (403)
- Treat site as connected if AccountConnected or REGISTERED
- Show loading spinner in Continue button during connection check
- Add error state with icon, title, and body text
- Show forbidden-specific message for 403 errors
- Wire up ViewState observation and new navigation events
- Handle NavigateToConnectionSteps and NavigateToHelpScreen
Cover all routing scenarios: site not registered, unknown status,
site registered with incompatible/compatible/null WC version,
fetch failure, connection forbidden, and contact support click.
Move Jetpack status fetch from onContinueClick to init block so the
screen loads data on open. Replace ViewState data class and ErrorType
enum with a sealed interface (Loading, NotConnected, UpdateRequired,
ForbiddenError, GenericError). Simplify onContinueClick to only
trigger navigation and add onUpdatePluginClick handler.
Add LoadingContent with skeleton shimmer, UpdateRequiredContent with
update plugin CTA, and refactor screen to use when over sealed
ViewState. Simplify IntroContent and ErrorContent signatures. Add
three new strings for the update-required state.
Set up mocks before ViewModel creation so init fetch runs with the
correct stubs. Assert ViewState sealed variants instead of events for
status tests. Add onUpdatePluginClick event test.
@hichamboushaba hichamboushaba force-pushed the issue/WOOMOB-2270-jetpack-status branch from a68e831 to 74c5df4 Compare February 20, 2026 15:54
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Feb 20, 2026

App Icon📲 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
Build Number728
Version24.1
Application IDcom.woocommerce.android.prealpha
Commitcb34af4
Installation URL57gf7pavht078
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@hichamboushaba hichamboushaba force-pushed the issue/WOOMOB-2270-jetpack-status branch from 74c5df4 to cb34af4 Compare February 20, 2026 16:49
Comment on lines +70 to +81
private suspend fun checkWCVersion() {
val wcVersion = fetchActiveWCPluginVersion() ?: run {
_viewState.value = ViewState.GenericError
return
}

if (wcVersion.isVersionAtLeast(PUSH_NOTIFICATIONS_MIN_WC_VERSION)) {
_viewState.value = ViewState.GenericError
} else {
_viewState.value = ViewState.UpdateRequired
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This logic should be extracted somewhere else to be reusable for the setup screen too, we can handle this when working on plugin update task.

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. type: enhancement A request for an enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants