[Push Notifications] Check Jetpack connection status on Continue tap#15400
[Push Notifications] Check Jetpack connection status on Continue tap#15400hichamboushaba wants to merge 12 commits intotrunkfrom
Conversation
Generated by 🚫 Danger |
ce5d1c6 to
6e4d16b
Compare
There was a problem hiding this comment.
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 inWooPushNotificationsIntroductionViewModelto 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.
...merce/android/ui/pushnotifications/introduction/WooPushNotificationsIntroductionViewModel.kt
Show resolved
Hide resolved
...merce/android/ui/pushnotifications/introduction/WooPushNotificationsIntroductionViewModel.kt
Outdated
Show resolved
Hide resolved
...merce/android/ui/pushnotifications/introduction/WooPushNotificationsIntroductionViewModel.kt
Show resolved
Hide resolved
...commerce/android/ui/pushnotifications/introduction/WooPushNotificationsIntroductionScreen.kt
Show resolved
Hide resolved
...e/android/ui/pushnotifications/introduction/WooPushNotificationsIntroductionViewModelTest.kt
Show resolved
Hide resolved
46bceb4 to
a68e831
Compare
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.
a68e831 to
74c5df4
Compare
|
|
74c5df4 to
cb34af4
Compare
| 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 | ||
| } | ||
| } |
There was a problem hiding this comment.
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.

Closes WOOMOB-2270
Note
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
ViewStateis modeled as a sealed interface with five variants:A site is considered "connected" if it has site level connection with Jetpack, this matches: the Jetpack status is
AccountConnectedorAccountNotConnectedwithJetpackSiteRegistrationStatus.REGISTERED.I also added a close button to the dialog.
Test Steps
Requirements
Jetpack not connected
Jetpack Connected and Woo outdated
PUSH_NOTIFICATIONS_MIN_WC_VERSION(set to 10.6.0 for now)Jetpack Connected and Woo up-to-date
PUSH_NOTIFICATIONS_MIN_WC_VERSIONto be lower than your current plugin version.No permissions for checking Jetpack status
Images/gif
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.