yuunster / NomNomMap

Log your meals, track your nutrition, and share with friends!
0 stars 0 forks source link

Current Location does not get updated when user moves to new location #25

Closed yuunster closed 11 months ago

yuunster commented 11 months ago

When logging a meal, uses the coordinates of the user when the app was first launched.

Solution: Fetch new coordinates when logging a meal

yuunster commented 11 months ago

since currentLocation variable is redefined during setUpMap(), and setUpMap() is only run during onMapReady(), the coordinates are only updated whenever the map is set up. This occurs during fragment creation as well as whenever the fragment is revisited. For example, if the user changes location, then navigates to a different fragment and then back to the map fragment, then onMapReady() will be run which will update the current coordinates. However, if the user changes location while on the map fragment and then logs a meal, their last saved location will be used (the last time the fragment was created/navigated to)