[android] bump mapbox-android-telemetry version to 3.0.0-beta.2 and adapt events related code

This commit is contained in:
Guardiola31337
2018-03-16 20:55:34 +01:00
committed by Tobrun
parent 2464520da1
commit 7d5304ebc1
6 changed files with 14 additions and 10 deletions

View File

@@ -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.** { *; }

View File

@@ -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,

View File

@@ -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();
}
});

View File

@@ -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();
}
}

View File

@@ -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));
}
}

View File

@@ -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}",