Skip to content

Commit e6eddb0

Browse files
Merge pull request #723 from BranchMetrics/Staging
Release v4.0.0
2 parents 4e36ede + cf247cb commit e6eddb0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+925
-218
lines changed

.circleci/config.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: 2
2+
jobs:
3+
build:
4+
working_directory: ~/code
5+
docker:
6+
- image: circleci/android:api-28
7+
steps:
8+
- checkout
9+
- run:
10+
name: Update SDK Tools
11+
command: $ANDROID_HOME/tools/bin/sdkmanager --update
12+
- run:
13+
name: Run Lint
14+
command: ./gradlew lint
15+
- run:
16+
name: Run Build
17+
command: ./gradlew build
18+
- store_artifacts:
19+
path: ./Branch-SDK/build/outputs/aar/

.gitlab-ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
image: openjdk:8-jdk
2+
3+
variables:
4+
ANDROID_COMPILE_SDK: "29"
5+
ANDROID_BUILD_TOOLS: "28.0.3"
6+
ANDROID_SDK_TOOLS: "4333796"
7+
8+
stages:
9+
- build
10+
- test
11+
12+
lintDebug:
13+
stage: build
14+
tags:
15+
- mac_mini
16+
script:
17+
- ./gradlew lint
18+
19+
buildDebug:
20+
stage: build
21+
tags:
22+
- mac_mini
23+
script:
24+
- ./gradlew build
25+
artifacts:
26+
paths:
27+
- ./Branch-SDK/build/outputs/aar/
28+
29+
debugTests:
30+
stage: build
31+
tags:
32+
- mac_mini
33+
script:
34+
- ./gradlew test
35+
36+
emulatortest_py:
37+
stage: test
38+
tags:
39+
- mac_mini
40+
script:
41+
- python -u ./deploy/build_and_test.py
42+
artifacts:
43+
paths:
44+
- ./Branch-SDK/build/reports/androidTests/connected/

Branch-SDK-TestBed/androidTest/io/branch/branchandroiddemo/BranchSDKTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package io.branch.branchandroiddemo;
22

33
import android.content.Context;
4-
import android.support.test.InstrumentationRegistry;
5-
import android.support.test.runner.AndroidJUnit4;
4+
import androidx.test.InstrumentationRegistry;
5+
import androidx.test.runner.AndroidJUnit4;
66

77
import org.json.JSONException;
88
import org.json.JSONObject;

Branch-SDK-TestBed/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ dependencies {
55
implementation ('com.google.android.gms:play-services-ads:16.0.0')
66

77
/* Add chrome custom tabs for guaranteed matching */
8-
implementation ('com.android.support:customtabs:23.3.0') {
8+
implementation ('androidx.browser:browser:1.0.0') {
99
exclude module: 'support-v4'
1010
}
1111

1212
testImplementation 'junit:junit:4.12'
13-
androidTestImplementation 'com.android.support.test:runner:1.0.2'
14-
androidTestImplementation 'com.android.support.test:rules:1.0.2'
15-
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
13+
androidTestImplementation 'androidx.test:runner:1.2.0'
14+
androidTestImplementation 'androidx.test:rules:1.2.0'
15+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
1616
}
1717

1818
android {
@@ -26,7 +26,7 @@ android {
2626
versionName project.VERSION_NAME
2727
versionCode Integer.parseInt(project.VERSION_CODE)
2828

29-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
29+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3030
}
3131

3232
signingConfigs { release }
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"apps": {
3+
"io.branch.referral.test": {
4+
"preinstall_partner": "branch_",
5+
"preinstall_campaign": "branch_campaign",
6+
"custom_key": "custom_value"
7+
}
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"apps": {
3+
"io.branch.referral.packager": {
4+
"preinstall_partner": "branch_",
5+
"preinstall_campaign": "branch_campaign",
6+
"custom_key": "custom_value"
7+
}
8+
}
9+
}

Branch-SDK/androidTest/io/assets/pre_install_apps_null.branch

Whitespace-only changes.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package io.branch.indexing;
2+
3+
import androidx.test.ext.junit.runners.AndroidJUnit4;
4+
5+
import org.junit.After;
6+
import org.junit.Assert;
7+
import org.junit.Before;
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
@RunWith(AndroidJUnit4.class)
12+
public class HashHelperTest {
13+
14+
@Before
15+
public void setUp() {
16+
17+
}
18+
19+
@After
20+
public void tearDown() {
21+
22+
}
23+
24+
@Test
25+
public void testHelloWoldMD5() {
26+
byte[] hash = new byte[] {
27+
94, -74, 59, -69, -32, 30, -18, -48, -109, -53, 34, -69, -113, 90, -51, -61
28+
};
29+
String expected = new String(hash);
30+
31+
HashHelper helper = new HashHelper();
32+
String actual = helper.hashContent("hello world");
33+
34+
// verify the hash is not MD5
35+
Assert.assertFalse(expected.equals(actual));
36+
}
37+
38+
@Test
39+
public void testHelloWorldSHA256() {
40+
byte[] hash = new byte[] {
41+
-71, 77, 39, -71, -109, 77, 62, 8, -91, 46, 82, -41, -38, 125, -85, -6, -60, -124, -17, -29, 122, 83, -128, -18, -112, -120, -9, -84, -30, -17, -51, -23
42+
};
43+
String expected = new String(hash);
44+
45+
HashHelper helper = new HashHelper();
46+
String actual = helper.hashContent("hello world");
47+
48+
// verify the hash is SHA256
49+
Assert.assertTrue(expected.equals(actual));
50+
}
51+
52+
}

Branch-SDK/androidTest/io/branch/referral/BranchEventTest.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package io.branch.referral;
22

33
import android.content.Context;
4-
import android.support.test.runner.AndroidJUnit4;
4+
import androidx.test.ext.junit.runners.AndroidJUnit4;
55
import android.util.Log;
66

77
import org.json.JSONObject;
@@ -33,6 +33,15 @@ public void testStandardEvent() throws Throwable {
3333
Assert.assertTrue(isStandardEvent(branchEvent));
3434
}
3535

36+
@Test
37+
public void testCustomerEventAlias() throws Throwable {
38+
BRANCH_STANDARD_EVENT eventType = BRANCH_STANDARD_EVENT.CUSTOMER_EVENT_ALIAS;
39+
Assert.assertEquals("CUSTOMER_EVENT_ALIAS", eventType.getName());
40+
41+
BranchEvent branchEvent = new BranchEvent(eventType);
42+
Assert.assertTrue(isStandardEvent(branchEvent));
43+
}
44+
3645
@Test
3746
public void testCustomEvent() throws Throwable {
3847
BranchEvent branchEvent = new BranchEvent("CustomEvent");
@@ -234,6 +243,11 @@ ServerRequest doFinalUpdate(ServerRequest request) {
234243
return request;
235244
}
236245

246+
ServerRequest doFinalUpdateOnMainThread(ServerRequest request) {
247+
request.doFinalUpdateOnMainThread();
248+
return request;
249+
}
250+
237251
void DebugLogQueue(Context context) {
238252
ServerRequestQueue queue = ServerRequestQueue.getInstance(context);
239253

Branch-SDK/androidTest/io/branch/referral/BranchGAIDTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.branch.referral;
22

3-
import android.support.test.runner.AndroidJUnit4;
3+
import androidx.test.ext.junit.runners.AndroidJUnit4;
44

55
import org.json.JSONObject;
66
import org.junit.Assert;

0 commit comments

Comments
 (0)