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

Commit

Permalink
[android] allow setting a null access token in the runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasPaczos authored and Łukasz Paczos committed Jul 11, 2019
1 parent 348c437 commit 4348169
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static String getAccessToken() {
/**
* Set the current active accessToken.
*/
public static void setAccessToken(String accessToken) {
public static void setAccessToken(@Nullable String accessToken) {
validateMapbox();
INSTANCE.accessToken = accessToken;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ private FileSource(String cachePath, AssetManager assetManager) {
public native void deactivate();

@Keep
public native void setAccessToken(@NonNull String accessToken);
public native void setAccessToken(@Nullable String accessToken);

@NonNull
@Keep
Expand Down
2 changes: 1 addition & 1 deletion platform/android/src/file_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jni::Local<jni::String> FileSource::getAccessToken(jni::JNIEnv& env) {
}

void FileSource::setAccessToken(jni::JNIEnv& env, const jni::String& token) {
fileSource->setAccessToken(jni::Make<std::string>(env, token));
fileSource->setAccessToken(token ? jni::Make<std::string>(env, token) : "");
}

void FileSource::setAPIBaseUrl(jni::JNIEnv& env, const jni::String& url) {
Expand Down

0 comments on commit 4348169

Please sign in to comment.