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

Save location by GPS #6

Closed
subdigital opened this issue Feb 2, 2017 · 3 comments
Closed

Save location by GPS #6

subdigital opened this issue Feb 2, 2017 · 3 comments
Assignees

Comments

@subdigital
Copy link
Collaborator

Tap Edit Location, tap "Use My Location".

  • prompt to use location w/ CLLocationManager
  • on callback, use lat/lng and reverse geocode to get address
  • save these values to UserDefaults, preferrably under a single key w/ a dictionary value
  • clear any saved zip code
  • trigger a refresh (via notification or callback) when upon change
  • IssuesViewController reads the saved location / address and passes to the fetch operation when loading issues.
  • location button title should be changed to match the city from the saved location
@subdigital
Copy link
Collaborator Author

One thing to keep in mind is that we'll have to clear out the saved zip when GPS is used, and clear out the saved GPS if zip is used. The issues view controller will have to prefer using GPS over zip, but check both.

Alternatively we could use another key that specifies which location type was used:

let locationType = UserDefaults.standard.string(for: UserDefaultKeys.locationType.rawValue)
if locationType == "gps" {
  // use saved address
} else if locationType == "zip" {
  // use zip
} else {
  // nil location
}

Up to you.

@chrisbrandow
Copy link
Collaborator

For now, I'm proceeding with "when in use" permissions only.

@subdigital
Copy link
Collaborator Author

subdigital commented Feb 2, 2017 via email

chrisbrandow added a commit that referenced this issue Feb 4, 2017
* 5C-GPSLocation
* added CLLocationManager
* added "when in use" authorization
* lookup the returned location
* added a label to display location (though perhaps it should just be an alert controller for user to confirm they want to use this address)
* still need to handle persistence and the zipcode retrieval logic

* 5C-GPSLocation
mostly finished. need to clean up the fetching, and general cleanup

* 5C-GPSLocation
* cleanup unneeded init in `EditLocationViewController`
* `IssuesContainerViewController`
  * refactored setTitle
  * refactored `updateWith` for zipCode and for lat/long
* updated `IssuesManager` to handle zip or latLong
* updated `FetchIssuesOperation to handle zip or latLong
  * updated execute to append zip or lat long -- confirmed both work
* added LocationInfoKeys

* 5C-GPSLocation
* removed leftover `print`

* reverted an unneeded storyboard change

* * removed unneeded notification name, storyboard change

* Fixes some issues discovered in the PR

* removed old comments from `EditLocationViewController`
* removed unneeded `self` reference in `IssuesContainerViewController`
* made `self` references in VC dismissal closures `[weak self]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants