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

Check Turn / Then Banner on each update #696

Merged
merged 4 commits into from Feb 14, 2018
Merged

Conversation

danesfeder
Copy link
Contributor

  • Previously would only check when new step was found
  • Fixes bug with then banner not showing after medium alert level

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.

Some minor comments to take into account before merging this PR

@@ -98,7 +98,7 @@ private void thenStep(LegStep upcomingStep, LegStep followOnStep, double current
thenStepManeuverType = followOnStep.maneuver().type();
thenStepManeuverModifier = followOnStep.maneuver().modifier();
// Should show then step if the upcoming step is less than 25 seconds
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is now lying. This is an example of why I'm not a big fan of comments :trollface:

Copy link
Contributor

Choose a reason for hiding this comment

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

The best comment is a good name for a method or class.

or variable in this case 😛
👀 Code Smells 👉 Comments

@@ -98,7 +98,7 @@ private void thenStep(LegStep upcomingStep, LegStep followOnStep, double current
thenStepManeuverType = followOnStep.maneuver().type();
thenStepManeuverModifier = followOnStep.maneuver().modifier();
// Should show then step if the upcoming step is less than 25 seconds
shouldShowThenStep = upcomingStep.duration() <= (25d * 1.2d) && currentDurationRemaining <= (70d * 1.2d);
shouldShowThenStep = upcomingStep.duration() <= (25d * 1.2d) && currentDurationRemaining <= 70d;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we fix the variable name to reflect what actually is doing? This way comment will become superfluous so it won't be necessary.

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 decomposing conditional extracting that complicated expression into a well-named private method? Conditionals tend to get more and more complicated in their logic over time.

Copy link
Contributor

Choose a reason for hiding this comment

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

Magic numbers.

String maneuverViewModifier = model.getStepResources().getManeuverViewModifier();
double durationRemaining = model.getProgress().currentLegProgress().currentStepProgress().durationRemaining();

if (turnLanes != null && !TextUtils.isEmpty(maneuverViewModifier) && durationRemaining <= 70d) {
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 simplifying this conditional? 👀 Decompose Conditional

Copy link
Contributor

Choose a reason for hiding this comment

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

Magic number.

@danesfeder
Copy link
Contributor Author

@Guardiola31337 Comments addressed 🍍

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.

Small comment not blocking the PR.
Great job :shipit:

shouldShowThenStep = validStepDuration(upcomingStep, currentDurationRemaining);
}

private boolean validStepDuration(LegStep upcomingStep, double currentDurationRemaining) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor detail, what about isValidStepDuration instead?

@danesfeder danesfeder merged commit e3bd67b into master Feb 14, 2018
@danesfeder danesfeder deleted the dan-delay-then-banner branch February 14, 2018 18:11
@danesfeder danesfeder mentioned this pull request Feb 26, 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.

None yet

2 participants