AmericanWhitewater / aw-ios

American Whitewater's iOS app
5 stars 2 forks source link

Calculate reach distances when user location is updated. #257

Closed Gregliest closed 2 years ago

Gregliest commented 2 years ago

This PR calculates the user's distance to the reaches when their location is updated. Formerly, this update was only happening if the user's location got updated on the map view.

The code is a bit hacky. The constraints are:

  1. lat/lng are stored as Strings instead of numbers, which makes comparison and calculations costly.
  2. the distances are updated to core data.

Both of these constraints make it difficult to do this calculation quickly. Ideally, we would perform this calculation at the time it's needed (on the run list or map view controller). If we end up ripping out core data, we can change the data types, and clean everything up.

Hopefully this fixes https://github.com/AmericanWhitewater/aw-ios/issues/239,