Skip to content

Conversation

@Guardiola31337
Copy link
Contributor

@Guardiola31337 Guardiola31337 commented Feb 8, 2019

Edited:

  • Adds via silent waypoints support into NavigationRoute

Fixes #1730

Note: current branch is using MAS SNAPSHOT - MAS 4.4.0 needs to be released and the SNAPSHOT dependency removed before this PR can merge.

cc @osana

@Guardiola31337 Guardiola31337 added ⚠️ DO NOT MERGE PR should not be merged! ✓ ready for review feature New feature request. labels Feb 8, 2019
@Guardiola31337 Guardiola31337 added this to the v0.29.0 milestone Feb 8, 2019
@Guardiola31337 Guardiola31337 self-assigned this Feb 8, 2019
Copy link
Contributor

@danesfeder danesfeder left a comment

Choose a reason for hiding this comment

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

@Guardiola31337 some minor comments, thanks for running with this!


String waypoints = options.waypoints();
if (!TextUtils.isEmpty(waypoints)) {
Integer[] splittedWaypointIndices = parseWaypointIndices(waypoints);
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT splitted > split

* @param waypoints integer array of coordinate indices to be used as waypoints
* @return this builder for chaining options together
*/
public Builder addWaypoints(@Nullable @IntRange(from = 0) Integer... waypoints) {
Copy link
Contributor

@danesfeder danesfeder Feb 11, 2019

Choose a reason for hiding this comment

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

It may be better to be more specific with our naming here, as we already have a addWaypoint. Maybe addSilentWaypoint or addViaWaypoint?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I couldn't agree more. Will fix 🚀

@danesfeder
Copy link
Contributor

@Guardiola31337 any ideas what's going on with proguard in CI? 🤔

@codecov-io
Copy link

codecov-io commented Feb 12, 2019

Codecov Report

Merging #1733 into master will increase coverage by 0.09%.
The diff coverage is 89.47%.

@@             Coverage Diff              @@
##             master    #1733      +/-   ##
============================================
+ Coverage     29.91%   30.01%   +0.09%     
  Complexity      843      843              
============================================
  Files           220      220              
  Lines          8134     8147      +13     
  Branches        627      629       +2     
============================================
+ Hits           2433     2445      +12     
  Misses         5471     5471              
- Partials        230      231       +1

@Guardiola31337
Copy link
Contributor Author

Thanks for the feedback @danesfeder this is updated and ready for another round of 👀

any ideas what's going on with proguard in CI? 🤔

It seems something weird happened with the previous build. It's working now ¯\_(ツ)_/¯

if (!TextUtils.isEmpty(waypointTargets)) {
Point[] splittedWaypointTargets = parseWaypointTargets(waypointTargets);
directionsBuilder.addWaypointTargets(splittedWaypointTargets);
Point[] splitdWaypointTargets = parseWaypointTargets(waypointTargets);
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT splitd is not a word: split I think is what you're looking for

Copy link
Contributor Author

Choose a reason for hiding this comment

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

troll

BTW, good catch! Will fix 👍

@Guardiola31337 Guardiola31337 changed the title Add via waypoints support into NavigationRoute Add silent waypoints support into NavigationRoute Feb 12, 2019
Copy link
Contributor

@danesfeder danesfeder left a comment

Choose a reason for hiding this comment

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

Thanks for these updates @Guardiola31337, let's merge when 4.4.0 is good to go 🚢

@Guardiola31337
Copy link
Contributor Author

Guardiola31337 commented Feb 13, 2019

Found 👇 during CI Robo Tests

java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List com.mapbox.api.directions.v5.models.DirectionsResponse.routes()' on a null object reference
FATAL EXCEPTION: ControllerMessenger
Process: com.mapbox.services.android.navigation.app, PID: 13547
java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List com.mapbox.api.directions.v5.models.DirectionsResponse.routes()' on a null object reference
	at com.mapbox.services.android.navigation.v5.navigation.NavigationRoute$1.onResponse(NavigationRoute.java:98)
	at com.mapbox.api.directions.v5.MapboxDirections$1.onResponse(MapboxDirections.java:129)
	at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:70)
	at android.os.Handler.handleCallback(Handler.java:739)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at androidx.test.espresso.base.Interrogator.a(Interrogator.java:19)
	at androidx.test.espresso.base.UiControllerImpl.a(UiControllerImpl.java:164)
	at androidx.test.espresso.base.UiControllerImpl.a(UiControllerImpl.java:156)
	at androidx.test.espresso.base.UiControllerImpl.a(UiControllerImpl.java:34)
	at androidx.test.espresso.action.MotionEvents.a(MotionEvents.java:76)
	at androidx.test.espresso.action.MotionEvents.a(MotionEvents.java:51)
	at androidx.test.espresso.action.Tap.c(Tap.java:8)
	at androidx.test.espresso.action.Tap.a(Tap.java:18)
	at androidx.test.espresso.action.Tap$1.b(Tap.java:3)
	at androidx.test.espresso.action.GeneralClickAction.perform(GeneralClickAction.java:22)
	at androidx.test.espresso.ViewInteraction$SingleExecutionViewAction.perform(ViewInteraction.java:9)
	at androidx.test.espresso.ViewInteraction.a(ViewInteraction.java:79)
	at androidx.test.espresso.ViewInteraction.a(ViewInteraction.java:96)
	at androidx.test.espresso.ViewInteraction$1.call(ViewInteraction.java:3)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at android.os.Handler.handleCallback(Handler.java:739)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:135)
	at android.app.ActivityThread.main(ActivityThread.java:5254)
	at java.lang.reflect.Method.invoke(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:372)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

It seems it happened randomly when jumping between activities fastly i.e. Activity A makes a request 👉 navigate to a different Activity B quickly (so the response callback didn't have enough time to be fired) 👉 when the response listener is called the body is null 👉 💥

Should we add a null check in NavigationRoute to avoid this? It seems like a race condition because of the async requests' nature and how fast Robo tests jump through the different activities. I wasn't able to reproduce this locally.

@Guardiola31337
Copy link
Contributor Author

Should we add a null check in NavigationRoute to avoid this?

Actually, I think it's even a better approach because routes is marked as @NonNull so we don't need to check if response.body().routes() is null.

@danesfeder @devotaaabel have you seen a response with null routes before? Couldn't find anything but I wanted to double check with you that the changes make sense before merging here.

Copy link
Contributor

@danesfeder danesfeder left a comment

Choose a reason for hiding this comment

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

@Guardiola31337 thanks for the updates here and the logic adjustment for the valid route check 🚢

@Guardiola31337 Guardiola31337 merged commit 6bf87c7 into master Feb 13, 2019
@Guardiola31337 Guardiola31337 deleted the pg-1730-via-waypoints branch February 13, 2019 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature request.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants