-
Notifications
You must be signed in to change notification settings - Fork 320
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
Support EV route refresh #6511
Support EV route refresh #6511
Conversation
updatedRoutes[0].getSocAnnotationsFromLeg(1)!!.firstLastAnd(legGeometryIndex) | ||
) | ||
assertEquals( | ||
listOf(null, 8097, null), |
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 check fails for now because I've used the real Directions API response to form our test response but it returned less waypoints than I expected (and than as described in their docs). I've asked Mandeep a corresponding question.
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 fixed a bug, I've updated the mocked response appropriately. Should be working now.
7eab1b6
to
c0be5ad
Compare
I've added a DO NOT MERGE label because some changes may be required after #6005 is merged. |
libnavigation-base/src/main/java/com/mapbox/navigation/base/internal/RouteRefreshRequestData.kt
Outdated
Show resolved
Hide resolved
...igation-base/src/main/java/com/mapbox/navigation/base/internal/route/AnnotationsRefresher.kt
Show resolved
Hide resolved
...igation-base/src/main/java/com/mapbox/navigation/base/internal/route/AnnotationsRefresher.kt
Outdated
Show resolved
Hide resolved
libnavigation-base/src/main/java/com/mapbox/navigation/base/internal/route/NavigationRouteEx.kt
Outdated
Show resolved
Hide resolved
libnavigation-base/src/main/java/com/mapbox/navigation/base/internal/route/NavigationRouteEx.kt
Outdated
Show resolved
Hide resolved
libnavigation-base/src/main/java/com/mapbox/navigation/base/internal/route/NavigationRouteEx.kt
Outdated
Show resolved
Hide resolved
c0be5ad
to
93fb66d
Compare
Codecov Report
@@ Coverage Diff @@
## main #6511 +/- ##
============================================
+ Coverage 70.26% 70.33% +0.07%
- Complexity 4918 4941 +23
============================================
Files 722 724 +2
Lines 28044 28148 +104
Branches 3305 3320 +15
============================================
+ Hits 19705 19798 +93
- Misses 7064 7074 +10
- Partials 1275 1276 +1
|
libnavigation-base/src/main/java/com/mapbox/navigation/base/internal/utils/Constants.java
Outdated
Show resolved
Hide resolved
libnavigation-core/src/main/java/com/mapbox/navigation/core/EVDataUpdater.kt
Outdated
Show resolved
Hide resolved
libnavigation-core/src/main/java/com/mapbox/navigation/core/EVDataUpdater.kt
Outdated
Show resolved
Hide resolved
libnavigation-core/src/main/java/com/mapbox/navigation/core/MapboxNavigation.kt
Outdated
Show resolved
Hide resolved
...igation-core/src/main/java/com/mapbox/navigation/core/routerefresh/RouteRefreshController.kt
Outdated
Show resolved
Hide resolved
libnavigation-router/src/main/java/com/mapbox/navigation/route/internal/WaypointsParser.kt
Show resolved
Hide resolved
...avigator/src/main/java/com/mapbox/navigation/navigator/internal/MapboxNativeNavigatorImpl.kt
Outdated
Show resolved
Hide resolved
a8c2e1a
to
4709124
Compare
public final class Constants { | ||
|
||
public static final class RouteResponse { | ||
public static final String KEY_WAYPOINTS = "waypoints"; | ||
} | ||
} |
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.
Why Java? object
can be nested as well.
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.
Because in kotlin this code:
object ConstantsKt {
object RouteResponse {
const val KEY_WAYPOINTS = "waypoints"
}
}
looks like this:
public final class ConstantsKt {
@NotNull
public static final ConstantsKt INSTANCE;
private ConstantsKt() {
}
static {
ConstantsKt var0 = new ConstantsKt();
INSTANCE = var0;
}
@Metadata(
mv = {1, 5, 1},
k = 1,
d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\bÆ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000¨\u0006\u0005"},
d2 = {"Lcom/mapbox/navigation/base/internal/utils/ConstantsKt$RouteResponse;", "", "()V", "KEY_WAYPOINTS", "", "mapbox-navigation-android.libnavigation-base.main"}
)
public static final class RouteResponse {
@NotNull
public static final String KEY_WAYPOINTS = "waypoints";
@NotNull
public static final ConstantsKt.RouteResponse INSTANCE;
private RouteResponse() {
}
static {
ConstantsKt.RouteResponse var0 = new ConstantsKt.RouteResponse();
INSTANCE = var0;
}
}
}
Isn't it too much for a string constant?
I can add the JvmStatic
annotation, but it's not much better.
Do you have anything against java? I can easily convert it to kotlin but I think that for the purposes like this (when you just need a holder for some constants) java is better (probably the only situation where I'd say this).
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've wanted to try AutoValue classes written in java instead of writing custom equals, hashcode, toString for a long time but I'm too lazy to explore how java files affect compilation time in our project. Did you check if there are any possible issues we could have compiling java + kotlin in one project?
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.
Did you check if there are any possible issues we could have compiling java + kotlin in one project?
When you add kotlin to a java project compilation time increases. In the other direction it should be fine. In my experience 2 languages work fine.
Right now I don't see a regression. I've run the compilation several times and the time is between 1m 40s and 1m 50s with no obvious leader (sometimes one option is faster, sometimes the other).
But if you are worried there may be some issues, I can convert to kotlin.
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.
Converted to kotlin.
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.
Thanks, that's an interesting point of view. I guess it's a general problem with object
s that they are just singletons under the hood after compilation. Either way would work, I was just curious what was the motivation.
@@ -1665,6 +1665,38 @@ class MapboxNavigation @VisibleForTesting internal constructor( | |||
developerMetadataAggregator.unregisterObserver(developerMetadataObserver) | |||
} | |||
|
|||
/** | |||
* Invoke when any component of EV data is changed so that it can be used in refresh requests. | |||
* Pass **only changed** components of EV data via [data]. |
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.
* Pass **only changed** components of EV data via [data]. | |
* |
As below, providing all the data at all times is not a problem.
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.
It's not a problem but I want to specify that it's not necessary to implement the caching on the app side. Changed the docs.
libnavigation-core/src/main/java/com/mapbox/navigation/core/MapboxNavigation.kt
Outdated
Show resolved
Hide resolved
Some minor comments above and let's wait for #6005 (if we need to) but in general LGTM! |
4709124
to
26f6ad3
Compare
Whoever merges first will leave the second person supporting these changes. :) |
85b3180
to
208b7fb
Compare
6a84243
to
6e96401
Compare
6e96401
to
fdd23c3
Compare
#6005 has landed |
|
Description
The PR has the following parts (split into the corresponding commits):