Skip to content

Commit c363304

Browse files
committed
Merge branch 'master' into Release-2.0.0
2 parents 79bb85b + 83c49d0 commit c363304

File tree

10 files changed

+336
-311
lines changed

10 files changed

+336
-311
lines changed

.github/workflows/stale.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
2+
#
3+
# You can adjust the behavior by modifying this file.
4+
# For more information, see:
5+
# https://github.com/actions/stale
6+
name: Mark stale issues
7+
8+
on:
9+
schedule:
10+
- cron: '0 0 * * *'
11+
12+
jobs:
13+
stale:
14+
15+
runs-on: ubuntu-latest
16+
permissions:
17+
issues: write
18+
19+
steps:
20+
- uses: actions/stale@v5
21+
with:
22+
repo-token: ${{ secrets.STALE_PERSONAL_ACCESS_TOKEN }}
23+
days-before-issue-stale: 60
24+
days-before-close: 7
25+
stale-issue-message: 'This issue has been automatically marked as stale due to inactivity for 60 days. If this issue is still relevant, please respond with any updates or this issue will be closed in 7 days. If you believe this is a mistake, please comment to let us know. Thank you for your contributions.'
26+
stale-issue-label: 'no-issue-activity'
27+
close-issue-message: 'This issue has been closed due to inactivity. If this issue is still relevant, please reopen it or create a new one. Thank you for your contributions.'
28+
start-date: '2023-05-22'

AdobeBranchExample/build.gradle

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ android {
1616
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
1717
}
1818
}
19+
compileOptions {
20+
sourceCompatibility JavaVersion.VERSION_1_8
21+
targetCompatibility JavaVersion.VERSION_1_8
22+
}
1923
}
2024

