Skip to content

Conversation

hichamboushaba
Copy link
Member

@hichamboushaba hichamboushaba commented Oct 15, 2025

Closes WOOMOB-1320

Description

This PR updates the product navigation to make sure we open bookable products in a WebView.
The URL we use for the products is temporary now.

Note

  • I tried to simplify the navigation logic to product details by combining the various flows in a single function, and removing the extra navigation action action_global_productDetailFragment_popUpTo_product_list, please review commit by commit to better follow the changes.
  • Loading the product details is super slow, I assume it's just because of the test site

Steps to reproduce

  1. Use the test CIAB site shared here p1758030630245249-slack-C03L1NF1EA3
  2. Sign in using site credentials from the above site
  3. Open a bookable product from the product list
  4. Open a regular product from the product list
  5. Open a bookable product from the top performers card in the dashboard
  6. Open a regular product from the top performers card in the dashboard

Testing information

  • Confirm that bookable products are opened in a WebView.
  • Confirm that other products are not affected.

The tests that have been performed

The above.

Images/gif

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

@dangermattic
Copy link
Collaborator

dangermattic commented Oct 15, 2025

1 Warning
⚠️ This PR is assigned to the milestone 23.5. The due date for this milestone has already passed.
Please assign it to a milestone with a later deadline or check whether the release for this milestone has already been finished.

Generated by 🚫 Danger

mode = ShowProduct(event.productId),
)
)
is OpenProductDetail -> (context.findActivity() as? MainActivity)?.showProductDetail(event.productId)
Copy link
Member Author

Choose a reason for hiding this comment

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

One other approach instead of getting the activity would be to use a custom Hilt EntryPoint and injecting ProductDetailNavigator here, I don't have a strong opinion about either approach, I just went for the simplest here.

@hichamboushaba hichamboushaba marked this pull request as ready for review October 15, 2025 21:40
@hichamboushaba hichamboushaba added this to the 23.5 milestone Oct 15, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 15, 2025

📲 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
Commitcbccd3f
Direct Downloadwoocommerce-wear-prototype-build-pr14765-cbccd3f.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 15, 2025

📲 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
Commitcbccd3f
Direct Downloadwoocommerce-prototype-build-pr14765-cbccd3f.apk

Copy link
Contributor

@AdamGrzybkowski AdamGrzybkowski left a comment

Choose a reason for hiding this comment

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

The navigation on the phone works as described, but... it doesn't in the Split Pane layout on the Product List.

Screen_recording_20251016_130629.mp4

I guess, it's something that we want to support as well?

@hichamboushaba hichamboushaba force-pushed the issue/WOOMOB-1320-bookable-product-webview branch from cebd15a to 5384012 Compare October 17, 2025 09:03
@hichamboushaba
Copy link
Member Author

hichamboushaba commented Oct 17, 2025

Thanks @AdamGrzybkowski for the test and for catching the issue.

To have better tablet support, I worked on an alternative solution, please check the last commits. The main parts of the new solution are:

  • This logic here where we identify Bookable products in ProductDetailViewModel and then switch to the WebView.
  • This logic for the navigation back from the WebView.

Given the navigation is handled now inside ProductDetailFragment, we don't need to change any other parts of the app, so I reverted the previous commits that introduced ProductDetailNavigator.

The result for tablets now is:

Screen_recording_20251017_100101.mp4

and for phones:

Screen_recording_20251017_101853.mp4

Ready for another round.


There is an issue about displaying the CIAB nav bar inside the WebView in tablets, I'll start a thread about it and decide if it's something that we want to hide, anyway this is outside of the scope of this PR anyway.

@hichamboushaba
Copy link
Member Author

I forgot to share, there is one additional advantage of this solution, in case the product wasn't cached before, the solution would still work well, we'll show a shimmer loading effect until the product is loaded, then we'll open the WebView:

Screen_recording_20251017_102338.mp4

This wouldn't have worked with the previous solution.

@hichamboushaba hichamboushaba force-pushed the issue/WOOMOB-1320-bookable-product-webview branch from e82fb0d to ca725ef Compare October 17, 2025 09:45
Copy link
Contributor

@AdamGrzybkowski AdamGrzybkowski left a comment

Choose a reason for hiding this comment

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

I like the new approach! The shimmer is a great bonus 👍

:shipit:

@AdamGrzybkowski
Copy link
Contributor

One nitpick:

The webView has an extra entry animation in the split pane compared to the non-webView fragment

Screen_recording_20251017_114633.mp4

@hichamboushaba
Copy link
Member Author

One nitpick:

The webView has an extra entry animation in the split pane compared to the non-webView fragment

I took a quick look at this, and couldn't find an easy solution, I tried disabling the animation, but I think it's not better, as this causes the ProdudctDetailFragment content to blink a bit before showing the WebView:

Screen_recording_20251017_110702.mp4

If you have some ideas we can try please let me know, otherwise I think what we have here is fine, especially given all this sould be a temporary solution until we have a native editor, WDYT?

@hichamboushaba hichamboushaba force-pushed the issue/WOOMOB-1320-bookable-product-webview branch from ca725ef to cbccd3f Compare October 17, 2025 10:10
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 92.30769% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.29%. Comparing base (8956252) to head (cbccd3f).
⚠️ Report is 48 commits behind head on trunk.

Files with missing lines Patch % Lines
...oocommerce/android/ui/main/MainNavigationRouter.kt 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #14765      +/-   ##
============================================
+ Coverage     38.27%   38.29%   +0.01%     
- Complexity    10010    10017       +7     
============================================
  Files          2118     2119       +1     
  Lines        118488   118527      +39     
  Branches      15824    15826       +2     
============================================
+ Hits          45357    45394      +37     
- Misses        68917    68919       +2     
  Partials       4214     4214              

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

@AdamGrzybkowski
Copy link
Contributor

hmm you're right... The only thing that comes to my mind is to handle switching to WebView within the ProductDetailFragment instead of showing a new fragment. That should preserve the animation and the Toolbar. Only the content would switch.

Not sure if it's worth it.

@hichamboushaba
Copy link
Member Author

hmm you're right... The only thing that comes to my mind is to handle switching to WebView within the ProductDetailFragment instead of showing a new fragment. That should preserve the animation and the Toolbar. Only the content would switch.

Not sure if it's worth it.

Yes, that would be a good alternative, but given how the ProductDetailFragment is already pretty complicated, I think the simplicity and separation of concerns of the current solution is better.
Let's merge this as is, if we have time post Alpha, we can revisit the solution.

@hichamboushaba hichamboushaba merged commit a12ca21 into trunk Oct 17, 2025
16 checks passed
@hichamboushaba hichamboushaba deleted the issue/WOOMOB-1320-bookable-product-webview branch October 17, 2025 10:56
Copy link

sentry-io bot commented Oct 18, 2025

Issues attributed to commits in this pull request

This pull request was merged and Sentry observed the following issues:

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