Skip to content

Commit 1f95c30

Browse files
committed
Move environment config to gradle properties
Make hardcoded environment details easier to customise. Default values match current data but can be changed at build time as in ./gradlew assemble -PyotiAppPackage=com.yoti.mobile.android.live.debug Resolves: YD-1891
1 parent 094117a commit 1f95c30

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

gradle.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ libMockitoVersion=1.10.19
3333

3434
currentAppName=Mobile Button SDK
3535

36+
#Environment
37+
yotiAppPackage=com.yoti.mobile.android.live
38+
yotiAppMinVersion=1622
39+
yotiBackendUrl=https://api.yoti.com
40+
yotiBackendPort=443
41+
3642
# Publication
3743
pomId=yoti-button-sdk
3844
pomGroup=com.yoti.mobile.android.sdk

yoti-sdk/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ android {
1616
versionName pomVersion
1717

1818
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
19+
20+
buildConfigField 'String', 'YOTI_APP_PACKAGE', "\"$yotiAppPackage\""
21+
buildConfigField 'int', 'YOTI_APP_MIN_VERSION', yotiAppMinVersion
22+
buildConfigField 'String', 'YOTI_BACKEND_URL', "\"$yotiBackendUrl\""
23+
buildConfigField 'int', 'YOTI_BACKEND_PORT', "$yotiBackendPort"
1924
}
2025

2126
testOptions {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.yoti.mobile.android.sdk;
22

33
public interface YotiAppDefs {
4-
String YOTI_APP_PACKAGE = "com.yoti.mobile.android.live";
5-
int MIN_VERSION_YOTI_APP_REQUIRED = 1622;
4+
String YOTI_APP_PACKAGE = BuildConfig.YOTI_APP_PACKAGE;
5+
int MIN_VERSION_YOTI_APP_REQUIRED = BuildConfig.YOTI_APP_MIN_VERSION;
66
}
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package com.yoti.mobile.android.sdk.kernelSDK;
22

3+
import com.yoti.mobile.android.sdk.BuildConfig;
4+
35
/**
46
* Environment constants
57
*/
68
public class EnvironmentConfiguration {
79

8-
private final static String HOST_CONNECT_API = "https://api.yoti.com";
9-
private final static String CONNECT_API_PORT = "443";
10+
private final static String HOST_CONNECT_API = BuildConfig.YOTI_BACKEND_URL;
11+
private final static String CONNECT_API_PORT = Integer.toString(BuildConfig.YOTI_BACKEND_PORT);
1012

1113
static final String GET_QR_CODE_URL = HOST_CONNECT_API + ":" + CONNECT_API_PORT + "/api/v1/sessions/apps/%1s/scenarios/%2s?transport=URI";
1214
}

0 commit comments

Comments
 (0)