[android] #3897 - Refactoring check that determines when to send turnstile event

This commit is contained in:
Brad Leege
2016-02-18 10:44:28 -06:00
parent 5497973bd7
commit 09cac18420
2 changed files with 4 additions and 3 deletions

View File

@@ -399,7 +399,6 @@ public class MapView extends FrameLayout {
evt.put(MapboxEvent.KEY_LATITUDE, mMapboxMap.getCameraPosition().target.getLatitude());
evt.put(MapboxEvent.KEY_LONGITUDE, mMapboxMap.getCameraPosition().target.getLongitude());
evt.put(MapboxEvent.KEY_ZOOM, mMapboxMap.getCameraPosition().zoom);
// TODO - Punting on Push Enabled Key due to iOS nature for now
MapboxEventManager.getMapboxEventManager(getContext()).pushEvent(evt);
}
}

View File

@@ -242,7 +242,8 @@ public class MapboxEventManager {
return;
}
if (eventWithAttributes.get(MapboxEvent.TYPE_MAP_LOAD) != null) {
String eventType = (String)eventWithAttributes.get(MapboxEvent.ATTRIBUTE_EVENT);
if (!TextUtils.isEmpty(eventType) && eventType.equalsIgnoreCase(MapboxEvent.TYPE_MAP_LOAD)) {
pushTurnstileEvent();
}
@@ -268,6 +269,7 @@ public class MapboxEventManager {
// Send to Server Immediately
new FlushTheEventsTask().execute();
Log.d(TAG, "turnstile event pushed.");
}
/**
@@ -499,7 +501,7 @@ public class MapboxEventManager {
.post(body)
.build();
Response response = client.newCall(request).execute();
Log.i(TAG, "Response Code from Mapbox Events Server: " + response.code() + " for " + events.size() + " events sent in.");
Log.d(TAG, "Response Code from Mapbox Events Server: " + response.code() + " for " + events.size() + " events sent in.");
// Reset Events
// ============