Skip to content

Conversation

@AdamGrzybkowski
Copy link
Contributor

Part of WOOMOB-1347

Description

This PR introduces a new screen BookingNotesScreen, to manage the booking note.

It will:

  • display the already stored note
  • show a Done button when changes are made
  • upload a new note on Done button tap

I've noticed the PR grew quite a bit, so if you prefer that I can split it into two - let me know.

Testing information

  1. Launch the app
  2. Go to the bookings tab
  3. Open a booking
  4. Scroll down
  5. Tap Add note or the note if already set
  6. Play with the new screen - add, removed, some characters, save the note, tap back etc.

Test configuration changes and dark/light theme.

Images/gif

Screen_recording_20251022_152153.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 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 introduces a new screen for managing booking notes, allowing users to view, edit, and save notes associated with a booking. The implementation generalizes the booking update API to support multiple fields and adds comprehensive test coverage.

Key changes:

  • Generalized the booking update API from attendance-status-only to support multiple fields (attendance status and notes)
  • Added a new BookingNoteScreen with view model, state management, and UI components
  • Integrated the note screen into the booking details navigation flow

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
BookingsStore.kt Renamed method to support generic booking updates instead of just attendance status
BookingsRestClient.kt Refactored to accept BookingUpdatePayload with multiple optional fields
BookingUpdatePayload.kt New data class for flexible booking updates
BookingNoteViewModelTest.kt Comprehensive unit tests for the note editing view model
strings.xml Added strings for the note screen UI and error messages
nav_graph_bookings.xml Added navigation action and fragment definition for note screen
BookingNoteViewState.kt State management for note editing with computed properties
BookingNoteViewModel.kt View model handling note retrieval, editing, and saving
BookingNoteScreen.kt Compose UI for the note editing screen
BookingNoteFragment.kt Fragment wrapper for the Compose screen
BookingDetailsScreen.kt Updated to support navigation to note screen
BookingDetailsFragment.kt Wired up navigation to note screen
BookingsRepository.kt Added methods for fetching single booking and updating notes

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

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

Generated by 🚫 Danger

Comment on lines -39 to +50
suspend fun updateAttendanceStatus(
suspend fun updateBooking(
site: SiteModel,
bookingId: Long,
attendanceStatus: String
payload: BookingUpdatePayload,
): WooPayload<BookingDto> {
val endpoint = WOOCOMMERCE.bookings.id(bookingId).pathV2Bookings
val body = payload.asMap
val response = wooNetwork.executePutGsonRequest(
site = site,
path = endpoint,
clazz = BookingDto::class.java,
body = mapOf("attendance_status" to attendanceStatus)
body = body,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a separate commit for that change - 4ab1df3

I did it so we can reuse the same function whenever we need to update the booking.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good! 👍🏻 That’s a useful refactoring.

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 22, 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
Commitd66ec63
Direct Downloadwoocommerce-wear-prototype-build-pr14799-d66ec63.apk

@irfano irfano self-assigned this Oct 22, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 22, 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
Commitd66ec63
Direct Downloadwoocommerce-prototype-build-pr14799-d66ec63.apk

@codecov-commenter
Copy link

codecov-commenter commented Oct 22, 2025

Codecov Report

❌ Patch coverage is 60.00000% with 34 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.17%. Comparing base (d8b0339) to head (d66ec63).

Files with missing lines Patch % Lines
...commerce/android/ui/bookings/BookingsRepository.kt 0.00% 13 Missing ⚠️
...twork/rest/wpcom/wc/bookings/BookingsRestClient.kt 0.00% 10 Missing ⚠️
...ork/rest/wpcom/wc/bookings/BookingUpdatePayload.kt 0.00% 4 Missing ⚠️
...xc/network/rest/wpcom/wc/bookings/BookingsStore.kt 0.00% 3 Missing ⚠️
...e/android/ui/bookings/note/BookingNoteViewModel.kt 95.55% 0 Missing and 2 partials ⚠️
...e/android/ui/bookings/note/BookingNoteViewState.kt 80.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #14799      +/-   ##
============================================
+ Coverage     38.15%   38.17%   +0.02%     
- Complexity    10058    10072      +14     
============================================
  Files          2129     2132       +3     
  Lines        120215   120294      +79     
  Branches      16439    16447       +8     
============================================
+ Hits          45864    45920      +56     
- Misses        69727    69750      +23     
  Partials       4624     4624              

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

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.

Great job @AdamGrzybkowski! The code looks simple and straightforward. I’ve just added some non-blocking comments, but we’re good to merge. 🚀

Comment on lines -39 to +50
suspend fun updateAttendanceStatus(
suspend fun updateBooking(
site: SiteModel,
bookingId: Long,
attendanceStatus: String
payload: BookingUpdatePayload,
): WooPayload<BookingDto> {
val endpoint = WOOCOMMERCE.bookings.id(bookingId).pathV2Bookings
val body = payload.asMap
val response = wooNetwork.executePutGsonRequest(
site = site,
path = endpoint,
clazz = BookingDto::class.java,
body = mapOf("attendance_status" to attendanceStatus)
body = body,
Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good! 👍🏻 That’s a useful refactoring.

@AdamGrzybkowski AdamGrzybkowski force-pushed the issue/WOOMOB-1347_add_note_fragment branch from d1250db to d66ec63 Compare October 22, 2025 18:52
@AdamGrzybkowski AdamGrzybkowski merged commit fced2f1 into trunk Oct 23, 2025
16 checks passed
@AdamGrzybkowski AdamGrzybkowski deleted the issue/WOOMOB-1347_add_note_fragment branch October 23, 2025 06:37
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.

6 participants