Skip to content
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

Show a warning dialog when attempting to close data collection screen #3024

Merged
merged 8 commits into from
Jan 30, 2025

Conversation

shobhitagarwal1612
Copy link
Member

Fixes #2635

Adds a new warning dialog before discarding the in-progress data collection screen.

data.collection.confirmation.dialog.mp4

@anandwana001 PTAL?

*   Add `ConfirmationDialog` preview.
*   Update `ConfirmationDialog` to track dialog state internally.
*   Refactor `showConfirmationDialog` to use new `ConfirmationDialog` implementation.
*   Remove unnecessary mutable state.
*   Update string resource names to match their purpose.
- Replaced the default navigation action with a custom warning dialog.
- Added a new function `showConfirmationDialog` to display the exit warning dialog.
- Modified `onBack` to trigger the warning dialog when appropriate.
- Moved clearDraft() call to onConfirm action.
@auto-assign auto-assign bot requested a review from gino-m January 30, 2025 05:05
Copy link

codecov bot commented Jan 30, 2025

Codecov Report

Attention: Patch coverage is 63.15789% with 21 lines in your changes missing coverage. Please review.

Project coverage is 63.65%. Comparing base (1f021ac) to head (da4ed35).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...le/android/ground/ui/compose/ConfirmationDialog.kt 46.15% 8 Missing and 6 partials ⚠️
...ground/ui/datacollection/DataCollectionFragment.kt 82.60% 1 Missing and 3 partials ⚠️
...ground/ui/surveyselector/SurveySelectorFragment.kt 62.50% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3024      +/-   ##
============================================
+ Coverage     63.61%   63.65%   +0.04%     
- Complexity     1272     1274       +2     
============================================
  Files           271      271              
  Lines          6572     6593      +21     
  Branches        930      931       +1     
============================================
+ Hits           4181     4197      +16     
- Misses         1789     1794       +5     
  Partials        602      602              
Files with missing lines Coverage Δ
...ground/ui/surveyselector/SurveySelectorFragment.kt 60.27% <62.50%> (-0.98%) ⬇️
...ground/ui/datacollection/DataCollectionFragment.kt 47.27% <82.60%> (+8.09%) ⬆️
...le/android/ground/ui/compose/ConfirmationDialog.kt 42.85% <46.15%> (+4.39%) ⬆️

@shobhitagarwal1612
Copy link
Member Author

@gino-m Who should we tag for validating the non-english translation strings?

@gino-m
Copy link
Collaborator

gino-m commented Jan 30, 2025

@jo-spek

Copy link
Collaborator

@jo-spek jo-spek left a comment

Choose a reason for hiding this comment

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

Minor change to French and Spanish, with kind help of @PilarValbuena

@shobhitagarwal1612
Copy link
Member Author

shobhitagarwal1612 commented Jan 30, 2025

Thank you @jo-spek and @PilarValbuena

@shobhitagarwal1612
Copy link
Member Author

@jo-spek Can you please re-stamp the PR?

@shobhitagarwal1612 shobhitagarwal1612 merged commit 00d18fa into master Jan 30, 2025
5 checks passed
@shobhitagarwal1612 shobhitagarwal1612 deleted the ashobhit/2635/warning-dialog branch January 30, 2025 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Data collection] Clicking "x" in top left corner discards data without prompting user
4 participants