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

Allow locationFor(styleManager:) to optionally return location #1523

Merged
merged 3 commits into from
Jun 25, 2018

Conversation

bsudekum
Copy link
Contributor

Closes: #1511

This makes StyleManager.locationFor(styleManager:) allows developer to optionally return a location. The optionality we do in

public func locationFor(styleManager: StyleManager) -> CLLocation {
guard let location = routeController.location else {
if let coordinate = routeController.routeProgress.route.coordinates?.first {
return CLLocation(latitude: coordinate.latitude, longitude: coordinate.longitude)
} else {
return CLLocation()
}
}
return location
}

doesn't seem to help us much in the case where routeController.location is nil.

/cc @mapbox/navigation-ios


return location
public func locationFor(styleManager: StyleManager) -> CLLocation? {
return routeController.location
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return routeController.location ?? routeController.routeProgress.route.coordinates?.first to make sure we have a location when we first apply day/night style? Should be safe to assume that the first coordinate on the route is in the same timezone as the user.

Copy link
Contributor

@JThramer JThramer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@bsudekum bsudekum merged commit dc9f1e9 into master Jun 25, 2018
@1ec5 1ec5 added the backwards incompatible changes that break backwards compatibility of public API label Dec 18, 2018
@1ec5 1ec5 added this to the v0.19.0 milestone Dec 18, 2018
@1ec5 1ec5 deleted the optionally-return branch December 5, 2019 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backwards incompatible changes that break backwards compatibility of public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants