summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobrun <tobrun.van.nuland@gmail.com>2018-01-18 13:37:20 +0100
committerTobrun <tobrun@mapbox.com>2018-01-22 18:28:14 +0100
commitd0987e97a4ca1f48a1a5d9e301ac7e81b3faad0c (patch)
treea3d1186a744e7edbcc7eb2582c51803db9554cd5
parent3fb432ee86054b649a200a8380a26aba624111c2 (diff)
downloadqtlocation-mapboxgl-d0987e97a4ca1f48a1a5d9e301ac7e81b3faad0c.tar.gz
[android] - validate zoom level before creating mapbox telem event
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxEventWrapper.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxEventWrapper.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxEventWrapper.java
index 97734de493..6730278d79 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxEventWrapper.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxEventWrapper.java
@@ -4,6 +4,7 @@ import android.location.Location;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
+import com.mapbox.mapboxsdk.constants.MapboxConstants;
import com.mapbox.services.android.telemetry.MapboxEvent;
import java.util.Hashtable;
@@ -21,24 +22,32 @@ class MapboxEventWrapper {
static Hashtable<String, Object> buildMapClickEvent(
@NonNull Location location, @NonNull String gestureId, Transform transform) {
try {
- return MapboxEvent.buildMapClickEvent(location, gestureId, transform.getZoom());
+ double mapZoom = transform.getZoom();
+ if (mapZoom >= MapboxConstants.MINIMUM_ZOOM && mapZoom <= MapboxConstants.MAXIMUM_ZOOM) {
+ // validate zoom #8057
+ return MapboxEvent.buildMapClickEvent(location, gestureId, transform.getZoom());
+ }
} catch (NullPointerException exception) {
// Map/Transform is not ready yet #8650
// returning null is valid, event is ignored.
- return null;
}
+ return null;
}
@Nullable
static Hashtable<String, Object> buildMapDragEndEvent(
@NonNull Location location, Transform transform) {
try {
- return MapboxEvent.buildMapDragEndEvent(location, transform.getZoom());
+ double mapZoom = transform.getZoom();
+ if (mapZoom >= MapboxConstants.MINIMUM_ZOOM && mapZoom <= MapboxConstants.MAXIMUM_ZOOM) {
+ // validate zoom #8057
+ return MapboxEvent.buildMapDragEndEvent(location, transform.getZoom());
+ }
} catch (NullPointerException exception) {
// Map/Transform is not ready yet #8650
// returning null is valid, event is ignored.
- return null;
}
+ return null;
}
@Nullable