Skip to content

Conversation

@staskus
Copy link
Contributor

@staskus staskus commented Jan 30, 2026

Description

Context: pdfdoF-8Ff-p2
iOS PR: woocommerce/woocommerce-ios#16591
WOOMOB-1980

Mobile announcements tool supports passing a learn more URL. However, it is not used in the app. Add optional "Learn more" link support for What's New feature announcements with two display states:

Announcement Display States

State Description UI Behavior
No link No detailsUrl provided Standard list with "Continue" CTA button
With link detailsUrl provided "Learn more" promoted to primary bottom CTA, "Not now" as secondary action

For easier testing:

  • Added Announcements section to Developer Options to force fetch and show announcement for app version 999 so it could be tested without modifying code or project settings

Testing

Live Test via Developer Options

  1. Ensure test announcement is enabled:

    • Go to the Mobile Announcements tool
    • Verify announcement ID 302 with APP VERSION = 999.0 and for Woo Android is enabled (Wait a minute or two after enabling, disable after testing)
  2. Fetch and display the announcement:

    • Open the app → SettingsDeveloper Options
    • Tap "Fetch Test Announcement (v999)"
    • The What's New modal should appear with the test content
    • Verify the "Learn more" button works correctly
    • Make changes in Announcement to have more features, be with or without the link, and verify it's reflected properly in the app (wait a bit after update so they become available).

Screenshots & Videos

No announcement link

image

With announcement link

announcement.android.mov

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

@staskus staskus added type: enhancement A request for an enhancement. feature: app settings Related to settings accessed via the gear icon in the My Store section. labels Jan 30, 2026
@dangermattic
Copy link
Collaborator

dangermattic commented Jan 30, 2026

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

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jan 30, 2026

📲 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
Commitbc6a705
Direct Downloadwoocommerce-wear-prototype-build-pr15272-bc6a705.apk

@staskus staskus marked this pull request as draft January 30, 2026 10:55
@staskus staskus changed the title [WOOMOB-1980] Add Learn more CTA to What's New [WOOMOB-1980] Add Learn more CTA to Mobile Announcements Jan 30, 2026
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jan 30, 2026

📲 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
Commitbc6a705
Direct Downloadwoocommerce-prototype-build-pr15272-bc6a705.apk

@codecov-commenter
Copy link

codecov-commenter commented Jan 30, 2026

Codecov Report

❌ Patch coverage is 31.70732% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.82%. Comparing base (4de1169) to head (bc6a705).
⚠️ Report is 95 commits behind head on trunk.

Files with missing lines Patch % Lines
...id/ui/prefs/developer/DeveloperOptionsViewModel.kt 52.94% 8 Missing ⚠️
...d/ui/prefs/developer/DeveloperOptionsRepository.kt 0.00% 6 Missing ⚠️
...droid/ui/whatsnew/FeatureAnnouncementRepository.kt 0.00% 6 Missing ⚠️
.../network/rest/wpcom/whatsnew/WhatsNewRestClient.kt 0.00% 6 Missing ⚠️
...dpress/android/fluxc/persistence/WhatsNewMapper.kt 50.00% 1 Missing ⚠️
...droid/fluxc/persistence/entity/WhatsNewEntities.kt 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##              trunk   #15272   +/-   ##
=========================================
  Coverage     38.81%   38.82%           
- Complexity    10667    10669    +2     
=========================================
  Files          2205     2205           
  Lines        125374   125407   +33     
  Branches      17394    17397    +3     
=========================================
+ Hits          48670    48683   +13     
- Misses        71759    71780   +21     
+ Partials       4945     4944    -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.

Add database support for storing the detailsUrl field in
WhatsNewAnnouncementEntity to ensure cached announcements
display Learn more links consistently across all entry points.
Remove feature-level detailsUrl since the API only provides a single
URL at the announcement level. The UI now shows two states:
- With detailsUrl: "Learn more" primary CTA + "Not now" secondary
- Without detailsUrl: "Continue" primary CTA only
@staskus staskus added this to the 24.1 milestone Feb 3, 2026
- Mark announcement as viewed and close dialog when Learn more is tapped
- Make detailsUrl nullable in API response to handle missing field
- Add logging when URL fails to open
@staskus staskus marked this pull request as ready for review February 3, 2026 09:55
val imageData: ByteArray
try {
val sanitizedBase64String = base64ImageData.replace("data:image/png;base64,", "")
val sanitizedBase64String = base64ImageData.replace(Regex("^data:image/[^;]+;base64,"), "")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to Claude:

The original code only stripped the PNG data URI prefix. But base64 image data can come with different MIME types:

  • data:image/png;base64,
  • data:image/jpeg;base64,
  • data:image/gif;base64,
  • data:image/webp;base64,
  • data:image/svg+xml;base64,

The regex ^data:image/[^;]+;base64, matches:

  • ^data:image/ — starts with "data:image/"
  • [^;]+ — one or more characters that are NOT a semicolon (captures the image type)
  • ;base64, — followed by ";base64,"

This makes the code more robust—if the API returns a JPEG or any other image format, it will be handled correctly instead of
failing to decode because the prefix wasn't stripped.

@staskus
Copy link
Contributor Author

staskus commented Feb 3, 2026

@kidinov @malinajirka not urgent, one review is enough. Thanks

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

Labels

feature: app settings Related to settings accessed via the gear icon in the My Store section. type: enhancement A request for an enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants