diff options
author | Guardiola31337 <pablo.guardiola@mapbox.com> | 2018-03-16 20:55:34 +0100 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2018-03-19 14:55:47 +0100 |
commit | 7d5304ebc121711d9b2571e7b6fb8a184a39d5af (patch) | |
tree | 8e080fe93836d6e9d49df718ac2931ca7150cddb | |
parent | 2464520da18f0f4cc7532adb3fb7b1f8f195304e (diff) | |
download | qtlocation-mapboxgl-7d5304ebc121711d9b2571e7b6fb8a184a39d5af.tar.gz |
[android] bump mapbox-android-telemetry version to 3.0.0-beta.2 and adapt events related code
6 files changed, 14 insertions, 10 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/proguard-rules.pro b/platform/android/MapboxGLAndroidSDK/proguard-rules.pro index 529c3f4948..ce6e1709a0 100644 --- a/platform/android/MapboxGLAndroidSDK/proguard-rules.pro +++ b/platform/android/MapboxGLAndroidSDK/proguard-rules.pro @@ -17,6 +17,8 @@ -dontwarn com.mapbox.android.core.location.MockLocationEngine$LocationUpdateRunnable -dontwarn java.awt.Color -dontwarn com.mapzen.android.lost.api** +-dontwarn org.conscrypt.OpenSSLProvider +-dontwarn org.conscrypt.Conscrypt # config for mapbox-sdk-geojson:3.0.0-beta.3 -keep class com.mapbox.geojson.** { *; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java index ffc55fec46..ab1191c0cc 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java @@ -8,6 +8,7 @@ import android.support.annotation.NonNull; import android.text.TextUtils; import android.util.Log; +import com.mapbox.android.telemetry.TelemetryUtils; import com.mapbox.mapboxsdk.BuildConfig; import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.constants.MapboxConstants; @@ -30,7 +31,6 @@ import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; import okhttp3.ResponseBody; -import okhttp3.internal.Util; import timber.log.Timber; import static android.util.Log.DEBUG; @@ -224,7 +224,7 @@ class HTTPRequest implements Callback { private String getUserAgent() { if (userAgentString == null) { - userAgentString = Util.toHumanReadableAscii( + userAgentString = TelemetryUtils.toHumanReadableAscii( String.format("%s %s (%s) Android/%s (%s)", getApplicationIdentifier(), BuildConfig.MAPBOX_VERSION_STRING, diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java index 5ccd6bd795..9117320655 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java @@ -12,6 +12,7 @@ import android.view.View; import android.widget.ArrayAdapter; import android.widget.Toast; +import com.mapbox.android.telemetry.TelemetryEnabler; import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.attribution.Attribution; import com.mapbox.mapboxsdk.attribution.AttributionParser; @@ -98,6 +99,7 @@ public class AttributionDialogManager implements View.OnClickListener, DialogInt builder.setPositiveButton(R.string.mapbox_attributionTelemetryPositive, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { + TelemetryEnabler.updateTelemetryState(TelemetryEnabler.State.ENABLED); Events.obtainTelemetry().enable(); dialog.cancel(); } @@ -113,6 +115,7 @@ public class AttributionDialogManager implements View.OnClickListener, DialogInt @Override public void onClick(DialogInterface dialog, int which) { Events.obtainTelemetry().disable(); + TelemetryEnabler.updateTelemetryState(TelemetryEnabler.State.DISABLED); dialog.cancel(); } }); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Events.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Events.java index 7ba592f121..36d583685f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Events.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Events.java @@ -20,8 +20,7 @@ public class Events { telemetry = new MapboxTelemetry(Mapbox.getApplicationContext(), Mapbox.getAccessToken(), BuildConfig.MAPBOX_EVENTS_USER_AGENT); TelemetryEnabler.State telemetryState = TelemetryEnabler.retrieveTelemetryStateFromPreferences(); - if (TelemetryEnabler.State.NOT_INITIALIZED.equals(telemetryState) - || TelemetryEnabler.State.ENABLED.equals(telemetryState)) { + if (TelemetryEnabler.State.ENABLED.equals(telemetryState)) { telemetry.enable(); } } diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/telemetry/HttpTransportTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/telemetry/HttpTransportTest.java index 94a6dc2194..519124e1eb 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/telemetry/HttpTransportTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/telemetry/HttpTransportTest.java @@ -1,8 +1,8 @@ package com.mapbox.mapboxsdk.telemetry; -import org.junit.Test; +import com.mapbox.android.telemetry.TelemetryUtils; -import okhttp3.internal.Util; +import org.junit.Test; import static junit.framework.Assert.assertEquals; @@ -15,6 +15,6 @@ public class HttpTransportTest { final String asciiVersion = "Sveriges Fj?ll/1.0/1 MapboxEventsAndroid/4.0.0-SNAPSHOT"; assertEquals("asciiVersion and swedishUserAgent should match", asciiVersion, - Util.toHumanReadableAscii(swedishUserAgent)); + TelemetryUtils.toHumanReadableAscii(swedishUserAgent)); } } diff --git a/platform/android/gradle/dependencies.gradle b/platform/android/gradle/dependencies.gradle index bf0c919986..bad6c48380 100644 --- a/platform/android/gradle/dependencies.gradle +++ b/platform/android/gradle/dependencies.gradle @@ -9,7 +9,7 @@ ext { versions = [ mapboxServices : '3.0.0-beta.4', - mapboxTelemetry: '3.0.0-beta.1', + mapboxTelemetry: '3.0.0-beta.2', mapboxGestures : '0.1.0-20180228.152340-13', supportLib : '25.4.0', espresso : '3.0.1', @@ -20,14 +20,14 @@ ext { mockito : '2.10.0', robolectric : '3.5.1', timber : '4.5.1', - okhttp : '3.9.1' + okhttp : '3.10.0' ] dependenciesList = [ mapboxJavaServices : "com.mapbox.mapboxsdk:mapbox-sdk-services:${versions.mapboxServices}", mapboxJavaGeoJSON : "com.mapbox.mapboxsdk:mapbox-sdk-geojson:${versions.mapboxServices}", mapboxAndroidTelemetry: "com.mapbox.mapboxsdk:mapbox-android-telemetry:${versions.mapboxTelemetry}", - mapboxAndroidGestures : "com.mapbox.mapboxsdk:mapbox-android-gestures:${versions.mapboxGestures}@aar", + mapboxAndroidGestures : "com.mapbox.mapboxsdk:mapbox-android-gestures:${versions.mapboxGestures}", // for testApp mapboxJavaTurf : "com.mapbox.mapboxsdk:mapbox-sdk-turf:${versions.mapboxServices}", |