-
Notifications
You must be signed in to change notification settings - Fork 137
Added DrawGeometryTask #3421
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
base: master
Are you sure you want to change the base?
Added DrawGeometryTask #3421
Conversation
…sk' into anandwana001/3148/drawgeometrytask
shobhitagarwal1612
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.
Please attach a screen recording as well to the description.
app/src/main/java/org/groundplatform/android/data/local/room/converter/ValueJsonConverter.kt
Show resolved
Hide resolved
app/src/main/java/org/groundplatform/android/data/remote/firebase/schema/TaskConverter.kt
Show resolved
Hide resolved
app/src/main/java/org/groundplatform/android/model/task/DrawGeometry.kt
Outdated
Show resolved
Hide resolved
...java/org/groundplatform/android/ui/datacollection/tasks/geometry/DrawGeometryTaskFragment.kt
Show resolved
Hide resolved
...java/org/groundplatform/android/ui/datacollection/tasks/geometry/DrawGeometryTaskFragment.kt
Outdated
Show resolved
Hide resolved
# Conflicts: # app/src/main/java/org/groundplatform/android/ui/datacollection/DataCollectionViewPagerAdapter.kt
| if (obj is JSONObject) { | ||
| (obj as JSONObject).toCaptureLocationTaskData() | ||
| } else { | ||
| DataStoreException.checkType(String::class.java, obj) | ||
| val geometry = GeometryWrapperTypeConverter.fromString(obj as String)?.getGeometry() | ||
| DataStoreException.checkNotNull(geometry, "Missing geometry in draw geometry task result") | ||
| if (geometry is Point) { | ||
| DropPinTaskData(geometry) | ||
| } else { | ||
| DrawGeometryTaskData(geometry!!) | ||
| } | ||
| } |
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.
This seems error prone to me. I'd prefer if the entire object was encapsulated in DrawGeometryTaskData which can then internally have a location or geometry type data.
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.
Can we reuse the logic for drawing polygon using DrawAreaTaskViewModel?
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.
Let's not remove the existing tests for DRAW_AREA and DRO_PIN task types as we'll continue supporting these types for legacy surveys. Instead, let's add tests for the new task type.
|
Can you please attach a screencast with |
Fixes #3148
This PR implements the new DrawGeometry task UI for Android, unifying the "Drop Pin" and "Capture Location" functionalities into a single, configurable task type. This change aligns the Android client with the updated DrawGeometry task model, allowing survey administrators to configure location lock requirements and accuracy thresholds.
Key Changes
Model & Schema:
UI Implementation:
Persistence:
Tests:
- Location lock enforcement logic.
- Correct generation of CaptureLocationTaskData vs. DropPinTaskData.
- Location lock flow initialization.
Verification
Automated Tests:
Manual Verification:
@shobhitagarwal1612 PTAL?
Screen.Recording.2025-12-27.at.1.48.51.PM.mov