Skip to content

Conversation

@nbradbury
Copy link
Contributor

@nbradbury nbradbury commented Jan 22, 2026

As part of CMM-1037, this PR updates the empty view for the scan and scan history fragments by removing the outdated images and shortening the message text.

Note: The scan feature is only available for Jetpack sites that have paid for the Scan feature.

Summary

  • Removed image from ScanFragment empty view error states
  • Shortened error message strings for better readability
  • Cleaned up unused image-related properties from ScanViewModel ErrorUiState

Test plan

  1. Open a Jetpack site and tap Scan on My Site
    • Verify empty view eventually displays correctly without image
    • Verify title and subtitle text are readable
    • Verify action button works correctly
    • Tap History at the top right and verify the error message doesn't show an image

Before and after

before

@dangermattic
Copy link
Collaborator

dangermattic commented Jan 22, 2026

1 Warning
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@nbradbury
Copy link
Contributor Author

@claude Ignore the TODO

The image and imageColorResId properties were removed from ErrorUiState,
so the corresponding test assertions need to be removed as well.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@claude
Copy link
Contributor

claude bot commented Jan 22, 2026

Claude finished @nbradbury's task in 1m 13s —— View job


Code Review Complete ✅

I've reviewed this PR (ignoring the TODO as requested) and found the implementation to be clean and well-executed. The changes successfully remove the image from error states while maintaining all functionality and test coverage.


Summary

This PR removes images from ScanFragment empty/error views and shortens error message strings. The implementation is solid with proper cleanup across all layers.

Detailed Review

Code Quality - Excellent

ScanFragment.kt:

  • Cleanly removed image-related code from updateErrorLayout()
  • Removed unused ColorUtils import
  • Minor lambda syntax improvements (removed unnecessary parentheses) which improve readability
  • The cast (uiState as ErrorUiState) is now unnecessary on line 112 since the type is already known from the when clause - could be simplified

ScanViewModel.kt:

  • Properly removed image and imageColorResId properties from all ErrorUiState subclasses
  • Removed unused annotation imports (@DrawableRes, @ColorRes)
  • All error states remain properly structured with title, subtitle, buttonText, and action properties

Layout XML:

  • Simple removal of app:aevImage attribute from ActionableEmptyView

Strings.xml:

  • String edits are concise and improve readability:
    • scan_request_failed_subtitle: Changed from generic @string/request_failed_message reference to specific "Failed to start the scan"
    • scan_start_request_failed_subtitle: Removed verbose guidance about contacting support, simplified to just "Please check to see if your site is down."
    • scan_multisite_not_supported_subtitle: Removed "at this time" phrase for brevity

Security - No Issues

No security concerns. The changes are purely UI-related and don't affect:

  • Authentication/authorization
  • Input validation
  • Data handling
  • Network requests

Performance - No Impact

Positive performance impact:

  • Reduced memory usage (no image resources loaded)
  • Slightly faster view rendering
  • Smaller view hierarchy

Testing - Comprehensive

ScanViewModelTest.kt:

  • All image-related assertions properly removed from 6 test cases
  • Tests remain comprehensive, verifying all error state properties (title, subtitle, buttonText)
  • No test coverage gaps introduced
  • Test changes mirror production code changes perfectly

Documentation - Adequate

PR description clearly explains the changes. No additional documentation needed for this UI change.


Minor Suggestions (Non-blocking)

  1. ScanFragment.kt:112 - The cast (uiState as ErrorUiState) is redundant since the when clause already narrows the type. Could be simplified to just uiState:

    is ErrorUiState.NoConnection,
    is ErrorUiState.GenericRequestFailed,
    is ErrorUiState.ScanRequestFailed,
    is ErrorUiState.MultisiteNotSupported,
    is ErrorUiState.VaultPressActiveOnSite -> updateErrorLayout(uiState)  // Cast not needed
  2. String changes - While the shortened strings are more concise, consider:

    • scan_request_failed_subtitle: "Failed to start the scan" could add context about why (e.g., "Failed to start the scan. Please try again.")
    • scan_start_request_failed_subtitle: Removing the support contact info might reduce user guidance - but this may be intentional for brevity

Verdict

✅ Approved - Ready to merge (once the TODO mentioned in the PR description is addressed)

The implementation is clean, well-tested, and follows all coding standards. The removal of images and string simplifications achieve the stated goals without introducing any issues.


| Branch: issue/CMM-1037-ScanFragment-empty-view

@nbradbury nbradbury added the Do Not Merge In PRs with this label, our automation will fail a require check, preventing accidental merging label Jan 22, 2026
- Remove unused error_60 color from colors_semantic.xml
- Update SiteItemsViewModelSliceTest to match temporary scanAvailable=true
  behavior with TODO comments to revert before merging

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jan 22, 2026

App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
FlavorJalapeno
Build TypeDebug
Versionpr22519-28f1cff
Commit28f1cff
Direct Downloadjetpack-prototype-build-pr22519-28f1cff.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jan 22, 2026

App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
FlavorJalapeno
Build TypeDebug
Versionpr22519-28f1cff
Commit28f1cff
Direct Downloadwordpress-prototype-build-pr22519-28f1cff.apk
Note: Google Login is not supported on these builds.

@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 38.69%. Comparing base (f0551b4) to head (28f1cff).
⚠️ Report is 6 commits behind head on trunk.

Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #22519      +/-   ##
==========================================
- Coverage   38.69%   38.69%   -0.01%     
==========================================
  Files        2198     2198              
  Lines      106812   106793      -19     
  Branches    15055    15054       -1     
==========================================
- Hits        41334    41319      -15     
+ Misses      62035    62032       -3     
+ Partials     3443     3442       -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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nbradbury nbradbury marked this pull request as ready for review January 22, 2026 20:22
@nbradbury nbradbury requested a review from adalpari January 22, 2026 20:22
@adalpari
Copy link
Contributor

  1. Open a Jetpack site and tap Scan on My Site

I'm not sure what I'm missing but I don't see that option. I've tried both, with a WP.COM site and with a jurassic.ninja one (enabling and setting up Jetpack)

Copy link
Contributor

@adalpari adalpari left a comment

Choose a reason for hiding this comment

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

It works with the instructions you gave me. Thanks!

LGTM! :shipit:

@nbradbury nbradbury removed the Do Not Merge In PRs with this label, our automation will fail a require check, preventing accidental merging label Jan 23, 2026
@sonarqubecloud
Copy link

@nbradbury nbradbury enabled auto-merge (squash) January 23, 2026 15:52
@nbradbury nbradbury merged commit 4fed726 into trunk Jan 23, 2026
21 of 22 checks passed
@nbradbury nbradbury deleted the issue/CMM-1037-ScanFragment-empty-view branch January 23, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants