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

Commit

Permalink
[android] #5058 - Deprecating get/set Access Token In OfflineManager …
Browse files Browse the repository at this point in the history
…and automatically setting it if MapboxAccountManager is in use
  • Loading branch information
bleege committed May 24, 2016
1 parent 6abd3d7 commit 68e84b1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import android.os.Looper;
import android.support.annotation.NonNull;
import android.util.Log;

import com.mapbox.mapboxsdk.MapboxAccountManager;
import java.io.File;

/**
Expand Down Expand Up @@ -92,6 +92,10 @@ private OfflineManager(Context context) {
String cachePath = assetRoot + File.separator + DATABASE_NAME;
mDefaultFileSourcePtr = createDefaultFileSource(cachePath, assetRoot, DEFAULT_MAX_CACHE_SIZE);

if (MapboxAccountManager.getInstance() != null) {
setAccessToken(mDefaultFileSourcePtr, MapboxAccountManager.getInstance().getAccessToken());
}

// Delete any existing previous ambient cache database
deleteAmbientDatabase(context);
}
Expand Down Expand Up @@ -123,13 +127,24 @@ public static synchronized OfflineManager getInstance(Context context) {
return instance;
}

/*
/**
* Access token getter/setter
* @param accessToken
*
* @deprecated As of release 4.1.0, replaced by {@link MapboxAccountManager#start(Context, String)} ()}
*/
@Deprecated
public void setAccessToken(String accessToken) {
setAccessToken(mDefaultFileSourcePtr, accessToken);
}

/**
* Get Access Token
* @return Access Token
*
* @deprecated As of release 4.1.0, replaced by {@link MapboxAccountManager#getAccessToken()}
*/
@Deprecated
public String getAccessToken() {
return getAccessToken(mDefaultFileSourcePtr);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.Toast;

import com.mapbox.mapboxsdk.camera.CameraPosition;
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
import com.mapbox.mapboxsdk.constants.Style;
Expand All @@ -30,9 +29,7 @@
import com.mapbox.mapboxsdk.testapp.model.constants.AppConstant;
import com.mapbox.mapboxsdk.testapp.model.other.OfflineDownloadRegionDialog;
import com.mapbox.mapboxsdk.testapp.model.other.OfflineListRegionsDialog;

import org.json.JSONObject;

import java.util.ArrayList;

public class OfflineActivity extends AppCompatActivity
Expand Down Expand Up @@ -118,7 +115,6 @@ public void onClick(View v) {

// Set up the OfflineManager
mOfflineManager = OfflineManager.getInstance(this);
mOfflineManager.setAccessToken(getString(R.string.mapbox_access_token));
}

@Override
Expand Down

0 comments on commit 68e84b1

Please sign in to comment.