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

Validate route profile passed into RouteViewModel #829

Merged
merged 3 commits into from
Apr 11, 2018

Conversation

danesfeder
Copy link
Contributor

Currently, we would use whatever profile a user sets, breaking the route requests.

Found this because we were defaulting the profile to "1" in the settings XML.

@danesfeder danesfeder added bug Defect to be fixed. navigation-ui labels Apr 5, 2018
@danesfeder danesfeder self-assigned this Apr 5, 2018
@danesfeder danesfeder changed the title Valid route profile passed into RouteViewModel Validate route profile passed into RouteViewModel Apr 5, 2018
@danesfeder danesfeder force-pushed the dan-validate-route-profile branch 2 times, most recently from 9a418c5 to 8ba0179 Compare April 6, 2018 22:00
*/
public static boolean isValidRouteProfile(String routeProfile) {
return !TextUtils.isEmpty(routeProfile)
&& routeProfile.contentEquals(DirectionsCriteria.PROFILE_DRIVING_TRAFFIC)
Copy link
Contributor

Choose a reason for hiding this comment

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

What about extracting the valid profiles into a collection and query only once (instead of 4 as is right now)? Does that make sense?


assertTrue(isValidProfile);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

It'd be great to add tests around the other valid profiles (i.e. PROFILE_DRIVING, PROFILE_CYCLING and PROFILE_WALKING).

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.

🚀

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.

:shipit:

@danesfeder danesfeder merged commit 85c29c2 into master Apr 11, 2018
@danesfeder danesfeder deleted the dan-validate-route-profile branch April 11, 2018 14:14
@danesfeder danesfeder added this to the v0.13.0 milestone Apr 11, 2018
@danesfeder danesfeder mentioned this pull request May 3, 2018
13 tasks
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