Skip to content

Conversation

@adborbas
Copy link
Contributor

@adborbas adborbas commented Feb 3, 2026

Closes WOOMOB-2128.

Description

This PR implements the WPCom connection handler that connects sites to WordPress.com and verifies plugin compatibility.

Key changes:

  • WPComConnectionSetupHandler orchestrates the connection flow using existing JetpackConnectionAction cases
  • PluginVersionChecker validates WooCommerce plugin meets minimum version (10.4.3)
  • Coordinator wires up credentials and plugin checker to the handler
  • Separated UI and logic layers via distinct Status types:
    • WPComConnectionSetupHandler.StepStatus for business logic (uses Error)
    • WPComConnectionSetupStep.Status for UI (uses localized String)
    • ViewModel maps between them with proper error localization

Test Steps

Prerequisites

  1. Enable feature flags selfDrivenPushTokenAppPasswords and selfDrivenPushToken
  2. Build and run the app on a physical device

Happy Path

  1. Log in to a store without Woo PN support using site credentials
  2. Tap the dashboard card for connecting WPCom → Continue on benefits modal
  3. Complete the WPCom login flow
  4. Verify:
    • Step 1 "Connect store to WordPress.com" runs and succeeds
    • Step 2 "Check plugin compatibility" runs and succeeds
    • "Go to My Store" button becomes enabled

Plugin Outdated

  1. Set up a store with WooCommerce version < 10.4.3
  2. Follow the same flow as above
  3. Verify:
    • Step 2 fails with version-specific error message
    • "Update plugin" primary button appears
    • "Try again" secondary button appears
    • Tapping "Update plugin" opens wp-admin plugins page

Connection Failure

  1. Simulate network failure during connection step
  2. Verify:
    • Step 1 shows failure
    • "Try again" button appears
    • Tapping "Try again" retries from the failed step

Cancel

  1. Start the setup flow
  2. Tap Cancel during any step
  3. Verify modal dismisses properly

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

@dangermattic
Copy link
Collaborator

dangermattic commented Feb 3, 2026

3 Warnings
⚠️ View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity.
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
⚠️ This PR is assigned to the milestone 24.1. This milestone is due in less than 2 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Feb 3, 2026

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 Numberpr16614-8ad6228
Version24.0
Bundle IDcom.automattic.alpha.woocommerce
Commit8ad6228
Installation URL4stcpkag0mjv8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@adborbas adborbas force-pushed the adborbas/woomob-2127-ios-add-wpcom-connection-setup-viewmodel-logic branch 2 times, most recently from 7d48d5a to 8176397 Compare February 4, 2026 09:45
Base automatically changed from adborbas/woomob-2127-ios-add-wpcom-connection-setup-viewmodel-logic to trunk February 4, 2026 10:05
adborbas and others added 2 commits February 4, 2026 11:14
- Create WPComConnectionSetupHandlerProtocol with delegate pattern for
  handler-to-viewmodel communication
- Add stub WPComConnectionSetupHandler implementation (full implementation
  in follow-up PR)
- Update WPComConnectionSetupViewModel with SetupState, button handling,
  and delegate conformance
- Wire coordinator to use the new ViewModel signature
- Add @mainactor annotations where needed for thread safety
- Add MockWPComConnectionSetupHandler for testing
- Add 9 unit tests for ViewModel behavior

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add WPComConnectionSetupHandler with full connection flow implementation
- Add PluginVersionChecker for WooCommerce plugin compatibility check
- Update coordinator to wire handler with credentials and plugin checker
- Add 3 handler tests and reorganize test structure
- Remove stub handler protocol (moved to handler file)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@adborbas adborbas force-pushed the adborbas/woomob-2128-ios-implement-wpcom-connection-handler branch from db358d4 to 8ad6228 Compare February 4, 2026 10:58
@adborbas adborbas added this to the 24.1 milestone Feb 4, 2026
@adborbas adborbas added the type: task An internally driven task. label Feb 4, 2026
- Add StepStatus enum inside WPComConnectionSetupHandler for business logic layer
- Keep WPComConnectionSetupStep.Status with String for UI layer (localized messages)
- ViewModel maps handler status to UI status with localization
- Update delegate protocol and mocks accordingly

This removes the reverse dependency from handler to UI model.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
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