Search in sources :

Example 1 with FeedbackEvent

use of com.mapbox.services.android.navigation.v5.navigation.metrics.FeedbackEvent in project mapbox-navigation-android by mapbox.

the class NavigationTelemetry method cancelFeedback.

/**
 * Cancels an existing feedback event generated by {@link MapboxNavigation#recordFeedback(String, String, String)}.
 * <p>
 * Uses a feedback ID to find the correct event and then cancels it (will no longer be recorded).
 *
 * @param feedbackId generated from {@link MapboxNavigation#recordFeedback(String, String, String)}
 */
void cancelFeedback(String feedbackId) {
    // Find the event and remove it from the queue
    FeedbackEvent feedbackEvent = (FeedbackEvent) findQueuedTelemetryEvent(feedbackId);
    queuedFeedbackEvents.remove(feedbackEvent);
}
Also used : FeedbackEvent(com.mapbox.services.android.navigation.v5.navigation.metrics.FeedbackEvent)

Example 2 with FeedbackEvent

use of com.mapbox.services.android.navigation.v5.navigation.metrics.FeedbackEvent in project mapbox-navigation-android by mapbox.

the class NavigationTelemetry method checkFeedbackQueue.

private void checkFeedbackQueue() {
    Iterator<FeedbackEvent> iterator = queuedFeedbackEvents.listIterator();
    while (iterator.hasNext()) {
        FeedbackEvent feedbackEvent = iterator.next();
        if (shouldSendEvent(feedbackEvent.getSessionState())) {
            sendFeedbackEvent(feedbackEvent);
            iterator.remove();
        }
    }
}
Also used : FeedbackEvent(com.mapbox.services.android.navigation.v5.navigation.metrics.FeedbackEvent)

Example 3 with FeedbackEvent

use of com.mapbox.services.android.navigation.v5.navigation.metrics.FeedbackEvent in project mapbox-navigation-android by mapbox.

the class NavigationTelemetry method queueFeedbackEvent.

@NonNull
private FeedbackEvent queueFeedbackEvent(@FeedbackEvent.FeedbackType String feedbackType, String description, @FeedbackEvent.FeedbackSource String feedbackSource) {
    updateLifecyclePercentages();
    // Distance completed = previous distance completed + current RouteProgress distance traveled
    double distanceCompleted = navigationSessionState.eventRouteDistanceCompleted() + metricProgress.getDistanceTraveled();
    // Create a new session state given the current navigation session
    SessionState feedbackEventSessionState = navigationSessionState.toBuilder().eventDate(new Date()).eventRouteProgress(metricProgress).eventRouteDistanceCompleted(distanceCompleted).eventLocation(metricLocation.getLocation()).mockLocation(metricLocation.getLocation().getProvider().equals(MOCK_PROVIDER)).build();
    FeedbackEvent feedbackEvent = new FeedbackEvent(feedbackEventSessionState, feedbackSource);
    feedbackEvent.setDescription(description);
    feedbackEvent.setFeedbackType(feedbackType);
    queuedFeedbackEvents.add(feedbackEvent);
    return feedbackEvent;
}
Also used : SessionState(com.mapbox.services.android.navigation.v5.navigation.metrics.SessionState) FeedbackEvent(com.mapbox.services.android.navigation.v5.navigation.metrics.FeedbackEvent) Date(java.util.Date) NonNull(android.support.annotation.NonNull)

Example 4 with FeedbackEvent

use of com.mapbox.services.android.navigation.v5.navigation.metrics.FeedbackEvent in project mapbox-navigation-android by mapbox.

the class NavigationTelemetry method updateFeedbackEvent.

/**
 * Updates an existing feedback event generated by {@link MapboxNavigation#recordFeedback(String, String, String)}.
 * <p>
 * Uses a feedback ID to find the correct event and then adjusts the feedbackType and description.
 *
 * @param feedbackId   generated from {@link MapboxNavigation#recordFeedback(String, String, String)}
 * @param feedbackType from list of set feedback types
 * @param description  an optional description to provide more detail about the feedback
 * @param screenshot   an optional encoded screenshot to provide more detail about the feedback
 */
void updateFeedbackEvent(String feedbackId, @FeedbackEvent.FeedbackType String feedbackType, String description, String screenshot) {
    // Find the event and update
    FeedbackEvent feedbackEvent = (FeedbackEvent) findQueuedTelemetryEvent(feedbackId);
    if (feedbackEvent != null) {
        feedbackEvent.setFeedbackType(feedbackType);
        feedbackEvent.setDescription(description);
        feedbackEvent.setScreenshot(screenshot);
    }
}
Also used : FeedbackEvent(com.mapbox.services.android.navigation.v5.navigation.metrics.FeedbackEvent)

Example 5 with FeedbackEvent

use of com.mapbox.services.android.navigation.v5.navigation.metrics.FeedbackEvent in project mapbox-navigation-android by mapbox.

the class NavigationTelemetry method sendFeedbackEvent.

private void sendFeedbackEvent(FeedbackEvent feedbackEvent) {
    if (feedbackEvent.getSessionState().startTimestamp() == null) {
        return;
    }
    // Create arrays with locations from before / after the reroute occurred
    List<Location> beforeLocations = createLocationListBeforeEvent(feedbackEvent.getSessionState().eventDate());
    List<Location> afterLocations = createLocationListAfterEvent(feedbackEvent.getSessionState().eventDate());
    // Update session state with locations after feedback
    SessionState feedbackSessionState = feedbackEvent.getSessionState().toBuilder().beforeEventLocations(beforeLocations).afterEventLocations(afterLocations).build();
    NavigationMetricsWrapper.feedbackEvent(feedbackSessionState, metricProgress, feedbackEvent.getSessionState().eventLocation(), feedbackEvent.getDescription(), feedbackEvent.getFeedbackType(), feedbackEvent.getScreenshot(), feedbackEvent.getEventId(), vendorId);
}
Also used : SessionState(com.mapbox.services.android.navigation.v5.navigation.metrics.SessionState) MetricsLocation(com.mapbox.services.android.navigation.v5.location.MetricsLocation) Location(android.location.Location)

Aggregations

FeedbackEvent (com.mapbox.services.android.navigation.v5.navigation.metrics.FeedbackEvent)4 SessionState (com.mapbox.services.android.navigation.v5.navigation.metrics.SessionState)2 Location (android.location.Location)1 NonNull (android.support.annotation.NonNull)1 MetricsLocation (com.mapbox.services.android.navigation.v5.location.MetricsLocation)1 Date (java.util.Date)1