Repository navigation
feat(listing): choose the pickup location or meeting place on a map - #369
Conversation
fa5b722 to
4cbbe91
Compare
4cbbe91 to
b219328
Compare
Julkzein
left a comment
There was a problem hiding this comment.
Really nice feature: one field that turns from "Choose on the map" into the editable place name, a centred pin whose tip is placed exactly (the 5/12 offset checks out), "Show my location" asking for coarse location only when tapped, and the ~1 m tolerance because Google Maps writes back a slightly different target, which is a subtle catch. Offline handling is clear too: picking needs the internet, renaming and removing don't. The tests are thorough, especially the fake map that shifts the camera like Google Maps.
Two blocking points: the branch no longer merges cleanly with main (below), and the picker's Google map is likely to crash on Android 9+ (inline). Also, GitHub counts +1750 because #366 and #388 are still in the branch's history even though they're merged; once main is merged in, the real diff should drop to around 950 lines, mostly tests, which is fine.
One coordination note: my #392 (Map tab) also adds locationRepository to AppNavHost and builds FusedLocationRepository in MainActivity, the same way you do. Whichever of us merges second will just keep one copy.
Important: Merging main into this branch gives conflicts in 9 files. Most come from #366 and #388 being squash merged (ConnectivityRepository and its test, AppNavHost, the navigation tests, ListingFormViewModelTest), so main's versions can be taken there. Two clash with #357/#358, which are on main now: ic_map_pin.xml is the same icon with another comment, so one copy is enough, but this fake has a different API on main (location, failure, gate, calls), and the map tests use it. Could you keep main's version and set failure (or location) in your tests instead of result? Happy to help with the merge if you want.
| @Composable (camera: CameraPositionState, showMyLocation: Boolean) -> Unit | ||
|
|
||
| val DefaultListingLocationMap: ListingLocationMap = { camera, showMyLocation -> | ||
| GoogleMap( |
There was a problem hiding this comment.
Important: I believe this GoogleMap will crash on Android 9+ devices: on #391, an instrumented test opening a GoogleMap on the CI emulator (API 34) failed with NoClassDefFoundError: org/apache/http/ProtocolVersion from Play Services' Maps module, which still uses Apache HTTP. Google's fix is <uses-library android:name="org.apache.http.legacy" android:required="false"/> in the manifest's <application>; #391 adds it, but this PR doesn't depend on it. Since the picker isn't run on a device by the tests, could you add the line here (or we make sure #391 lands first)?
There was a problem hiding this comment.
Thanks, good catch. I added the org.apache.http.legacy to the manifest, copied exactly from #391, so whichever of the two merges second won't conflict on it.
There was a problem hiding this comment.
Perfect, same line as #391 so no conflict whichever lands first, thanks!
Add one location field, opens a full-screen picker with a fixed centre pin, and once a point is set the field becomes the editable place name with buttons to move the pin or remove it. \"Show my location\" asks for the approximate location only when tapped, and the map follows the lender's position until they move it. Offline, choosing on the map is disabled with a hint, while removing or renaming the place still works
#366 now shows the location name error only after leaveLocationNameField(), like price and refund. Call it when the name field loses focus, so the error appears after the lender leaves the field blank instead of never. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ad7243c to
3c3f3a5
Compare
|
Julkzein
left a comment
There was a problem hiding this comment.
After the back and forth this looks good to me: main is merged in cleanly (the fake keeps main's API, one ic_map_pin), and the picker now loads Apache HTTP for Google Maps on Android 9+. The real diff is down to +911/−5. Only follow-up is the "Don't ask again" case you listed. lgtm.



Summary
Closes #365. Part of #339 (2 of 2). Lenders can now choose where a listing is offered: "Pickup location" for items, "Meeting place" for services. They pick it on a full-screen map in the create and edit forms, then name the place. Builds on #366, which holds the form logic, and #388, which tells the form whether the device is online (review those first)
What
ACCESS_COARSE_LOCATIONonly when tapped. Once granted, the map shows the device and asks the form for the lender's position.ListingFormActionsgets five location callbacks connected to the ViewModel, includingonLocationNameFieldLeft, so the "Give the place a name." error shows once the name field loses focus, like price and refund.CreateListingContentandEditListingContenttake alocationMap, so tests can use a fake map instead of Google Maps.ic_map_pin.xmland the location strings.Why
#338 let a listing store and show a location, and #366 let the form set one, but lenders had no way to choose it. Renters need to know where to pick up an item or meet for a service. The location stays optional, so the form still works offline and without the location permission.
Validation
./gradlew ktfmtCheck check: passes.ListingLocationFieldTestuses Robolectric with a fake map and a fake permission registry. It covers:Follow-ups
AI use
Claude Code (Claude Opus 5.5) planned the change with me, then ran three agents:
It then rebased this PR onto #388 after the #366 review and wired
leaveLocationNameField()to the name field.I reviewed the changes and can explain them.