Skip to content

Conversation

AdamGrzybkowski
Copy link
Contributor

WOOMOB-1396

Description

This PR implements the actions in the Booking details screen for both the phone and email rows in the customer details section.

There we a couple of things that I did:

  1. Aligned the icons to match the Order details screen - 0c63f1d
  2. Extract some logic to build the list of possible actions for the phone number - b16d619 and bb13aa4
  3. Used that implementation on the Order screen - f388102
  4. Implemented the actions on the Booking screen - 8bff5bb, fc5caaa and ee32e2e

Steps to reproduce

  1. Login and open the booking tab
  2. Tap on a booking item
  3. Look for Customer section
  4. Tap on the ✉️ icon
  5. Confirm an email client is open to send a new email
  6. Go back to Woo app
  7. Tap on the ... icon
  8. Select the options and verify

Testing information

You can verify the Order details screen for regression. Testing Whatsapp, Telegram is a plus. Light and dark theme.

The tests that have been performed

The above

Images/gif

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

Copy link
Contributor

@Copilot 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

Implements customer contact actions (call, SMS, WhatsApp, Telegram, email) for Booking details by extracting reusable phone contact option logic and reusing it in Order details. Key changes include a new utility for determining available phone contact options and new Compose UI components (dropdown menu) integrating those actions directly in the Booking customer details section.

  • Added PhoneContactOptionsUtils to centralize available contact option resolution (including conditional WhatsApp/Telegram).
  • Refactored existing order customer phone action logic to reuse the new utility and extracted SMS intent creation into ActivityUtils.
  • Implemented booking-side UI (dropdown menu + inline actions) replacing callback-based design.

Reviewed Changes

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

Show a summary per file
File Description
PhoneContactOptionsUtils.kt New utility to build list of available phone contact actions.
ActivityUtils.kt Added sendSms helper to centralize SMS intent handling.
OrderDetailCustomerInfoView.kt Refactored to use new contact options utility instead of hardcoded package checks.
OrderCustomerHelper.kt Reused new ActivityUtils.sendSms instead of duplicating intent logic.
BookingDetailsScreen.kt Adjusted call site after composable API change (callbacks removed).
ContactDropdownMenu.kt New composable presenting dynamic contact options.
BookingCustomerDetails.kt Integrated dropdown menu; inlined email/phone action handling (removed external callbacks).

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 29 to +38
fun BookingCustomerDetails(
model: BookingCustomerDetailsModel,
onEmailClick: () -> Unit,
onPhoneClick: () -> Unit,
modifier: Modifier = Modifier,
) {
var phoneMenuExpanded by remember { mutableStateOf(false) }
Copy link
Preview

Copilot AI Oct 3, 2025

Choose a reason for hiding this comment

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

[nitpick] Removing the onEmailClick and onPhoneClick callbacks hardcodes side effects (email intent, phone actions) inside the composable, reducing testability and flexibility (e.g., adding analytics, logging, or alternative behaviors). Consider reintroducing callbacks (with sensible defaults) so the UI remains a pure presenter while delegating side effects to higher layers.

Copilot uses AI. Check for mistakes.

Copy link
Contributor

Choose a reason for hiding this comment

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

flexibility (e.g., adding analytics,

I was about to mention that too. Adding analytics would indeed be easier if we handled actions in the view models. But it’s not a major concern, we can revisit it when we implement analytics.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True. I think there are pros and cons, like always. This way, the component is very easy to drop and use, without needing to implement the actions every time.

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 3, 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 Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commit5b0008b
Direct Downloadwoocommerce-wear-prototype-build-pr14692-5b0008b.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 3, 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 Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commit5b0008b
Direct Downloadwoocommerce-prototype-build-pr14692-5b0008b.apk

@codecov-commenter
Copy link

codecov-commenter commented Oct 3, 2025

Codecov Report

❌ Patch coverage is 0% with 76 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.36%. Comparing base (f3dceab) to head (5b0008b).
⚠️ Report is 45 commits behind head on trunk.

Files with missing lines Patch % Lines
...android/ui/bookings/compose/ContactDropdownMenu.kt 0.00% 34 Missing ⚠️
...roid/ui/bookings/compose/BookingCustomerDetails.kt 0.00% 17 Missing ⚠️
...ocommerce/android/util/PhoneContactOptionsUtils.kt 0.00% 16 Missing ⚠️
...tlin/com/woocommerce/android/util/ActivityUtils.kt 0.00% 7 Missing ⚠️
...ocommerce/android/ui/orders/OrderCustomerHelper.kt 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #14692      +/-   ##
============================================
- Coverage     38.38%   38.36%   -0.03%     
+ Complexity     9825     9824       -1     
============================================
  Files          2094     2096       +2     
  Lines        116793   116854      +61     
  Branches      15625    15632       +7     
============================================
- Hits          44834    44833       -1     
- Misses        67800    67861      +61     
- Partials       4159     4160       +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.

@staskus staskus modified the milestones: 23.4, 23.5 Oct 3, 2025
@irfano irfano self-assigned this Oct 4, 2025
Copy link
Contributor

@irfano irfano left a comment

Choose a reason for hiding this comment

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

Nice job, Adam! It works as expected. 👍🏻 🚀

When an app like Telegram is installed/unistalled with Woo in the background, the list will be rechecked after entering foreground and thus preventing a crash.
@AdamGrzybkowski AdamGrzybkowski merged commit 55f8621 into trunk Oct 6, 2025
15 checks passed
@AdamGrzybkowski AdamGrzybkowski deleted the issue/WOOMOB-1396_custom_section_actions branch October 6, 2025 10:11
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