Skip to content

Commit

Permalink
Wrap BuildConfig reference for sdk version
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahsnow1 committed Aug 30, 2017
1 parent 7e37e41 commit 6c8af20
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.mapzen.android.core;

import com.mapzen.BuildConfig;

import android.os.Build;

import java.util.Map;
Expand All @@ -12,7 +10,7 @@
public interface GenericHttpHandler {

String HEADER_USER_AGENT = "User-Agent";
String USER_AGENT = "android-sdk;" + BuildConfig.SDK_VERSION + ";" + Build.VERSION.RELEASE;
String USER_AGENT = "android-sdk;" + MapzenManager.getSdkVersion() + ";" + Build.VERSION.RELEASE;

/**
* Return query parameters to be appended to every request.
Expand Down
10 changes: 10 additions & 0 deletions core/src/main/java/com/mapzen/android/core/MapzenManager.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.mapzen.android.core;

import com.mapzen.BuildConfig;

import android.content.Context;
import android.content.res.Resources;

Expand Down Expand Up @@ -79,4 +81,12 @@ public String getApiKey() {
public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}

/**
* Returns the maven artifact version.
* @return
*/
public static String getSdkVersion() {
return BuildConfig.SDK_VERSION;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public void getApiKey_shouldReturnThrowIfResourceNotFound() throws Exception {
assertThat(mapzenManager.getApiKey()).isEqualTo("mapzen-fake-api-key-2");
}

@Test public void getSdkVersion() throws Exception {
assertThat(MapzenManager.getSdkVersion()).isNotEmpty();
}

private class TestResources extends Resources {
private String testApiKey;

Expand Down

0 comments on commit 6c8af20

Please sign in to comment.