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

[HOLD for payment 2024-06-13] CRITICAL: [P2P Distance] [$250] Add blue dot showing current location, and center-on-me button. #40209

Closed
m-natarajan opened this issue Apr 13, 2024 · 58 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 External Added to denote the issue can be worked on by a contributor High Priority NewFeature Something to build that is a new item.

Comments

@m-natarajan
Copy link

m-natarajan commented Apr 13, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Problem:

There is no blue dot to show where the user is on the location in the map

Solution:

Should see a "blue dot" where I am on the map when doing Track distance, along with a button to center the map on my location and orient the top to be North

Context/Examples/Screenshots/Notes:

Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @quinthar
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1712974874670609

Add any screenshot/video evidence

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f4462a45d6a637d7
  • Upwork Job ID: 1780349889093390336
  • Last Price Increase: 2024-04-16
  • Automatic offers:
    • nkdengineer | Contributor | 0
Issue OwnerCurrent Issue Owner: @bfitzexpensify / @kadiealexander
@m-natarajan m-natarajan added Daily KSv2 NewFeature Something to build that is a new item. labels Apr 13, 2024
Copy link

melvin-bot bot commented Apr 13, 2024

Triggered auto assignment to @bfitzexpensify (NewFeature), see https://stackoverflowteams.com/c/expensify/questions/14418#:~:text=BugZero%20process%20steps%20for%20feature%20requests for more details. Please add this Feature request to a GH project, as outlined in the SO.

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Apr 13, 2024
Copy link

melvin-bot bot commented Apr 13, 2024

⚠️ It looks like this issue is labelled as a New Feature but not tied to any GitHub Project. Keep in mind that all new features should be tied to GitHub Projects in order to properly track external CAP software time ⚠️

