Skip to content

Fix draw area issue#3804

Merged
andreia-ferreira merged 5 commits into
masterfrom
andreia/3400/fix-draw-area-issue
Jul 6, 2026
Merged

Fix draw area issue#3804
andreia-ferreira merged 5 commits into
masterfrom
andreia/3400/fix-draw-area-issue

Conversation

@andreia-ferreira

@andreia-ferreira andreia-ferreira commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Fixes #3400

Currently, when rotating the draw area task screen after the polygon was finished, the drawn polygon would be lost. This could also lead to a crash java.lang.IllegalStateException - Attempted to add last vertex after completing the drawing if the 'Add point' would show again during this issue and the user clicked it.

This was because the state was split between draftArea which held only the first vertex and draftUpdates, a no-replay SharedFlow. Since draftUpdates doesn't replay, the current feature was lost so the shape vanished and buttons reverted

Now draftArea carries the full geometry and buttons derive from sessionState, so both survive rotation. FeatureManager.setFeatures was updated so that a non-clustered feature whose tag already exists is updated instead of removed and re-added, which avoids potential flickering.

Before:

Screen_recording_20260630_162746.webm

After:

Screen_recording_20260630_160754.webm

@shobhitagarwal1612 PTAL?

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.50%. Comparing base (345b674) to head (43d008f).

Files with missing lines Patch % Lines
...form/android/ui/map/gms/features/FeatureManager.kt 0.00% 9 Missing ⚠️
...acollection/tasks/polygon/DrawAreaTaskViewModel.kt 78.57% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3804      +/-   ##
============================================
+ Coverage     67.27%   67.50%   +0.22%     
- Complexity     1790     1798       +8     
============================================
  Files           405      405              
  Lines         10617    10625       +8     
  Branches       1353     1356       +3     
============================================
+ Hits           7143     7172      +29     
+ Misses         2781     2755      -26     
- Partials        693      698       +5     
Files with missing lines Coverage Δ
...ollection/tasks/polygon/DrawAreaTaskMapFragment.kt 47.82% <ø> (-2.18%) ⬇️
...acollection/tasks/polygon/PolygonDrawingSession.kt 100.00% <100.00%> (ø)
...lection/tasks/polygon/PolygonDrawingSessionImpl.kt 94.23% <100.00%> (+0.48%) ⬆️
...dplatform/android/ui/map/gms/GoogleMapsFragment.kt 18.10% <ø> (+0.15%) ⬆️
...orm/android/ui/map/gms/features/MapsItemManager.kt 48.88% <100.00%> (+48.88%) ⬆️
...acollection/tasks/polygon/DrawAreaTaskViewModel.kt 81.37% <78.57%> (-0.94%) ⬇️
...form/android/ui/map/gms/features/FeatureManager.kt 18.96% <0.00%> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andreia-ferreira andreia-ferreira merged commit 7bf153d into master Jul 6, 2026
20 checks passed
@andreia-ferreira andreia-ferreira deleted the andreia/3400/fix-draw-area-issue branch July 6, 2026 08:31
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.

DrawArea task footer shows wrong buttons and can crash on completed polygons

2 participants