2125
dependencies {
@@ -31,7 +35,10 @@ dependencies {
3135
api project(path: ':AdobeBranchExtension')
3236

3337
// Adobe
34-
implementation 'com.adobe.marketing.mobile:analytics:1.+'
35-
implementation 'com.adobe.marketing.mobile:userprofile:1.+'
36-
implementation 'com.adobe.marketing.mobile:sdk-core:1.+'
38+
implementation 'com.adobe.marketing.mobile:analytics:2.0.2'
39+
implementation 'com.adobe.marketing.mobile:userprofile:2.0.0'
40+
implementation 'com.adobe.marketing.mobile:core:2.2.0'
41+
implementation 'com.adobe.marketing.mobile:lifecycle:2.0.2'
42+
implementation 'com.adobe.marketing.mobile:identity:2.0.2'
43+
implementation 'com.adobe.marketing.mobile:signal:2.0.1'
3744
}
Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
package io.branch.adobe.demo;
22

3-
import com.adobe.marketing.mobile.AdobeCallback;
3+
import android.app.Application;
4+
45
import com.adobe.marketing.mobile.Analytics;
6+
import com.adobe.marketing.mobile.Extension;
57
import com.adobe.marketing.mobile.Identity;
6-
import com.adobe.marketing.mobile.InvalidInitException;
78
import com.adobe.marketing.mobile.Lifecycle;
89
import com.adobe.marketing.mobile.LoggingMode;
910
import com.adobe.marketing.mobile.MobileCore;
1011
import com.adobe.marketing.mobile.Signal;
1112
import com.adobe.marketing.mobile.UserProfile;
1213

13-
import android.app.Application;
14-
15-
import java.util.Arrays;
14+
import java.util.ArrayList;
15+
import java.util.List;
1616

1717
import io.branch.adobe.extension.AdobeBranchExtension;
18-
import io.branch.referral.*;
18+
import io.branch.referral.Branch;
19+
import io.branch.referral.PrefHelper;
1920

2021
public class DemoApplication extends Application {
2122
private static final String ADOBE_APP_ID = "d10f76259195/b0503e1a5dce/launch-9948a3b3a89d-development";
@@ -24,6 +25,8 @@ public class DemoApplication extends Application {
2425
public void onCreate() {
2526
super.onCreate();
2627

28+
Branch.enableLogging();
29+
2730
// Initialize
2831
initAdobeBranch();
2932
Analytics.setVisitorIdentifier("custom_identifier_1234"); // to test custom visitor ID (key: "vid")
@@ -33,31 +36,27 @@ private void initAdobeBranch() {
3336
PrefHelper.Debug("initAdobeBranch()");
3437

3538
MobileCore.setApplication(this);
36-
MobileCore.setLogLevel(LoggingMode.DEBUG);
37-
38-
try {
39-
Analytics.registerExtension();
40-
UserProfile.registerExtension();
41-
Identity.registerExtension();
42-
Lifecycle.registerExtension();
43-
Signal.registerExtension();
44-
45-
// NOTE! following code will enable you to configure exclusion list or allow list, but you can't define both!
46-
// If you don't configure any, all events will send to Branch which is not ideal!
47-
// Define the allow list of the events names
48-
// AdobeBranchExtension.configureEventAllowList(Arrays.asList("VIEW"));
49-
50-
// Define the exclusion list of the events names
51-
AdobeBranchExtension.configureEventExclusionList(Arrays.asList("VIEW"));
52-
53-
AdobeBranchExtension.registerExtension(this, true);
54-
MobileCore.start(new AdobeCallback () {
55-
@Override public void call(Object o) {
56-
MobileCore.configureWithAppID(ADOBE_APP_ID);
57-
}
58-
});
59-
} catch (InvalidInitException e) {
60-
PrefHelper.Debug("InitException: " + e.getLocalizedMessage());
61-
}
39+
MobileCore.configureWithAppID(ADOBE_APP_ID);
40+
MobileCore.setLogLevel(LoggingMode.ERROR);
41+
42+
// NOTE! following code will enable you to configure exclusion list or allow list, but you can't define both!
43+
// If you don't configure any, all events will send to Branch which is not ideal!
44+
// Define the allow list of the events names
45+
//AdobeBranchExtension.configureEventAllowList(Arrays.asList("VIEW"));
46+
47+
// Define the exclusion list of the events names
48+
//AdobeBranchExtension.configureEventExclusionList(Arrays.asList("VIEW"));
49+
50+
List<Class<? extends Extension>> extensions = new ArrayList<>();
51+
extensions.add(UserProfile.EXTENSION);
52+
extensions.add(Analytics.EXTENSION);
53+
extensions.add(Identity.EXTENSION);
54+
extensions.add(Lifecycle.EXTENSION);
55+
extensions.add(Signal.EXTENSION);
56+
extensions.add(AdobeBranchExtension.EXTENSION);
57+
MobileCore.registerExtensions(extensions, o -> {
58+
PrefHelper.Debug("AEP Mobile SDK is initialized");
59+
});
60+
6261
}
6362
}

AdobeBranchExtension/build.gradle

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ android {
1919
consumerProguardFile('proguard-rules.pro')
2020
}
2121
}
22+
compileOptions {
23+
sourceCompatibility JavaVersion.VERSION_1_8
24+
targetCompatibility JavaVersion.VERSION_1_8
25+
}
2226
}
2327

2428
dependencies {
@@ -32,16 +36,21 @@ dependencies {
3236
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
3337

3438
// Branch
35-
api 'io.branch.sdk.android:library:5.2.7'
39+
api 'io.branch.sdk.android:library:5.4.0'
3640
implementation ('com.google.android.gms:play-services-ads-identifier:17.0.0')
3741
// for Huawei devices without GMS, adding it requires bumping up min api level to 19 though, so we
3842
// leave it up to the client to add it following Branch documentation here: https://help.branch.io/developers-hub/docs/android-basic-integration
3943
//implementation 'com.huawei.hms:ads-identifier:3.4.28.305'
4044

4145
// Adobe
42-
androidTestImplementation 'com.adobe.marketing.mobile:analytics:1.+'
43-
androidTestImplementation 'com.adobe.marketing.mobile:userprofile:1.+'
44-
implementation 'com.adobe.marketing.mobile:sdk-core:1.10.0'
46+
androidTestImplementation 'com.adobe.marketing.mobile:analytics:2.0.2'
47+
androidTestImplementation 'com.adobe.marketing.mobile:userprofile:2.0.0'
48+
implementation 'com.adobe.marketing.mobile:core:2.2.0'
49+
implementation 'com.adobe.marketing.mobile:lifecycle:2.0.2'
50+
implementation 'com.adobe.marketing.mobile:identity:2.0.2'
51+
implementation 'com.adobe.marketing.mobile:signal:2.0.1'
52+
53+
androidTestImplementation project(path: ':AdobeBranchExtension')
4554
}
4655

4756
apply from: 'https://raw.githubusercontent.com/BranchMetrics/GradleToMavenOptionalDependencies/master/gradle-maven-push.gradle'

AdobeBranchExtension/src/androidTest/java/io/branch/adobe/extension/test/AdobeBranchTest.java

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
11
package io.branch.adobe.extension.test;
22

3+
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
4+
35
import android.app.Application;
46
import android.content.Context;
57

8+
import androidx.test.ext.junit.rules.ActivityScenarioRule;
69
import androidx.test.ext.junit.runners.AndroidJUnit4;
7-
import androidx.test.rule.ActivityTestRule;
810

9-
import com.adobe.marketing.mobile.AdobeCallback;
1011
import com.adobe.marketing.mobile.Analytics;
12+
import com.adobe.marketing.mobile.Extension;
1113
import com.adobe.marketing.mobile.Identity;
12-
import com.adobe.marketing.mobile.InvalidInitException;
1314
import com.adobe.marketing.mobile.Lifecycle;
1415
import com.adobe.marketing.mobile.LoggingMode;
1516
import com.adobe.marketing.mobile.MobileCore;
1617
import com.adobe.marketing.mobile.Signal;
1718
import com.adobe.marketing.mobile.UserProfile;
1819

19-
import org.junit.Assert;
2020
import org.junit.After;
21+
import org.junit.Assert;
2122
import org.junit.Before;
2223
import org.junit.Rule;
2324
import org.junit.Test;
2425
import org.junit.runner.RunWith;
2526

2627
import java.lang.reflect.Method;
28+
import java.util.ArrayList;
29+
import java.util.List;
2730

31+
import io.branch.adobe.extension.AdobeBranch;
2832
import io.branch.adobe.extension.AdobeBranchExtension;
2933
import io.branch.referral.Branch;
3034
import io.branch.referral.PrefHelper;
3135

32-
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
33-
3436
/**
3537
* Base Instrumented test, which will execute on an Android device.
3638
*/
@@ -42,37 +44,37 @@ public class AdobeBranchTest {
4244
private Context mContext;
4345

4446
@Rule
45-
public ActivityTestRule<MockActivity> mActivityRule = new ActivityTestRule<>(MockActivity.class);
47+
public ActivityScenarioRule<MockActivity> mActivityRule = new ActivityScenarioRule<>(MockActivity.class);
48+
4649

4750
@Before
4851
public void setUp() {
49-
app = mActivityRule.getActivity().getApplication();
50-
mContext = getInstrumentation().getContext();
52+
mActivityRule.getScenario().onActivity(activity -> {
53+
app = activity.getApplication();
54+
mContext = getInstrumentation().getContext();
5155

52-
initAdobeBranch();
56+
AdobeBranch.getAutoInstance(mContext);
57+
initAdobeBranch();
58+
});
5359
}
5460

5561
private void initAdobeBranch() {
5662
PrefHelper.Debug("AdobeBranchTest.initAdobeBranch()");
5763

5864
MobileCore.setApplication(app);
65+
MobileCore.configureWithAppID(ADOBE_APP_ID);
5966
MobileCore.setLogLevel(LoggingMode.DEBUG);
6067

61-
try {
62-
Analytics.registerExtension();
63-
UserProfile.registerExtension();
64-
Identity.registerExtension();
65-
Lifecycle.registerExtension();
66-
Signal.registerExtension();
67-
AdobeBranchExtension.registerExtension(app, true);
68-
MobileCore.start(new AdobeCallback() {
69-
@Override public void call(Object o) {
70-
MobileCore.configureWithAppID(ADOBE_APP_ID);
71-
}
72-
});
73-
} catch (InvalidInitException e) {
74-
PrefHelper.Debug("AdobeBranchTest.InvalidInitException: " + e.getLocalizedMessage());
75-
}
68+
List<Class<? extends Extension>> extensions = new ArrayList<>();
69+
extensions.add(UserProfile.EXTENSION);
70+
extensions.add(Analytics.EXTENSION);
71+
extensions.add(Identity.EXTENSION);
72+
extensions.add(Lifecycle.EXTENSION);
73+
extensions.add(Signal.EXTENSION);
74+
extensions.add(AdobeBranchExtension.EXTENSION);
75+
MobileCore.registerExtensions(extensions, o -> {
76+
PrefHelper.Debug("AEP Mobile SDK is initialized");
77+
});
7678
}
7779

7880
@After

0 commit comments

Comments
 (0)