Skip to content

Conversation

@JunDai
Copy link
Contributor

@JunDai JunDai commented May 7, 2020

Description

Fix #2895

As #2855 has been merged into Core SDK, the UI SDK should adopt it and expose a way to the developer so they could benefit from it in the drop-in UI as well.

  • I have added any issue links
  • I have added all related labels (bug, feature, new API(s), SEMVER, etc.)
  • I have added the appropriate milestone and project boards

Goal

Please describe the PR goals. Just the stuff needed to implement the fix / feature and a simple rationale. It could contain many check points if needed

Implementation

  • Add ArrivalObserver into the NavigationViewOptions.
  • Remove the original RouteListener's onArrival and onFinalDestinationArrival method which are replaced by the ArrivalObserver
  • Remove unused method in the RouteUtils
  • Update the example BuildingFootprintHighlightActivityKt

Screenshots or Gifs

Please include all the media files to give some context about what's being implemented or fixed. It's not mandatory to upload screenshots or gifs, but for most of the cases it becomes really handy to get into the scope of the feature / bug being fixed and also it's REALLY useful for UI related PRs screenshot gif

Testing

Please describe the manual tests that you ran to verify your changes

  • I have tested locally (including SNAPSHOT upstream dependencies if needed) through testapp/demo app and run all activities to avoid regressions
  • I have tested via a test drive, or a simulation/mock location app
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have updated the CHANGELOG including this PR

@JunDai JunDai added ✓ ready for review backwards incompatible Requires a SEMVER major version change. UI Work related to visual components, Android Auto, Camera, 3D, voice, etc. labels May 7, 2020
@JunDai JunDai requested review from a team, Guardiola31337, kmadsen and langsmith May 7, 2020 18:57
@JunDai JunDai self-assigned this May 7, 2020
@JunDai JunDai force-pushed the jd-quick-fix branch 2 times, most recently from 0426a2a to 5254312 Compare May 7, 2020 19:55
// Not needed in this example
return true
override fun onStopArrival(routeLegProgress: RouteLegProgress) {
// todo: no op
Copy link
Contributor

Choose a reason for hiding this comment

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

What does // todo: no op mean? Can we leave a clearer message? What's the TODO?

For now, maybe just // Empty because this callback's not needed in this example

import com.mapbox.navigation.base.trip.model.RouteProgressState
import timber.log.Timber

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's remove the RouteUtils altogether for now. What do you think? Currently is never used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good to me. I am kind of hesitate to so because we might are lacking some features somewhere which needs the rest of the methods.

but we could remove it now and bring it back when necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

yagni

* the {@link DirectionsRoute}. The final destination is the same as the final
* {@link com.mapbox.api.directions.v5.models.DirectionsWaypoint} along the route.
*/
void onFinalDestinationArrival();
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe separate discussion but @langsmith had some concerns with the current naming for ArrivalObserver's methods we might want to use this in there cc @kmadsen

Copy link
Contributor

Choose a reason for hiding this comment

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

I think let's do that in a separate pr

Copy link
Contributor

Choose a reason for hiding this comment

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

Feel free to cut a follow up ticket @langsmith so we don't forget 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest to use onFinalDestinationArrival over onRouteArrival? onStopArrival may not be best either.

Feel free to suggest, the effort was mostly on functionality. Have been thinking these could be better. But would like to see what others think too!

onWaypointDeparture
onFinalDestinationArrival

Copy link
Contributor

Choose a reason for hiding this comment

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

yea, I had waypoint in mind as well because we refer to waypoints in a lot of nav sdk documentation rather than stops. Waypoints is the Directions API terminology too https://docs.mapbox.com/api/navigation/#waypoint-object

Copy link
Contributor

Choose a reason for hiding this comment

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

Feel free to cut a follow up ticket @langsmith so we don't forget 😅

Will do

Copy link
Contributor

Choose a reason for hiding this comment

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

Feel free to cut a follow up ticket @langsmith so we don't forget 😅

#2933

@codecov-io
Copy link

Codecov Report

Merging #2928 into master will decrease coverage by 0.02%.
The diff coverage is 0.00%.

@@             Coverage Diff              @@
##             master    #2928      +/-   ##
============================================
- Coverage     36.32%   36.30%   -0.03%     
+ Complexity     2194     2190       -4     
============================================
  Files           550      550              
  Lines         19887    19872      -15     
  Branches       1887     1885       -2     
============================================
- Hits           7224     7214      -10     
+ Misses        11832    11826       -6     
- Partials        831      832       +1     

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backwards incompatible Requires a SEMVER major version change. UI Work related to visual components, Android Auto, Camera, 3D, voice, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make the UI SDK compatible with new arrival events implemented in core

5 participants