Skip to content

Conversation

@wzieba
Copy link
Contributor

@wzieba wzieba commented Jan 9, 2026

Description

Test Steps

Images/gif

  • 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.

wzieba added 2 commits January 9, 2026 13:15
And all associated methods, to simplify and clean codebase before database migration.
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

📲 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
Commit795dad4
Direct Downloadwoocommerce-wear-prototype-build-pr15178-795dad4.apk

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

This PR removes the legacy MediaXMLRPCClient implementation and all XMLRPC-related media handling code, consolidating media operations to use only the WPComV2 REST API and Application Passwords REST clients.

Key Changes:

  • Removed MediaXMLRPCClient and XmlrpcUploadRequestBody classes entirely
  • Removed XMLRPC fallback paths in MediaStore for upload, fetch, and cancel operations
  • Removed obsolete media error types (FS_READ_PERMISSION_DENIED, DB_QUERY_FAILURE, XMLRPC_OPERATION_NOT_ALLOWED, etc.)
  • Removed unused media actions (FETCH_MEDIA, UPDATE_MEDIA, FETCHED_MEDIA)
  • Simplified updateMedia method by removing error handling and event emission logic

Reviewed changes

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

Show a summary per file
File Description
MediaXMLRPCClient.java Deleted entire XMLRPC client implementation (~614 lines)
XmlrpcUploadRequestBody.java Deleted XMLRPC-specific upload request body class (~133 lines)
MediaStore.java Removed XMLRPC client dependency, removed fallback paths for XMLRPC sites, removed obsolete error types, simplified updateMedia method
UploadStore.java Removed UPDATE_MEDIA action handling and unused imports
MediaAction.java Removed FETCH_MEDIA and UPDATE_MEDIA action definitions
BaseWPV2MediaRestClient.kt Removed unused public fetchMedia method
MediaStoreTest.java Removed mock MediaXMLRPCClient dependency from test

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

mWPComV2MediaRestClient.uploadMedia(payload.site, payload.media);
} else if (payload.site.getOrigin() == SiteModel.ORIGIN_WPAPI
&& mApplicationPasswordsConfiguration.isEnabledForDirectAccess()) {
mApplicationPasswordsMediaRestClient.uploadMedia(payload.site, payload.media);
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

After removing the XMLRPC client fallback, sites with SiteModel.ORIGIN_XMLRPC will silently fail when attempting to upload media. The method sets the upload state to UPLOADING but never calls any upload client, leaving the media in a stuck uploading state. Consider either adding an explicit error for unsupported site origins or documenting that XMLRPC sites are no longer supported for media operations.

Suggested change
mApplicationPasswordsMediaRestClient.uploadMedia(payload.site, payload.media);
mApplicationPasswordsMediaRestClient.uploadMedia(payload.site, payload.media);
} else {
String message = String.format(
Locale.US,
"Media upload not supported for site origin: %d",
payload.site.getOrigin()
);
AppLog.e(AppLog.T.MEDIA, message);
payload.media.setUploadState(MediaUploadState.FAILED);
MediaSqlUtils.insertOrUpdateMedia(payload.media);

Copilot uses AI. Check for mistakes.
mWPComV2MediaRestClient.fetchMediaList(payload.site, payload.number, offset, payload.mimeType);
} else if (payload.site.getOrigin() == SiteModel.ORIGIN_WPAPI
&& mApplicationPasswordsConfiguration.isEnabledForDirectAccess()) {
mApplicationPasswordsMediaRestClient.fetchMediaList(payload.site, payload.number, offset, payload.mimeType);
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

After removing the XMLRPC client fallback, sites with SiteModel.ORIGIN_XMLRPC will silently fail when attempting to fetch media lists. The method never calls any fetch client for these sites, resulting in no data being returned and no error being raised. Consider either adding an explicit error for unsupported site origins or documenting that XMLRPC sites are no longer supported for media operations.

Suggested change
mApplicationPasswordsMediaRestClient.fetchMediaList(payload.site, payload.number, offset, payload.mimeType);
mApplicationPasswordsMediaRestClient.fetchMediaList(payload.site, payload.number, offset, payload.mimeType);
} else {
String message = String.format(
Locale.ENGLISH,
"Unsupported site origin (%d) or configuration for fetching media list",
payload.site.getOrigin()
);
AppLog.e(AppLog.T.MEDIA, message);
throw new IllegalStateException(message);

Copilot uses AI. Check for mistakes.
mWPComV2MediaRestClient.cancelUpload(media);
} else if (payload.site.getOrigin() == SiteModel.ORIGIN_WPAPI
&& mApplicationPasswordsConfiguration.isEnabledForDirectAccess()) {
mApplicationPasswordsMediaRestClient.cancelUpload(media);
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

After removing the XMLRPC client fallback, sites with SiteModel.ORIGIN_XMLRPC will silently fail when attempting to cancel media uploads. The method updates the local state but never calls any client to cancel the upload on the server. Consider either adding an explicit error for unsupported site origins or documenting that XMLRPC sites are no longer supported for media operations.

Suggested change
mApplicationPasswordsMediaRestClient.cancelUpload(media);
mApplicationPasswordsMediaRestClient.cancelUpload(media);
} else {
// Explicitly log unsupported origins (e.g., XMLRPC) so cancel does not fail silently
AppLog.w(AppLog.T.MEDIA, String.format(
Locale.US,
"Cancel upload not supported for site origin %d; local state updated only",
payload.site.getOrigin()
));

Copilot uses AI. Check for mistakes.
@wpmobilebot
Copy link
Collaborator

📲 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
Commit795dad4
Direct Downloadwoocommerce-prototype-build-pr15178-795dad4.apk

@wpmobilebot
Copy link
Collaborator

🤖 Build Failure Analysis

This build has failures. Claude has analyzed them - check the build annotations for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants