Skip to content

Commit

Permalink
Release 0.6.3 (#386)
Browse files Browse the repository at this point in the history
* Do not allow rotation for Nav UI (#377)

* Support for multiple reroute metric collection (#348)

* capture sessionState and add to queue when reroute occurs

* Resolved several issues which related to location

* fix checkstyle for NavigationMetricsWrapper

* enable extra logging in debug mode

* add option to log telemetry requests when debug mode is enabled

* seconds no null anymore

* make SessionState fields unique

* add test for ringbuffer peak methods

* create a copy of the location object when snapping a location

* make sure the buffer keeps adding fresh values

* Avoids out of bounds exception in addTrafficToSource() (#384)

* avoids out of bounds exception

* added index out of bounds exception

* Undo throwing exception

* force git to push

* Updated changelog and readme

* More reroute fixes (#389)

* removed collection reverse

* fix lastrerouteseconds

* set the queued reroute events to represent new values

* checkstyle

* fixed total distance completed not getting set

* make sure that the reroute event includes the reroute time as the created timestamp (#398)

* temporarily change circle ci publish branch

* [android] [auto] Update properties to version 0.6.3 in preparation for build.

* change circleci script back to using master
  • Loading branch information
Cameron Mace authored Oct 19, 2017
1 parent 583523c commit a5013e5
Show file tree
Hide file tree
Showing 14 changed files with 149 additions and 89 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ Mapbox welcomes participation and contributions from everyone.

### v0.7.0 - TBD

* Updated to Mapbox Java 3.0 [#373](https://github.com/mapbox/mapbox-navigation-android/pull/373)
* Updated to Mapbox Java 3.0 [#373](https://github.com/mapbox/mapbox-navigation-android/pull/373)

### v0.6.2 - October 7, 2017
### v0.6.3 -October 18, 2017

* significant reroute metric fixes [#348](https://github.com/mapbox/mapbox-navigation-android/pull/348)
* Avoid index out of bounds when drawing route line traffic [#384](https://github.com/mapbox/mapbox-navigation-android/pull/384)

### v0.6.2 - October 7, 2017

* Fixed an issue with the Location Engine not being activated correctly inside the Navigation-UI lib [#321](https://github.com/mapbox/mapbox-navigation-android/pull/321)
* Fixed bottom sheet not getting placed correctly when the device is rotated [#320](https://github.com/mapbox/mapbox-navigation-android/pull/320)
* Fixed missing reroute UI when a navigation session reroute occurs [#319](https://github.com/mapbox/mapbox-navigation-android/pull/319)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The snippet to add to your `build.gradle` file to use this SDK is the following:
```
// Mapbox Navigation SDK for Android
compile 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.6.2'
compile 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.6.3'
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.mapbox.services.android.navigation.testapp.R;
import com.mapbox.services.android.navigation.v5.location.MockLocationEngine;
import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation;
import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigationOptions;
import com.mapbox.services.android.navigation.v5.navigation.NavigationEventListener;
import com.mapbox.services.android.navigation.v5.navigation.NavigationRoute;
import com.mapbox.services.android.navigation.v5.offroute.OffRouteListener;
Expand Down Expand Up @@ -69,7 +70,8 @@ protected void onCreate(Bundle savedInstanceState) {
mapView.getMapAsync(this);

// Initialize MapboxNavigation and add listeners
navigation = new MapboxNavigation(this, Mapbox.getAccessToken());
MapboxNavigationOptions options = MapboxNavigationOptions.builder().isDebugLoggingEnabled(true).build();
navigation = new MapboxNavigation(this, Mapbox.getAccessToken(), options);
navigation.addNavigationEventListener(this);
}

Expand Down
6 changes: 1 addition & 5 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,4 @@ jobs:
fi
- store_artifacts:
path: app/build/reports
destination: reports
notify:
webhooks:
# notify to Slack
- url: https://hooks.slack.com/services/some-hash/some-another-hash/some-another-another-hash
destination: reports
9 changes: 4 additions & 5 deletions libandroid-navigation-ui/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
package="com.mapbox.services.android.navigation.ui.v5"
xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<activity android:name=".NavigationActivity"/>
</application>

</manifest>
<application>
<activity android:name=".NavigationActivity"/>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import com.mapbox.mapboxsdk.style.layers.Property;
import com.mapbox.mapboxsdk.style.layers.PropertyFactory;
import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions;
import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
import com.mapbox.services.Constants;
import com.mapbox.services.android.navigation.ui.v5.R;
import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation;
Expand Down Expand Up @@ -297,7 +297,7 @@ private void addSource(@Nullable DirectionsRoute route) {
if (source == null) {
GeoJsonOptions routeGeoJsonOptions = new GeoJsonOptions().withMaxZoom(16);
GeoJsonSource routeSource = new GeoJsonSource(NavigationMapSources.NAVIGATION_ROUTE_SOURCE,
routeLineFeature, routeGeoJsonOptions);
routeLineFeature, routeGeoJsonOptions);
mapboxMap.addSource(routeSource);
} else {
source.setGeoJson(routeLineFeature);
Expand Down Expand Up @@ -330,13 +330,16 @@ private FeatureCollection addTrafficToSource(DirectionsRoute route) {
if (leg.annotation() != null) {
if (leg.annotation().congestion() != null) {
for (int i = 0; i < leg.annotation().congestion().size(); i++) {
double[] startCoord = lineString.getCoordinates().get(i).getCoordinates();
double[] endCoord = lineString.getCoordinates().get(i + 1).getCoordinates();

LineString congestionLineString = LineString.fromCoordinates(new double[][] {startCoord, endCoord});
Feature feature = Feature.fromGeometry(congestionLineString);
feature.addStringProperty(CONGESTION_KEY, leg.annotation().congestion().get(i));
features.add(feature);
// See https://github.com/mapbox/mapbox-navigation-android/issues/353
if (leg.annotation().congestion().size() + 1 <= lineString.getCoordinates().size()) {
double[] startCoord = lineString.getCoordinates().get(i).getCoordinates();
double[] endCoord = lineString.getCoordinates().get(i + 1).getCoordinates();

LineString congestionLineString = LineString.fromCoordinates(new double[][] {startCoord, endCoord});
Feature feature = Feature.fromGeometry(congestionLineString);
feature.addStringProperty(CONGESTION_KEY, leg.annotation().congestion().get(i));
features.add(feature);
}
}
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,16 @@ public MapboxNavigation(@NonNull Context context, @NonNull String accessToken,
this.context = context;
this.options = options;
this.isFromNavigationUi = options.isFromNavigationUi();
initialize();
initialize(options.isDebugLoggingEnabled());
}

/**
* In-charge of initializing all variables needed to begin a navigation session. Many values can
* be changed later on using their corresponding setter. An internal progressChangeListeners used
* to prevent users from removing it.
*/
private void initialize() {
initializeTelemetry();
private void initialize(boolean debugLoggingEnabled) {
initializeTelemetry(debugLoggingEnabled);

// Initialize event dispatcher and add internal listeners
navigationEventDispatcher = new NavigationEventDispatcher();
Expand All @@ -145,7 +145,7 @@ private void initialize() {
}
}

private void initializeTelemetry() {
private void initializeTelemetry(boolean debugLoggingEnabled) {
validateAccessToken(accessToken);
String sdkIdentifier = MAPBOX_NAVIGATION_SDK_IDENTIFIER;
if (isFromNavigationUi) {
Expand All @@ -156,6 +156,9 @@ private void initializeTelemetry() {
BuildConfig.MAPBOX_NAVIGATION_VERSION_NAME);
MapboxTelemetry.getInstance().newUserAgent(userAgent);

// Enable extra logging in debug mode
MapboxTelemetry.getInstance().setDebugLoggingEnabled(debugLoggingEnabled);

NavigationMetricsWrapper.sdkIdentifier = sdkIdentifier;
NavigationMetricsWrapper.turnstileEvent();
// TODO This should be removed when we figure out a solution in Telemetry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public abstract class MapboxNavigationOptions {

public abstract double minimumDistanceBeforeRerouting();

public abstract boolean isDebugLoggingEnabled();

@AutoValue.Builder
public abstract static class Builder {

Expand Down Expand Up @@ -71,6 +73,8 @@ public abstract static class Builder {

public abstract Builder minimumDistanceBeforeRerouting(double distanceInMeters);

public abstract Builder isDebugLoggingEnabled(boolean debugLoggingEnabled);

public abstract MapboxNavigationOptions build();
}

Expand All @@ -90,6 +94,7 @@ public static Builder builder() {
.minimumDistanceBeforeRerouting(NavigationConstants.MINIMUM_DISTANCE_BEFORE_REROUTING)
.metersRemainingTillArrival(NavigationConstants.METERS_REMAINING_TILL_ARRIVAL)
.enableNotification(true)
.isFromNavigationUi(false);
.isFromNavigationUi(false)
.isDebugLoggingEnabled(false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,6 @@ private RouteProgress generateNewRouteProgress(MapboxNavigation mapboxNavigation
MapboxNavigationOptions options = mapboxNavigation.options();

if (newRoute(directionsRoute)) {
// Need to keep track of total distance traveled even when reroute occurs.
if (previousRouteProgress != null) {
mapboxNavigation.getSessionState().toBuilder().previousRouteDistancesCompleted(
mapboxNavigation.getSessionState().previousRouteDistancesCompleted()
+ previousRouteProgress.distanceTraveled()
);
}
// Decode the first steps geometry and hold onto the resulting Position objects till the users
// on the next step. Indices are both 0 since the user just started on the new route.
stepPositions = PolylineUtils.decode(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import com.mapbox.services.android.telemetry.navigation.MapboxNavigationEvent;
import com.mapbox.services.android.telemetry.utils.TelemetryUtils;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;

final class NavigationMetricsWrapper {
Expand Down Expand Up @@ -81,9 +83,10 @@ static void departEvent(SessionState sessionState, RouteProgress routeProgress,
}

static void rerouteEvent(SessionState sessionState, RouteProgress routeProgress, Location location) {

updateRouteProgressSessionData(routeProgress, sessionState);

MapboxTelemetry.getInstance().pushEvent(MapboxNavigationEvent.buildRerouteEvent(
Hashtable<String, Object> rerouteEvent = MapboxNavigationEvent.buildRerouteEvent(
sdkIdentifier, BuildConfig.MAPBOX_NAVIGATION_VERSION_NAME, sessionState.sessionIdentifier(),
location.getLatitude(), location.getLongitude(),
sessionState.currentGeometry(), routeProgress.directionsRoute().routeOptions().profile(),
Expand All @@ -105,8 +108,9 @@ static void rerouteEvent(SessionState sessionState, RouteProgress routeProgress,
routeProgress.currentLegProgress().currentStep().duration().intValue(),
(int) routeProgress.currentLegProgress().currentStepProgress().distanceRemaining(),
(int) routeProgress.currentLegProgress().currentStepProgress().durationRemaining(),
sessionState.currentStepCount(), sessionState.originalStepCount()
));
sessionState.currentStepCount(), sessionState.originalStepCount());
rerouteEvent.put(MapboxNavigationEvent.KEY_CREATED, TelemetryUtils.generateCreateDate(location));
MapboxTelemetry.getInstance().pushEvent(rerouteEvent);
}

static void feedbackEvent(SessionState sessionState, RouteProgress routeProgress, Location location,
Expand Down Expand Up @@ -141,12 +145,12 @@ static void turnstileEvent() {
);
}

private static Location[] obtainLocations(List<Location> rerouteLocations) {
Location[] locations = new Location[0];
if (rerouteLocations != null && !rerouteLocations.isEmpty()) {
locations = rerouteLocations.toArray(new Location[0]);
private static Location[] obtainLocations(List<Location> locations) {
// Check if the list of locations is empty and if so return an empty array
if (locations == null || locations.isEmpty()) {
return new Location[0];
}
return locations;
return locations.toArray(new Location[locations.size()]);
}

private static void updateRouteProgressSessionData(RouteProgress routeProgress, SessionState sessionState) {
Expand All @@ -173,10 +177,21 @@ private static void updateRouteProgressSessionData(RouteProgress routeProgress,
previousModifier = routeProgress.currentLegProgress().currentStep().maneuver().modifier();
}

// Check if location update happened before or after the reroute
List<Location> afterLoc = new ArrayList<>();

if (sessionState.afterRerouteLocations() != null) {
for (Location loc : sessionState.afterRerouteLocations()) {
if (loc.getTime() > sessionState.rerouteDate().getTime()) {
afterLoc.add(loc);
}
}
}

previousName = routeProgress.currentLegProgress().currentStep().name();

beforeLocations = obtainLocations(sessionState.beforeRerouteLocations());

afterLocations = obtainLocations(sessionState.afterRerouteLocations());
afterLocations = obtainLocations(afterLoc);
}
}
Loading

0 comments on commit a5013e5

Please sign in to comment.