Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Revert SKU token logic for release-mojito #14594

Merged
merged 3 commits into from
May 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions platform/android/LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ License: [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)

===========================================================================

Mapbox GL uses portions of the Mapbox Accounts SDK for Android.
URL: [https://github.com/mapbox/mapbox-accounts-android](https://github.com/mapbox/mapbox-accounts-android)
License: [Mapbox Terms of Service](https://www.mapbox.com/tos/)

===========================================================================

Mapbox GL uses portions of the Mapbox Android Core Library.
URL: [https://github.com/mapbox/mapbox-events-android](https://github.com/mapbox/mapbox-events-android)
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
Expand Down
1 change: 0 additions & 1 deletion platform/android/MapboxGLAndroidSDK/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ dependencies {
api dependenciesList.mapboxAndroidTelemetry
api dependenciesList.mapboxJavaGeoJSON
api dependenciesList.mapboxAndroidGestures
api dependenciesList.mapboxAndroidAccounts
implementation dependenciesList.mapboxJavaTurf
implementation dependenciesList.supportAnnotations
implementation dependenciesList.supportFragmentV4
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ public final class Mapbox {
private String accessToken;
@Nullable
private TelemetryDefinition telemetry;
@Nullable
private AccountsManager accounts;

/**
* Get an instance of Mapbox.
Expand All @@ -58,7 +56,6 @@ public static synchronized Mapbox getInstance(@NonNull Context context, @Nullabl
INSTANCE = new Mapbox(appContext, accessToken);
if (isAccessTokenValid(accessToken)) {
initializeTelemetry();
INSTANCE.accounts = new AccountsManager();
}
ConnectivityReceiver.instance(appContext);
}
Expand Down Expand Up @@ -90,17 +87,6 @@ public static void setAccessToken(String accessToken) {
FileSource.getInstance(getApplicationContext()).setAccessToken(accessToken);
}

/**
* Returns a SKU token, refreshed if necessary. This method is meant for internal SDK
* usage only.
*
* @return the SKU token
*/
@Nullable
public static String getSkuToken() {
return INSTANCE.accounts.getSkuToken();
}

/**
* Application context
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ public class MapboxConstants {
*/
public static final Locale MAPBOX_LOCALE = Locale.US;

/**
* The name of the desired preferences file for Android's SharedPreferences.
*/
public static final String MAPBOX_SHARED_PREFERENCES = "MapboxSharedPreferences";

/**
* Key used to switch storage to external in AndroidManifest.xml
*/
Expand All @@ -37,16 +32,6 @@ public class MapboxConstants {
*/
public static final boolean DEFAULT_MEASURE_TILE_DOWNLOAD_ON = false;

/**
* Key used to switch SKU token on/off in AndroidManifest.xml
*/
public static final String KEY_META_DATA_ENABLE_SKU_TOKEN = "com.mapbox.EnableSkuToken";

/**
* Default value for KEY_META_DATA_ENABLE_SKU_TOKEN (default is off)
*/
public static final boolean DEFAULT_ENABLE_SKU_TOKEN = false;

/**
* Unmeasured state
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import android.support.annotation.NonNull;

import com.mapbox.mapboxsdk.Mapbox;

public class HttpRequestUrl {

private HttpRequestUrl() {
Expand All @@ -24,11 +22,7 @@ public static String buildResourceUrl(@NonNull String host, String resourceUrl,
} else {
resourceUrl = resourceUrl + "&";
}
if (Mapbox.getSkuToken() != null) {
resourceUrl = resourceUrl + "events=true&sku=" + Mapbox.getSkuToken();
} else {
resourceUrl = resourceUrl + "events=true";
}
resourceUrl = resourceUrl + "events=true";
}
return resourceUrl;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import android.os.Bundle;
import android.support.annotation.FloatRange;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.mapbox.android.accounts.v1.MapboxAccounts;
import com.mapbox.android.telemetry.AppUserTurnstile;
import com.mapbox.android.telemetry.MapboxTelemetry;
import com.mapbox.android.telemetry.SessionInterval;
Expand All @@ -21,8 +21,9 @@

public class TelemetryImpl implements TelemetryDefinition {

private final MapboxTelemetry telemetry;
private final Context appContext;
@Nullable
private MapboxTelemetry telemetry;
private Context appContext;

public TelemetryImpl() {
appContext = Mapbox.getApplicationContext();
Expand All @@ -41,9 +42,6 @@ public TelemetryImpl() {
public void onAppUserTurnstileEvent() {
AppUserTurnstile turnstileEvent = new AppUserTurnstile(BuildConfig.MAPBOX_SDK_IDENTIFIER,
BuildConfig.MAPBOX_SDK_VERSION);
if (Mapbox.getSkuToken() != null) {
turnstileEvent.setSkuId(MapboxAccounts.SKU_ID_MAPS_MAUS);
}
telemetry.push(turnstileEvent);
telemetry.push(MapEventFactory.buildMapLoadEvent(new PhoneState(appContext)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
public class FileSource {

private static final String TAG = "Mbgl-FileSource";
private static final String MAPBOX_SHARED_PREFERENCES = "MapboxSharedPreferences";
private static final String MAPBOX_SHARED_PREFERENCE_RESOURCES_CACHE_PATH = "fileSourceResourcesCachePath";
private static final Lock resourcesCachePathLoaderLock = new ReentrantLock();
private static final Lock internalCachePathLoaderLock = new ReentrantLock();
Expand Down Expand Up @@ -106,8 +107,7 @@ public static synchronized FileSource getInstance(@NonNull Context context) {
*/
@NonNull
private static String getCachePath(@NonNull Context context) {
SharedPreferences preferences = context.getSharedPreferences(
MapboxConstants.MAPBOX_SHARED_PREFERENCES, Context.MODE_PRIVATE);
SharedPreferences preferences = context.getSharedPreferences(MAPBOX_SHARED_PREFERENCES, Context.MODE_PRIVATE);
String cachePath = preferences.getString(MAPBOX_SHARED_PREFERENCE_RESOURCES_CACHE_PATH, null);

if (!isPathWritable(cachePath)) {
Expand All @@ -116,7 +116,7 @@ private static String getCachePath(@NonNull Context context) {

// Reset stored cache path
SharedPreferences.Editor editor =
context.getSharedPreferences(MapboxConstants.MAPBOX_SHARED_PREFERENCES, Context.MODE_PRIVATE).edit();
context.getSharedPreferences(MAPBOX_SHARED_PREFERENCES, Context.MODE_PRIVATE).edit();
editor.remove(MAPBOX_SHARED_PREFERENCE_RESOURCES_CACHE_PATH).apply();
}

Expand Down Expand Up @@ -306,7 +306,7 @@ public void onWritePermissionGranted() {
callback.onError(fileSourceActivatedMessage);
} else {
final SharedPreferences.Editor editor =
context.getSharedPreferences(MapboxConstants.MAPBOX_SHARED_PREFERENCES, Context.MODE_PRIVATE).edit();
context.getSharedPreferences(MAPBOX_SHARED_PREFERENCES, Context.MODE_PRIVATE).edit();
editor.putString(MAPBOX_SHARED_PREFERENCE_RESOURCES_CACHE_PATH, path);
editor.apply();
setResourcesCachePath(context, path);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -991,11 +991,6 @@
android:name="com.mapbox.MeasureTileDownloadOn"
android:value="false" />

<!-- Set value to true to have SKU tokens included in API requests -->
<meta-data
android:name="com.mapbox.EnableSkuToken"
android:value="true" />

</application>

</manifest>
2 changes: 0 additions & 2 deletions platform/android/gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ ext {
mapboxTelemetry : '4.4.1',
mapboxCore : '1.3.0',
mapboxGestures : '0.4.2',
mapboxAccounts : '0.1.0',
supportLib : '27.1.1',
constraintLayout: '1.1.2',
uiAutomator : '2.1.3',
Expand Down Expand Up @@ -40,7 +39,6 @@ ext {
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}",
mapboxAndroidAccounts : "com.mapbox.mapboxsdk:mapbox-android-accounts:${versions.mapboxAccounts}",
mapboxJavaTurf : "com.mapbox.mapboxsdk:mapbox-sdk-turf:${versions.mapboxServices}",

junit : "junit:junit:${versions.junit}",
Expand Down