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

Fix route requests that include waypoint names #1260

Merged
merged 1 commit into from
Sep 7, 2018

Conversation

danesfeder
Copy link
Contributor

@danesfeder danesfeder commented Sep 5, 2018

Fixes #1160

TODO:

  • Add RouteUtils test

@danesfeder danesfeder added bug Defect to be fixed. ⚠️ DO NOT MERGE PR should not be merged! navigation-core labels Sep 5, 2018
@danesfeder danesfeder self-assigned this Sep 5, 2018
@danesfeder danesfeder added this to the 0.19.0 milestone Sep 5, 2018
@danesfeder danesfeder force-pushed the dan-remaining-waypointnames branch 2 times, most recently from 43075ba to 870acb6 Compare September 5, 2018 14:09
@danesfeder
Copy link
Contributor Author

Tests added, this is ready for 👀 @Guardiola31337 @devotaaabel

@danesfeder danesfeder added ✓ ready for review and removed ⚠️ DO NOT MERGE PR should not be merged! labels Sep 5, 2018
@danesfeder danesfeder merged commit d9aadb8 into master Sep 7, 2018
@danesfeder danesfeder deleted the dan-remaining-waypointnames branch September 7, 2018 18:26
Copy link
Contributor

@Guardiola31337 Guardiola31337 left a comment

Choose a reason for hiding this comment

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

Although this PR is already merged, going to leave a couple of comments for checking in the future.

public String[] calculateRemainingWaypointNames(RouteProgress routeProgress) {
RouteOptions routeOptions = routeProgress.directionsRoute().routeOptions();
if (routeOptions == null || TextUtils.isEmpty(routeOptions.waypointNames())) {
return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

We should consider returning a Null Object instead or even better try to getting rid of it at all (maybe returning an empty list?). If not, code becomes defensive and full of null checks.

👀 Null References: The Billion Dollar Mistake

* @since 0.19.0
*/
@Nullable
public String[] calculateRemainingWaypointNames(RouteProgress routeProgress) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is only used in RouteFetcher#addWaypointNames why we need to expose it as a public API here in RouteUtils?

IMO, objects and methods should live/be where their context is. From my experience utility classes become a drawer easily and we should treat them carefully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Defect to be fixed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants