-
Notifications
You must be signed in to change notification settings - Fork 136
[WOOMOB-1347] - Booking details note - discard changes dialog #14804
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
[WOOMOB-1347] - Booking details note - discard changes dialog #14804
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 implements a discard changes confirmation dialog for the BookingNoteScreen. When users attempt to navigate back after making unsaved changes to a booking note, they are prompted to confirm whether they want to discard those changes.
Key Changes:
- Added dialog state management to BookingNoteViewModel to track and control the discard changes dialog
- Implemented back button handling logic that compares current note content with initial state to determine if changes exist
- Added comprehensive test coverage for back button behavior including scenarios with no changes, with changes, during save operations, and dialog interactions
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| BookingNoteViewModelTest.kt | Added 4 test cases covering back button behavior and dialog interactions |
| strings.xml | Added dialog message and button text resources |
| BookingNoteViewState.kt | Added onBackPressed callback and dialogState field |
| BookingNoteViewModel.kt | Implemented back press logic with change detection and dialog state management |
| BookingNoteScreen.kt | Connected back button to ViewModel's onBackPressed and added dialog rendering |
| BookingNoteFragment.kt | Removed redundant onBack parameter as back navigation is now handled via Exit event |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/note/BookingNoteViewModel.kt
Outdated
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.
|
c14968a to
525fcf4
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #14804 +/- ##
============================================
+ Coverage 38.17% 38.18% +0.01%
- Complexity 10072 10078 +6
============================================
Files 2132 2132
Lines 120294 120322 +28
Branches 16447 16450 +3
============================================
+ Hits 45920 45945 +25
Misses 69750 69750
- Partials 4624 4627 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Works great and code looks good ![]()
Closes WOOMOB-1347
Description
This PR adds the
Discard changesdialog to theBookingNoteScreenafter tapping the back button.If there are unsaved changes, the dialog is presented with the option to discard them.
Test Steps
Images/gif
Screen_recording_20251023_090007.mp4
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.