summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorTobrun <tobrun.van.nuland@gmail.com>2018-01-18 13:37:20 +0100
committerTobrun <tobrun@mapbox.com>2018-01-23 12:09:48 +0100
commit46ace8d2c7d71913c5703a30c777cefd9f714eed (patch)
tree26a8a7bd632453f4272612ac841a9057571533f8 /platform
parent2411fb31b70fde6a076886390abdaedde86ea2e5 (diff)
downloadqtlocation-mapboxgl-46ace8d2c7d71913c5703a30c777cefd9f714eed.tar.gz
[android] - validate zoom level before creating mapbox telem event
Diffstat (limited to 'platform')
-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