-
Notifications
You must be signed in to change notification settings - Fork 136
[WOOMOB-1347] - Booking details note - new screen to manage the note #14799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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
BookingNoteScreenwith 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.
Generated by 🚫 Danger |
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/BookingsRepository.kt
Outdated
Show resolved
Hide resolved
| 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, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/note/BookingNoteScreen.kt
Show resolved
Hide resolved
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/note/BookingNoteViewModel.kt
Show resolved
Hide resolved
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
Codecov Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
irfano
left a comment
There was a problem hiding this 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. 🚀
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/BookingsRepository.kt
Outdated
Show resolved
Hide resolved
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/note/BookingNoteScreen.kt
Show resolved
Hide resolved
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/note/BookingNoteViewModel.kt
Show resolved
Hide resolved
...ommerce/src/test/kotlin/com/woocommerce/android/ui/bookings/note/BookingNoteViewModelTest.kt
Outdated
Show resolved
Hide resolved
| 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, |
There was a problem hiding this comment.
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.
d1250db to
d66ec63
Compare
Part of WOOMOB-1347
Description
This PR introduces a new screen
BookingNotesScreen, to manage the booking note.It will:
Donebutton when changes are madeDonebutton tapI've noticed the PR grew quite a bit, so if you prefer that I can split it into two - let me know.
Testing information
Add noteor the note if already setTest configuration changes and dark/light theme.
Images/gif
Screen_recording_20251022_152153.mp4
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.