-
Notifications
You must be signed in to change notification settings - Fork 319
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
Added flag to ignore route line updates in the view under certain con… #6974
Conversation
ChangelogFeaturesBug fixes and improvements
Known issues
|
ed47799
to
151dace
Compare
Codecov Report
@@ Coverage Diff @@
## main #6974 +/- ##
============================================
- Coverage 73.49% 73.26% -0.23%
+ Complexity 5796 5730 -66
============================================
Files 799 789 -10
Lines 31205 30971 -234
Branches 3670 3658 -12
============================================
- Hits 22933 22691 -242
- Misses 6798 6805 +7
- Partials 1474 1475 +1
|
this.alternativeRouteLinesData.map { it.dynamicData }, | ||
maskingLayerData | ||
).also { | ||
it.ignorePrimaryRouteLineData = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be dangerous:
- We set this flag to true;
- We pass
RouteLineUpdateValue
to the client via consumer; - They do something in their consumer which results in passing us not the original object but its copy (
toMutableValue/toImmutableValue
); - We lose the flag.
It sounds artificial but who knows. I think we should transfer the flag value between mutable/immutable (we can do that and it seems like the only way the customer can modify the object).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What you point out is true. However, before beta.3 this data was never returned in this code execution path. The only reason this was introduced was because the masking layers were added in this release and they had to be created and rendered here. The main route line data is included ONLY because the field is non-nullable. If the field had been nullable the main route line parameter would have been null. So even in the possibility you outline the data shouldn't be rendered and wouldn't be if the field had been nullable or could be changed to nullable (without breaking SEMVER).
The flag is introduced solely as a workaround for not being able to exclude the main route line data in a more elegant way and to get this method back to the state it was in prior to beta.3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flag is introduced solely as a workaround for not being able to exclude the main route line data in a more elegant way and to get this method back to the state it was in prior to beta.3.
I get that, no objections to that.
What I mean is imagine the situation:
private val routeProgressObserver = RouteProgressObserver { routeProgress ->
routeLineApi.updateWithRouteProgress(routeProgress) { result ->
val modifiedResult = result.onValue { it.toMutableValue()/** some changes **/.toImmutableValue() }
mapboxMap.getStyle()?.apply {
routeLineView.renderRouteLineUpdate(this, modifiedResult)
}
}
}
This is possible, right? It doesn't have anything to do with beta.3. But with these modifications we lose the flag. Which I think shouldn't be the case. If we add a new property to the model class (even though it's internal), toMutableValue + toImmutableValue
should keep it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes good point, added.
fc97dc1
to
9447ef5
Compare
@@ -35,14 +39,18 @@ class RouteLineUpdateValue internal constructor( | |||
var routeLineMaskingLayerDynamicData: RouteLineDynamicData? = null | |||
) { | |||
|
|||
internal var ignorePrimaryRouteLineData = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: I'd specify default value only once as a constant.
9447ef5
to
ce60430
Compare
Description
mapbox/mapbox-navigation-android#6742 Introduced a feature to display the active route leg above inactive route legs. A customer found a case in their automated testing that showed an incorrect vanishing point when the route first began after upgrading to the release that included this feature. The customer indicated the issue wasn't observed during real drive testing.
In order to keep from breaking SEMVER the class used for updating the masking layers required a non-null primary route line data object. The implementation in PR 6742 made a call to get the primary route line data and include it which meant re-rendering the primary route line in the view on route progress. This new behavior seems to be involved in the erroneous behavior reported. Since the use case in question doesn't need to update the primary route line data and it was only included because the parameter is non-null the re-rendering was removed by adding a boolean flag indicating if the rendering of the primary route line data should occur. Adding this results in the primary route line data not being rendered in route line progress updates as was the case before the feature described in 6742 was implemented.
Screenshots or Gifs