summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java
diff options
context:
space:
mode:
authorkevin <kevin.li@mapbox.com>2019-04-09 14:53:40 +0800
committerŁukasz Paczos <lukasz.paczos@mapbox.com>2019-04-18 16:00:12 +0200
commit2b576d24f09909c54e3251801ffdb6aca5a7f12d (patch)
tree59bf7f04d75a2a05f9719d058403dd523ae03a5e /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java
parentc6793dd1a21cb4186ffafb0fb1b6305de16aba2b (diff)
downloadqtlocation-mapboxgl-2b576d24f09909c54e3251801ffdb6aca5a7f12d.tar.gz
Polish codes and add test cases
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java
index 026045ef66..5b14fe249a 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java
@@ -21,18 +21,16 @@ public class TelemetryImpl implements TelemetryDefinition {
@Nullable
private MapboxTelemetry telemetry;
- private MapEventFactory mapEventFactory;
+ private Context appContext;
public TelemetryImpl() {
- Context appContext = Mapbox.getApplicationContext();
+ appContext = Mapbox.getApplicationContext();
String accessToken = Mapbox.getAccessToken();
telemetry = new MapboxTelemetry(appContext, accessToken, BuildConfig.MAPBOX_EVENTS_USER_AGENT);
TelemetryEnabler.State telemetryState = TelemetryEnabler.retrieveTelemetryStateFromPreferences();
if (TelemetryEnabler.State.ENABLED.equals(telemetryState)) {
telemetry.enable();
}
- mapEventFactory = new MapEventFactory(appContext);
-
}
/**
@@ -43,7 +41,7 @@ public class TelemetryImpl implements TelemetryDefinition {
AppUserTurnstile turnstileEvent = new AppUserTurnstile(BuildConfig.MAPBOX_SDK_IDENTIFIER,
BuildConfig.MAPBOX_SDK_VERSION);
telemetry.push(turnstileEvent);
- telemetry.push(mapEventFactory.buildMapLoadEvent());
+ telemetry.push(MapEventFactory.buildMapLoadEvent(new PhoneState(appContext)));
}
/**
@@ -58,7 +56,7 @@ public class TelemetryImpl implements TelemetryDefinition {
public void onGestureInteraction(String eventType, double latitude, double longitude, double zoom) {
MapState state = new MapState(latitude, longitude, zoom);
state.setGesture(eventType);
- telemetry.push(mapEventFactory.buildMapClickEvent(state));
+ telemetry.push(MapEventFactory.buildMapClickEvent(new PhoneState(appContext), state));
}
/**
@@ -98,7 +96,7 @@ public class TelemetryImpl implements TelemetryDefinition {
@Override
public void onCreateOfflineRegion(@NonNull OfflineRegionDefinition offlineDefinition) {
- telemetry.push(mapEventFactory.buildOfflineDownloadStartEvent(
+ telemetry.push(MapEventFactory.buildOfflineDownloadStartEvent(new PhoneState(appContext),
offlineDefinition instanceof OfflineTilePyramidRegionDefinition ? "tileregion" : "shaperegion",
offlineDefinition.getMinZoom(),
offlineDefinition.getMaxZoom(),