Skip to content

Commit 331cefc

Browse files
add telem cancel rating and comment track support (#617)
1 parent 5d474aa commit 331cefc

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

mapbox/libandroid-telemetry/src/main/java/com/mapbox/services/android/telemetry/MapboxTelemetry.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,4 +830,21 @@ public void addPercentTimeInPortrait(@IntRange(from = 0, to = 100) int percentTi
830830
Hashtable<String, Object> eventWithAttributes) {
831831
eventWithAttributes.put(MapboxNavigationEvent.KEY_PERCENT_TIME_IN_PORTRAIT, percentTimeInPortrait);
832832
}
833+
834+
// For internal use only
835+
// This is an experimental API. Experimental APIs are quickly evolving and
836+
// might change or be removed in minor versions.
837+
@Experimental
838+
public void addRatingToCancel(@IntRange(from = -1, to = 100) int rating,
839+
Hashtable<String, Object> eventWithAttributes) {
840+
eventWithAttributes.put(MapboxNavigationEvent.KEY_RATING, rating);
841+
}
842+
843+
// For internal use only
844+
// This is an experimental API. Experimental APIs are quickly evolving and
845+
// might change or be removed in minor versions.
846+
@Experimental
847+
public void addCommentToCancel(String comment, Hashtable<String, Object> eventWithAttributes) {
848+
eventWithAttributes.put(MapboxNavigationEvent.KEY_COMMENT, comment);
849+
}
833850
}

mapbox/libandroid-telemetry/src/main/java/com/mapbox/services/android/telemetry/http/TelemetryClient.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ private void sendEventsWrapped(Vector<Hashtable<String, Object>> events, Callbac
235235
jsonObject.putOpt(MapboxNavigationEvent.KEY_DISTANCE, evt.get(MapboxNavigationEvent.KEY_DISTANCE));
236236
jsonObject.putOpt(MapboxNavigationEvent.KEY_ORIGINAL_STEP_COUNT,
237237
evt.get(MapboxNavigationEvent.KEY_ORIGINAL_STEP_COUNT));
238+
jsonObject.putOpt(MapboxNavigationEvent.KEY_RATING, evt.get(MapboxNavigationEvent.KEY_RATING));
239+
jsonObject.putOpt(MapboxNavigationEvent.KEY_COMMENT, evt.get(MapboxNavigationEvent.KEY_COMMENT));
238240

239241
// Build the JSON but only if there's a value for it in the evt
240242
jsonObject.putOpt(MapboxEvent.KEY_EVENT, evt.get(MapboxEvent.KEY_EVENT));

mapbox/libandroid-telemetry/src/main/java/com/mapbox/services/android/telemetry/navigation/MapboxNavigationEvent.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ public class MapboxNavigationEvent {
7676
public static final String KEY_ABSOLUTE_DISTANCE_TO_DESTINATION = "absoluteDistanceToDestination";
7777
public static final String KEY_PERCENT_TIME_IN_FOREGROUND = "percentTimeInForeground";
7878
public static final String KEY_PERCENT_TIME_IN_PORTRAIT = "percentTimeInPortrait";
79+
public static final String KEY_RATING = "rating";
80+
public static final String KEY_COMMENT = "comment";
7981

8082
// Step metadata
8183
public static final String KEY_UPCOMING_INSTRUCTION = "upcomingInstruction";

0 commit comments

Comments
 (0)