@quinthar quinthar moved this to CRITICAL in [#whatsnext] #vip-vsb Apr 13, 2024
@quinthar quinthar changed the title [Feature Request]CRITICAL: [P2P Distance] Add blue dot showing current location, and center-on-me button. CRITICAL: [P2P Distance] Add blue dot showing current location, and center-on-me button. Apr 13, 2024
@nkdengineer
Copy link
Contributor

nkdengineer commented Apr 14, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

  • New feature: Add blue dot showing current location, and center-on-me button.

What is the root cause of that problem?

What changes do you think we should make in order to solve the problem?

  • With the feature see a "blue dot" where I am on the map when doing Track distance: We can add the below component to this:
                  <Marker
                   
                        longitude={currentPosition?.longitude}
                        latitude={currentPosition?.latitude}
                    >
                        <View style={{backgroundColor: 'blue', width: 12, height: 12, borderRadius: 12}} />  // Just a pseudo code
                    </Marker>

The above change will add a new Marker (blue dot) with coordinates is the currentPosition

  • With the feature with a button to center the map on my location and orient the top to be North: We can create a new button (based on design) and then, if the user clicks on that button, we will:
   if (directionCoordinates) {
                            const bounds = [
                                [Math.min(...directionCoordinates.map((coord) => coord[0])), Math.min(...directionCoordinates.map((coord) => coord[1]))], // Southwest
                                [Math.max(...directionCoordinates.map((coord) => coord[0])), Math.max(...directionCoordinates.map((coord) => coord[1]))], // Northeast
                            ];
                            mapRef?.fitBounds(bounds);
                            return;
                        }
                        mapRef?.easeTo({center: {lat: currentPosition?.latitude, lon: currentPosition?.longitude}, bearing: 0});

The above will use the fitBounds to fit the map to the route if existed.
If not, we will use easeTo to center the map on my location and orient the top to be North

  • Do the same with other platforms.

What alternative solutions did you explore? (Optional)

  • In the main solution, we can use Layer to display the blue dot:
<Source
                        id="my-data"
                        type="geojson"
                        data={{
                            type: 'FeatureCollection',
                            features: [{type: 'Feature', geometry: {type: 'Point', coordinates: [currentPosition?.longitude, currentPosition?.latitude]}}],
                        }}
                    >
                        <Layer
                            {...{
                                id: 'point',
                                type: 'circle',
                                paint: {
                                    'circle-radius': 10,
                                    'circle-color': '#007cbf',
                                },
                            }}
                        />
                    </Source>
  • Here is the difference between Marker and Layer. Refer to that document, I believe that using either Marker (HTML) or Layer (Map tile) to render the blue dot does not significantly impact performance since there is only one element in this case.

Evidence

  • Web:
output.mp4
  • Mobile:
Screen.Recording.2024-04-20.at.05.18.36.mov

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Apr 14, 2024
@shahinyan11
Copy link

shahinyan11 commented Apr 14, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Add blue dot showing current location, and center-on-me button.

What is the root cause of that problem?

New feature

What changes do you think we should make in order to solve the problem?

For Web

  1. Add the GeolocateControl component imported from react-map-gl to the Map children
<GeolocateControl ref={geoControlRef} showAccuracyCircle={true} />
  1. Add below geoControlRef.current?.trigger() in here
Screen.Recording.2024-04-17.at.16.27.45.mov

For Native

  1. Add <Mapbox.UserLocation visible={true}/> to the MapBox.mapView children
  2. Add custom Icon for center user location and call below code on icon click
cameraRef.current?.setCamera({
    zoomLevel: CONST.MAPBOX.SINGLE_MARKER_ZOOM,
    animationDuration: 1500,
    centerCoordinate: [currentPosition.longitude, currentPosition.latitude],
});
Screenrecorder-2024-04-17-18-40-12-398.0.mp4

What alternative solutions did you explore? (Optional)

@melvin-bot melvin-bot bot added the Overdue label Apr 16, 2024
@bfitzexpensify bfitzexpensify added the External Added to denote the issue can be worked on by a contributor label Apr 16, 2024
Copy link

melvin-bot bot commented Apr 16, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01f4462a45d6a637d7

@melvin-bot melvin-bot bot changed the title CRITICAL: [P2P Distance] Add blue dot showing current location, and center-on-me button. [$250] CRITICAL: [P2P Distance] Add blue dot showing current location, and center-on-me button. Apr 16, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 16, 2024
Copy link

melvin-bot bot commented Apr 16, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (External)

@bfitzexpensify
Copy link
Contributor

Couple of proposals ready for review @parasharrajat - this one is CRITICAL so please review asap, thank you!

@parasharrajat
Copy link
Member

parasharrajat commented Apr 17, 2024

Both proposals are not very clear. Because the documentation of lib is not very declarative, It would be great if both proposals could explain the results of their changes as well. Good to see visual examples when we are talking about maps.

@nkdengineer Please try to follow our guidelines for updating a proposal. I don't see any comment stating that the proposal was updated. Also, I didn't like the idea of adding criticism to another proposal in your proposal. Let's try to avoid that practice (it can be a new comment).

Could you please also add some visuals on how it will look?

@parasharrajat
Copy link
Member

@shahinyan11 I was looking into the libs documentation but didn't find any good examples. Could you please update your proposal and explain results as well.

geoControlRef.current?.trigger()

Also, I think we should be doing native geolocation of the lib when we use our custom logic to get user location. Is there a way we can reuse the values from getCurrentPosition and just render it on the map using native controls.

@nkdengineer
Copy link
Contributor

@parasharrajat Thanks for your feedback. I updated the proposal to explain the results of the changes.

@shahinyan11
Copy link

Proposal

Updated Added videos for different platforms .
@parasharrajat The web package supports centering on user location functionality but the native package not. And that's why I left the default UI for the web and use random icon for native just to show functionality. And since the description of the problem does not indicate a single icon, I did not pay attention to it

@parasharrajat
Copy link
Member

Also, I think we should be doing native geolocation of the lib when we use our custom logic to get user location. Is there a way we can reuse the values from getCurrentPosition and just render it on the map using native controls.

@shahinyan11 Thoughts?

@shahinyan11
Copy link

shahinyan11 commented Apr 17, 2024

@parasharrajat I can suggest to use Layer an Source to display blue dot . Create a Layer with circle type and add user location in Source data. See example here

@nkdengineer
Copy link
Contributor

@parasharrajat I updated alternative solution

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Monthly KSv2 labels May 30, 2024
Copy link

melvin-bot bot commented Jun 5, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jun 6, 2024
@melvin-bot melvin-bot bot changed the title CRITICAL: [P2P Distance] [$250] Add blue dot showing current location, and center-on-me button. [HOLD for payment 2024-06-13] CRITICAL: [P2P Distance] [$250] Add blue dot showing current location, and center-on-me button. Jun 6, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 6, 2024
Copy link

melvin-bot bot commented Jun 6, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Jun 6, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.79-11 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-06-13. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Jun 6, 2024

BugZero Checklist: The PR adding this new feature has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

@parasharrajat
Copy link
Member

Regression Test Steps

  1. Open app.
  2. Click on "Submit expense" -> "Distance".
  3. Verify that the map displays the blue dot as the current position.
  4. Move the map to any new location.
  5. Click on the "center-me" button.
  6. Verify that the map will animate to the location in which the current position is center.
  7. Select any 2 waypoints.
  8. Drag the map to any new area after waypoints are set on the map.
  9. Click on "center-me" button.
  10. Verify that the app will animate to the area of the current waypoints route.

Do you agree 👍 or 👎 ?

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 12, 2024
@kadiealexander kadiealexander removed their assignment Jun 13, 2024
@bfitzexpensify
Copy link
Contributor

bfitzexpensify commented Jun 14, 2024

Regression steps proposed in https://github.com/Expensify/Expensify/issues/404901

Payment summary:

$500 to @parasharrajat for C+ work to be paid via manual request
$500 to @nkdengineer for contributor work to be paid via Upwork

Previous posting is closed and I'm getting constant errors trying to post on Upwork. Will try again in a bit

@nkdengineer
Copy link
Contributor

@bfitzexpensify This is a CRITICAL-priority issue but it seems to miss the High Priority label, could you help to add it same as this case

Thank you

@bfitzexpensify
Copy link
Contributor

Appreciate the clarification @nkdengineer.

Payment summary updated, and job offer sent via Upwork

@melvin-bot melvin-bot bot removed the Overdue label Jun 17, 2024
@nkdengineer
Copy link
Contributor

Thanks @bfitzexpensify I accepted the offer!

@bfitzexpensify
Copy link
Contributor

Payment complete, closing this one out. Thanks everyone!

@parasharrajat
Copy link
Member

Payment requested as per #40209 (comment)

@JmillsExpensify
Copy link

$500 approved for @parasharrajat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 External Added to denote the issue can be worked on by a contributor High Priority NewFeature Something to build that is a new item.
Projects
No open projects
Status: CRITICAL
Development

No branches or pull requests

9 participants