-
Notifications
You must be signed in to change notification settings - Fork 320
Remove stopTripSession from ReplayRouteSession #6817
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
Conversation
ChangelogFeatures
Bug fixes and improvements
Known issues
|
797c007
to
eeb1f15
Compare
eeb1f15
to
ed60c82
Compare
Codecov Report
@@ Coverage Diff @@
## main #6817 +/- ##
============================================
- Coverage 72.64% 72.63% -0.01%
+ Complexity 5569 5568 -1
============================================
Files 780 780
Lines 30104 30101 -3
Branches 3553 3556 +3
============================================
- Hits 21869 21864 -5
- Misses 6808 6809 +1
- Partials 1427 1428 +1
|
libnavigation-core/src/main/java/com/mapbox/navigation/core/replay/route/ReplayRouteSession.kt
Show resolved
Hide resolved
libnavigation-core/src/main/java/com/mapbox/navigation/core/trip/session/MapboxTripSession.kt
Show resolved
Hide resolved
} | ||
tripSessionLocationEngine.startLocationUpdates(withReplayEnabled, onRawLocationUpdate) |
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.
Maybe we need to call NativeNavigaot#resetRideSession
so that native navigator doesn't consider first location updates from new location engine as an error?
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.
🤔 yeah. A new location engine seems like a good reason to reset. I'm hesitant, should it go inside the startTripSession
? Let's consider it in another change. The caller still has the ability to call it or not call it. Right now ReplayRouteSession calls it when the route changes. We can add it there before forcing it everywhere.
Lines 117 to 119 in 61415ea
private fun MapboxNavigation.resetReplayLocation() { | |
mapboxReplayer.clearEvents() | |
resetTripSession { |
ed60c82
to
0b5430a
Compare
0b5430a
to
370f0ab
Compare
replayLocationEngine | ||
} else { | ||
navigationOptions.locationEngine | ||
} | ||
locationEngine.requestLocationUpdates( | ||
activeLocationEngine?.requestLocationUpdates( |
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.
requestLocationUpdates
can be invoked multiple times with different callbacks and all of them will receive location updates.
So my question is: is stopping location updates here the right way to go? I mean what if we want to invoke startLocationUpdates
twice with different onRawLocationUpdate
? Right now the second invocation will cancel the first one.
By the way, having a single locationEngineCallback
guarantees that there will be only one location update, but is this designed? Eve if we remove stopLocationUpdates
from here the situation won't change: we'll still be getting raw location updates only in the second lambda.
I mean it's not clear from the API that that's the behaviour. So I'm asking whether it's how it's supposed to be.
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.
is stopping location updates here the right way to go? I mean what if we want to invoke startLocationUpdates twice with different onRawLocationUpdate? Right now the second invocation will cancel the first one.
It is built to manage a single location engine subscription, because it would be sending duplicates if it had more than one subscription. The activeLocationEngine
can change based on parameters, so it is unregistering to whatever the previous engine is.
There could be improvements to the logic, but i'm not seeing why it would be needed. Do you see an issue?
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.
I'm only saying that it's not obvious how to use this API. It looks like you can invoke startLocationUpdates
twice with different callbacks, receive updates to both callbacks and then stop everything via stopLocationUpdates
.
As long as we use the API correctly, there is no issue.
Description
Resolves https://mapbox.atlassian.net/browse/NAVAND-320
Resolves #6056
There is an internal requirement to first call
stopTripSession
before you can callstartReplayTripSession
. This pull request is fixing that. This will make it so the caller can convert a regular trip session into a replay session.I'm finding that this issue needs to be resolved before resolving this issue #6794. Anything that observes the trip session state receives rapid changes when enabling replay.