diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2019-05-09 21:38:23 +0200 |
---|---|---|
committer | Tobrun <tobrun.van.nuland@gmail.com> | 2019-05-10 12:12:52 +0200 |
commit | 947bc75f56fae7f1e70f21b98730dc6b460b9194 (patch) | |
tree | 76a77f9c347fceb26c3a89f8d8fac8801cb3735b | |
parent | fd527b1d232c6f9f0d898349ce702355d31d0fea (diff) | |
download | qtlocation-mapboxgl-947bc75f56fae7f1e70f21b98730dc6b460b9194.tar.gz |
[android] - remove internal gesture event handling code, deprecate public gesture event hooks
10 files changed, 22 insertions, 485 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/TelemetryConstants.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/TelemetryConstants.java index 31a1baea4a..3dbae9de43 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/TelemetryConstants.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/TelemetryConstants.java @@ -1,5 +1,6 @@ package com.mapbox.mapboxsdk.constants; +@Deprecated public class TelemetryConstants { public static final String TWO_FINGER_TAP = "TwoFingerTap"; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java index 9473ea7091..b9550ec607 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java @@ -11,21 +11,16 @@ import android.support.annotation.Nullable; import android.view.InputDevice; import android.view.MotionEvent; import android.view.animation.DecelerateInterpolator; - import com.mapbox.android.gestures.AndroidGesturesManager; import com.mapbox.android.gestures.Constants; -import com.mapbox.android.gestures.MoveGestureDetector; -import com.mapbox.android.gestures.MultiFingerTapGestureDetector; -import com.mapbox.android.gestures.RotateGestureDetector; import com.mapbox.android.gestures.ShoveGestureDetector; import com.mapbox.android.gestures.StandardGestureDetector; +import com.mapbox.android.gestures.MultiFingerTapGestureDetector; +import com.mapbox.android.gestures.MoveGestureDetector; +import com.mapbox.android.gestures.RotateGestureDetector; import com.mapbox.android.gestures.StandardScaleGestureDetector; -import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.R; -import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.constants.MapboxConstants; -import com.mapbox.mapboxsdk.constants.TelemetryConstants; -import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.utils.MathUtils; import java.util.ArrayList; @@ -332,8 +327,6 @@ final class MapGestureDetector { notifyOnMapClickListeners(tapPoint); } - sendTelemetryEvent(TelemetryConstants.SINGLE_TAP, new PointF(motionEvent.getX(), motionEvent.getY())); - return true; } @@ -368,7 +361,6 @@ final class MapGestureDetector { zoomInAnimated(zoomFocalPoint, false); - sendTelemetryEvent(TelemetryConstants.DOUBLE_TAP, new PointF(motionEvent.getX(), motionEvent.getY())); return true; } @@ -430,7 +422,6 @@ final class MapGestureDetector { } cancelTransitionsIfRequired(); - sendTelemetryEvent(TelemetryConstants.PAN, detector.getFocalPoint()); notifyOnMoveBeginListeners(detector); return true; } @@ -497,8 +488,6 @@ final class MapGestureDetector { ); } - sendTelemetryEvent(TelemetryConstants.PINCH, getScaleFocalPoint(detector)); - notifyOnScaleBeginListeners(detector); return true; @@ -609,8 +598,6 @@ final class MapGestureDetector { gesturesManager.getStandardScaleGestureDetector().interrupt(); } - sendTelemetryEvent(TelemetryConstants.ROTATION, getRotateFocalPoint(detector)); - notifyOnRotateBeginListeners(detector); return true; @@ -725,8 +712,6 @@ final class MapGestureDetector { cancelTransitionsIfRequired(); - sendTelemetryEvent(TelemetryConstants.PITCH, detector.getFocalPoint()); - // disabling move gesture during shove gesturesManager.getMoveGestureDetector().setEnabled(false); @@ -775,8 +760,6 @@ final class MapGestureDetector { transform.cancelTransitions(); cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE); - sendTelemetryEvent(TelemetryConstants.TWO_FINGER_TAP, detector.getFocalPoint()); - PointF zoomFocalPoint; // Single finger double tap if (constantFocalPoint != null) { @@ -890,20 +873,6 @@ final class MapGestureDetector { && (!uiSettings.isTiltGesturesEnabled() || !gesturesManager.getShoveGestureDetector().isInProgress()); } - private void sendTelemetryEvent(String eventType, @NonNull PointF focalPoint) { - TelemetryDefinition telemetry = Mapbox.getTelemetry(); - if (telemetry != null) { - CameraPosition cameraPosition = transform.getCameraPosition(); - if (cameraPosition != null) { - double zoom = cameraPosition.zoom; - if (isZoomValid(zoom)) { - LatLng latLng = projection.fromScreenLocation(focalPoint); - telemetry.onGestureInteraction(eventType, latLng.getLatitude(), latLng.getLongitude(), zoom); - } - } - } - } - private boolean isZoomValid(double mapZoom) { return mapZoom >= MapboxConstants.MINIMUM_ZOOM && mapZoom <= MapboxConstants.MAXIMUM_ZOOM; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TelemetryDefinition.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TelemetryDefinition.java index d428895696..fd9950b141 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TelemetryDefinition.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TelemetryDefinition.java @@ -22,7 +22,9 @@ public interface TelemetryDefinition { * @param latitude the latitude value of the gesture focal point * @param longitude the longitude value of the gesture focal point * @param zoom current zoom of the map + * @deprecated since 7.5.0, this event is no longer supported */ + @Deprecated void onGestureInteraction(String eventType, double latitude, double longitude, double zoom); /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapClickEvent.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapClickEvent.java deleted file mode 100644 index c9f7f42ed2..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapClickEvent.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.mapbox.mapboxsdk.module.telemetry; - -import android.annotation.SuppressLint; - -/** - * Event that represents users' gestures on map, for the details of gestures, - * please refer to {@link com.mapbox.mapboxsdk.constants.TelemetryConstants} - */ -@SuppressLint("ParcelCreator") -class MapClickEvent extends MapBaseEvent { - private static final String EVENT_NAME = "map.click"; - private final String gesture; - private final String cellularNetworkType; - private final String carrier; - private final String orientation; - private final double lat; - private final double lng; - private final double zoom; - private final int batteryLevel; - private final boolean pluggedIn; - private final boolean wifi; - - MapClickEvent(PhoneState phoneState, MapState mapState) { - super(phoneState); - this.gesture = mapState.getGesture(); - this.lat = mapState.getLatitude(); - this.lng = mapState.getLongitude(); - this.zoom = mapState.getZoom(); - this.batteryLevel = phoneState.getBatteryLevel(); - this.pluggedIn = phoneState.isPluggedIn(); - this.cellularNetworkType = phoneState.getCellularNetworkType(); - this.orientation = phoneState.getOrientation(); - this.carrier = phoneState.getCarrier(); - this.wifi = phoneState.isWifi(); - } - - @Override - String getEventName() { - return EVENT_NAME; - } - - String getGesture() { - return gesture; - } - - String getCellularNetworkType() { - return cellularNetworkType; - } - - String getCarrier() { - return carrier; - } - - String getOrientation() { - return orientation; - } - - double getLat() { - return lat; - } - - double getLng() { - return lng; - } - - double getZoom() { - return zoom; - } - - int getBatteryLevel() { - return batteryLevel; - } - - boolean isPluggedIn() { - return pluggedIn; - } - - boolean isWifi() { - return wifi; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - MapClickEvent that = (MapClickEvent) o; - - if (Double.compare(that.lat, lat) != 0) { - return false; - } - if (Double.compare(that.lng, lng) != 0) { - return false; - } - if (Double.compare(that.zoom, zoom) != 0) { - return false; - } - if (batteryLevel != that.batteryLevel) { - return false; - } - if (pluggedIn != that.pluggedIn) { - return false; - } - if (wifi != that.wifi) { - return false; - } - if (gesture != null ? !gesture.equals(that.gesture) : that.gesture != null) { - return false; - } - if (cellularNetworkType != null ? !cellularNetworkType.equals(that.cellularNetworkType) : - that.cellularNetworkType != null) { - return false; - } - if (carrier != null ? !carrier.equals(that.carrier) : that.carrier != null) { - return false; - } - return orientation != null ? orientation.equals(that.orientation) : that.orientation == null; - } - - @Override - public int hashCode() { - int result; - long temp; - result = gesture != null ? gesture.hashCode() : 0; - result = 31 * result + (cellularNetworkType != null ? cellularNetworkType.hashCode() : 0); - result = 31 * result + (carrier != null ? carrier.hashCode() : 0); - result = 31 * result + (orientation != null ? orientation.hashCode() : 0); - temp = Double.doubleToLongBits(lat); - result = 31 * result + (int) (temp ^ (temp >>> 32)); - temp = Double.doubleToLongBits(lng); - result = 31 * result + (int) (temp ^ (temp >>> 32)); - temp = Double.doubleToLongBits(zoom); - result = 31 * result + (int) (temp ^ (temp >>> 32)); - result = 31 * result + batteryLevel; - result = 31 * result + (pluggedIn ? 1 : 0); - result = 31 * result + (wifi ? 1 : 0); - return result; - } - - @Override - public String toString() { - return "MapClickEvent{" - + ", gesture='" + gesture + '\'' - + ", cellularNetworkType='" + cellularNetworkType + '\'' - + ", carrier='" + carrier + '\'' - + ", orientation='" + orientation + '\'' - + ", lat=" + lat - + ", lng=" + lng - + ", zoom=" + zoom - + ", batteryLevel=" + batteryLevel - + ", pluggedIn=" + pluggedIn - + ", wifi=" + wifi - + '}'; - } - -} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapDragendEvent.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapDragendEvent.java deleted file mode 100644 index 9556a9a524..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapDragendEvent.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.mapbox.mapboxsdk.module.telemetry; - -import android.annotation.SuppressLint; - -/** - * When user drag map should send this event. - */ -@SuppressLint("ParcelCreator") -class MapDragendEvent extends MapBaseEvent { - private static final String EVENT_NAME = "map.dragend"; - private final String orientation; - private final String carrier; - private final String cellularNetworkType; - private final int batteryLevel; - private final double lat; - private final double lng; - private final double zoom; - private final boolean pluggedIn; - private final boolean wifi; - - MapDragendEvent(PhoneState phoneState, MapState mapState) { - super(phoneState); - this.lat = mapState.getLatitude(); - this.lng = mapState.getLongitude(); - this.zoom = mapState.getZoom(); - this.batteryLevel = phoneState.getBatteryLevel(); - this.pluggedIn = phoneState.isPluggedIn(); - this.cellularNetworkType = phoneState.getCellularNetworkType(); - this.wifi = phoneState.isWifi(); - this.orientation = phoneState.getOrientation(); - this.carrier = phoneState.getCarrier(); - } - - @Override - String getEventName() { - return EVENT_NAME; - } - - String getOrientation() { - return orientation; - } - - String getCarrier() { - return carrier; - } - - String getCellularNetworkType() { - return cellularNetworkType; - } - - int getBatteryLevel() { - return batteryLevel; - } - - double getLat() { - return lat; - } - - double getLng() { - return lng; - } - - double getZoom() { - return zoom; - } - - boolean isPluggedIn() { - return pluggedIn; - } - - boolean isWifi() { - return wifi; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - MapDragendEvent that = (MapDragendEvent) o; - - if (batteryLevel != that.batteryLevel) { - return false; - } - if (Double.compare(that.lat, lat) != 0) { - return false; - } - if (Double.compare(that.lng, lng) != 0) { - return false; - } - if (Double.compare(that.zoom, zoom) != 0) { - return false; - } - if (pluggedIn != that.pluggedIn) { - return false; - } - if (wifi != that.wifi) { - return false; - } - if (orientation != null ? !orientation.equals(that.orientation) : that.orientation != null) { - return false; - } - if (carrier != null ? !carrier.equals(that.carrier) : that.carrier != null) { - return false; - } - return cellularNetworkType != null ? cellularNetworkType.equals(that.cellularNetworkType) : - that.cellularNetworkType == null; - } - - @Override - public int hashCode() { - int result; - long temp; - result = orientation != null ? orientation.hashCode() : 0; - result = 31 * result + (carrier != null ? carrier.hashCode() : 0); - result = 31 * result + (cellularNetworkType != null ? cellularNetworkType.hashCode() : 0); - result = 31 * result + batteryLevel; - temp = Double.doubleToLongBits(lat); - result = 31 * result + (int) (temp ^ (temp >>> 32)); - temp = Double.doubleToLongBits(lng); - result = 31 * result + (int) (temp ^ (temp >>> 32)); - temp = Double.doubleToLongBits(zoom); - result = 31 * result + (int) (temp ^ (temp >>> 32)); - result = 31 * result + (pluggedIn ? 1 : 0); - result = 31 * result + (wifi ? 1 : 0); - return result; - } - - @Override - public String toString() { - return "MapDragendEvent{" - + ", orientation='" + orientation + '\'' - + ", carrier='" + carrier + '\'' - + ", cellularNetworkType='" + cellularNetworkType + '\'' - + ", batteryLevel=" + batteryLevel - + ", lat=" + lat - + ", lng=" + lng - + ", zoom=" + zoom - + ", pluggedIn=" + pluggedIn - + ", wifi=" + wifi - + '}'; - } -}
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapEventFactory.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapEventFactory.java index 88e41943fa..14b5c6231f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapEventFactory.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapEventFactory.java @@ -49,17 +49,9 @@ class MapEventFactory { return offlineEvent; } - static MapClickEvent buildMapClickEvent(@NonNull PhoneState phoneState, @NonNull MapState mapState) { - return new MapClickEvent(phoneState, mapState); - } - - static MapDragendEvent buildMapDragendEvent(@NonNull PhoneState phoneState, @NonNull MapState mapState) { - return new MapDragendEvent(phoneState, mapState); - } - static PerformanceEvent buildPerformanceEvent(@NonNull PhoneState phoneState, @NonNull String sessionId, @NonNull Bundle data) { return new PerformanceEvent(phoneState, sessionId, data); } -} +}
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapState.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapState.java deleted file mode 100644 index ab75ffa994..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapState.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.mapbox.mapboxsdk.module.telemetry; - -import android.support.annotation.FloatRange; - -import com.mapbox.mapboxsdk.constants.MapboxConstants; - -public class MapState { - private double latitude; - private double longitude; - private double zoom; - private String gesture; - - MapState(double latitude, double longitude, @FloatRange(from = MapboxConstants.MINIMUM_ZOOM, - to = MapboxConstants.MAXIMUM_ZOOM) double zoom) { - this.latitude = latitude; - this.longitude = longitude; - this.zoom = zoom; - } - - String getGesture() { - return gesture; - } - - void setGesture(String gesture) { - this.gesture = gesture; - } - - double getLatitude() { - return latitude; - } - - double getLongitude() { - return longitude; - } - - double getZoom() { - return zoom; - } -} - 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 2b1dace932..af2e0ad749 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 @@ -55,18 +55,20 @@ public class TelemetryImpl implements TelemetryDefinition { * @param latitude the latitude value of the gesture focal point * @param longitude the longitude value of the gesture focal point * @param zoom current zoom of the map + * @deprecated since 7.5.0, this event is no longer supported */ + @Deprecated @Override public void onGestureInteraction(String eventType, double latitude, double longitude, @FloatRange(from = MapboxConstants.MINIMUM_ZOOM, to = MapboxConstants.MAXIMUM_ZOOM) double zoom) { - MapState state = new MapState(latitude, longitude, zoom); - state.setGesture(eventType); - telemetry.push(MapEventFactory.buildMapClickEvent(new PhoneState(appContext), state)); + //no-op } /** * Set the end-user selected state to participate or opt-out in telemetry collection. + * + * @param enabledTelemetry true if enabled, false otherwise */ @Override public void setUserTelemetryRequestState(boolean enabledTelemetry) { @@ -100,6 +102,11 @@ public class TelemetryImpl implements TelemetryDefinition { return telemetry.updateSessionIdRotationInterval(new SessionInterval(interval)); } + /** + * Register an offline region creation event. + * + * @param offlineDefinition the offline region definition + */ @Override public void onCreateOfflineRegion(@NonNull OfflineRegionDefinition offlineDefinition) { telemetry.push(MapEventFactory.buildOfflineDownloadStartEvent(new PhoneState(appContext), @@ -110,6 +117,11 @@ public class TelemetryImpl implements TelemetryDefinition { ); } + /** + * Register a performance event + * + * @param data performance event data + */ @Override public void onPerformanceEvent(Bundle data) { if (data == null) { diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/module/telemetry/MapEventFactoryTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/module/telemetry/MapEventFactoryTest.java index b028911d4d..7e97f7466c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/module/telemetry/MapEventFactoryTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/module/telemetry/MapEventFactoryTest.java @@ -6,9 +6,7 @@ import android.os.Bundle; import com.google.gson.Gson; import com.google.gson.JsonObject; import com.mapbox.mapboxsdk.BuildConfig; -import com.mapbox.mapboxsdk.constants.TelemetryConstants; import com.mapbox.mapboxsdk.offline.OfflineRegion; - import org.junit.Before; import org.junit.Test; @@ -24,9 +22,6 @@ import static org.mockito.Mockito.when; public class MapEventFactoryTest { private static final float FONT_SCALE = 1.f; - private static final double LATITUDE = 10.0; - private static final double LONGITUDE = 11.0; - private static final double ZOOM = 10.0; private static final int BATTERY_LEVEL = 50; private static final String CARRIER = "carrier"; private static final String NETWORK_TYPE = "network"; @@ -43,13 +38,11 @@ public class MapEventFactoryTest { private static final int STATE = OfflineRegion.STATE_ACTIVE; private static final String SESSION_ID = "001"; - private MapState mapState; private PhoneState phoneState; private Gson gson = new Gson(); @Before public void setUp() { - mapState = new MapState(LATITUDE, LONGITUDE, ZOOM); phoneState = new PhoneState(); phoneState.setAccessibilityFontScale(FONT_SCALE); phoneState.setBatteryLevel(BATTERY_LEVEL); @@ -63,26 +56,6 @@ public class MapEventFactoryTest { } @Test - public void testClickEvent() { - mapState.setGesture(TelemetryConstants.DOUBLE_TAP); - MapClickEvent mapClickEvent = MapEventFactory.buildMapClickEvent(phoneState, mapState); - assertEquals(LATITUDE, mapClickEvent.getLat(), 0); - assertEquals(LONGITUDE, mapClickEvent.getLng(), 0); - assertEquals(ZOOM, mapClickEvent.getZoom(), 0); - assertEquals(BATTERY_LEVEL, mapClickEvent.getBatteryLevel()); - assertEquals(CARRIER, mapClickEvent.getCarrier()); - assertEquals(NETWORK_TYPE, mapClickEvent.getCellularNetworkType()); - assertEquals(CREATED, mapClickEvent.getCreated()); - assertEquals(TelemetryConstants.DOUBLE_TAP, mapClickEvent.getGesture()); - assertEquals("Landscape", mapClickEvent.getOrientation()); - assertEquals(PLUGIN, mapClickEvent.isPluggedIn()); - assertEquals(WIFI, mapClickEvent.isWifi()); - String json = gson.toJson(mapClickEvent); - MapClickEvent event = gson.fromJson(json, MapClickEvent.class); - assertEquals(mapClickEvent, event); - } - - @Test public void testMapLoadEvent() { MapLoadEvent mapLoadEvent = MapEventFactory.buildMapLoadEvent(phoneState); assertEquals("Android - " + Build.VERSION.RELEASE, mapLoadEvent.getOperatingSystem()); @@ -104,24 +77,6 @@ public class MapEventFactoryTest { } @Test - public void testMapDraggedEvent() { - MapDragendEvent mapDraggedEvent = MapEventFactory.buildMapDragendEvent(phoneState, mapState); - assertEquals(LATITUDE, mapDraggedEvent.getLat(), 0); - assertEquals(LONGITUDE, mapDraggedEvent.getLng(), 0); - assertEquals(ZOOM, mapDraggedEvent.getZoom(), 0); - assertEquals(BATTERY_LEVEL, mapDraggedEvent.getBatteryLevel()); - assertEquals(CARRIER, mapDraggedEvent.getCarrier()); - assertEquals(NETWORK_TYPE, mapDraggedEvent.getCellularNetworkType()); - assertEquals(CREATED, mapDraggedEvent.getCreated()); - assertEquals("Landscape", mapDraggedEvent.getOrientation()); - assertEquals(PLUGIN, mapDraggedEvent.isPluggedIn()); - assertEquals(WIFI, mapDraggedEvent.isWifi()); - String json = gson.toJson(mapDraggedEvent); - MapDragendEvent event = gson.fromJson(json, MapDragendEvent.class); - assertEquals(mapDraggedEvent, event); - } - - @Test public void testOfflineDownloadEndEvent() { OfflineDownloadEndEvent offlineDownloadEndEvent = MapEventFactory.buildOfflineDownloadCompleteEvent(phoneState, SHAPE, MIN_ZOOM, MAX_ZOOM, STYLE_URL, SIZE_OF_RESOURCES_COMPLETED, NUMBER_OF_TILE_COMPLETED, STATE); diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/module/telemetry/SchemaTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/module/telemetry/SchemaTest.java index 3e5c9429f3..73d73c7cf3 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/module/telemetry/SchemaTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/module/telemetry/SchemaTest.java @@ -28,8 +28,6 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; public class SchemaTest { - private static final String MAP_CLICK = "map.click"; - private static final String MAP_DRAG = "map.dragend"; private static final String MAP_LOAD = "map.load"; private static final String MAP_PERFORMANCE = "mobile.performance_trace"; private static final String OFFLINE_DOWNLOAD_END = "map.offlineDownload.end"; @@ -65,38 +63,6 @@ public class SchemaTest { } @Test - public void checkMapClickEventSize() { - JsonObject schema = grabSchema(MAP_CLICK); - List<Field> fields = grabClassFields(MapClickEvent.class); - - assertEquals(schema.size(), fields.size()); - } - - @Test - public void checkMapClickEventFields() { - JsonObject schema = grabSchema(MAP_CLICK); - List<Field> fields = grabClassFields(MapClickEvent.class); - - schemaContainsFields(schema, fields); - } - - @Test - public void checkMapDragEndEventSize() { - JsonObject schema = grabSchema(MAP_DRAG); - List<Field> fields = grabClassFields(MapDragendEvent.class); - - assertEquals(schema.size(), fields.size()); - } - - @Test - public void checkMapDragEndEventFields() { - JsonObject schema = grabSchema(MAP_DRAG); - List<Field> fields = grabClassFields(MapDragendEvent.class); - - schemaContainsFields(schema, fields); - } - - @Test public void checkOfflineDownloadEndEventSize() { JsonObject schema = grabSchema(OFFLINE_DOWNLOAD_END); List<Field> fields = grabClassFields(OfflineDownloadEndEvent.class); @@ -290,19 +256,6 @@ public class SchemaTest { return fields; } - private List<Field> removeField(List<Field> fields, String fieldName) { - for (Field field : new ArrayList<>(fields)) { - String thisField = String.valueOf(field); - String[] fieldArray = thisField.split("\\."); - String simpleField = fieldArray[fieldArray.length - 1]; - if (simpleField.equalsIgnoreCase(fieldName)) { - fields.remove(field); - } - } - - return fields; - } - private String generateStepSchemaString(String stepJson, String schemaString) { stepJson = stepJson.replace("\"distanceRemaining\"", "\"stepdistanceRemaining\""); stepJson = stepJson.replace("durationRemaining", "stepdurationRemaining"); |