Skip to content

Commit a225c01

Browse files
yangyansong-adbedsoffiantinicacheungkevindice
authored
Merge Staging -> Core for Core 2.0.0 update (#233)
* feat: adds react native wrapper for aep places * [android12] add android:exported attribute to core extension's manifest (#202) * clean up core extension * fix review comments * add a new API: clearUpdatedConfiguration * update public docs * update android native implementation * add android:exported attribute to core extension's manifest file as it's required by Android 12 * Merge branch 'staging' into core (#201) # Conflicts: # apps/AEPSampleApp/ios/Podfile.lock * update core version * [android12] add android:exported attribute to core extension's manifest (#202) (#203) * clean up core extension * fix review comments * add a new API: clearUpdatedConfiguration * update public docs * update android native implementation * add android:exported attribute to core extension's manifest file as it's required by Android 12 * Merge branch 'staging' into core (#201) # Conflicts: # apps/AEPSampleApp/ios/Podfile.lock * update core version * build: updates xcode image in circleci * feat: adds score to offer class, better type defs * docs: update readme, copyrights * docs: 📝 adds license * docs: 📝 update docs with examples, add places to root docs * feat: adds target rn wrapper * docs: update docs for target * docs: 📝 updates target docs with syntax * fix: 🎨 pr feedback for adding score * chore: ⬆️ updates to latest versions of messaging * feat: ✨ adds support for campaign classic * build: 💚 change test commad for circleci * fix: 🥅 updates podfile * chore: 🔖 upgrades beta packages to release * Update Readme for Edge and Edge Identity. Replace all https://aep-sdks.gitbook.io/docs/ to adobe.io docs. Update Readme for Edge and Edge Identity. Replace all https://aep-sdks.gitbook.io/docs/ to adobe.io docs. * fix: defer to root project sdk version gradle params (#223) * Bump up package versions to adopt Android 2.0 (#226) * update extension packages with Android 2.0 builds * no message * revert messaging version to 1.0.0 * address review comments * bump API level to 33 for test app * Update SDK installation steps for Android 2.0 integration (#232) * update extension packages with Android 2.0 builds * no message * installation doc update for Android 2.0 * update docs * Update README.md * update sample app * Update README.md * address review comments --------- Co-authored-by: dsoffiantini <[email protected]> Co-authored-by: Calise Cheung <[email protected]> Co-authored-by: Kevin Dice <[email protected]>
1 parent 9d215cb commit a225c01

File tree

134 files changed

+8521
-1601
lines changed

Some content is hidden

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

134 files changed

+8521
-1601
lines changed

.circleci/config.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,16 @@ jobs:
4242
4343
build-sample-app-ios:
4444
macos:
45-
xcode: "12.0.1"
45+
xcode: "13.0.0"
4646

4747
steps:
4848
- checkout
4949

50+
# CircleCI puts xcode app in consistent path, RN looks for versioned path
51+
- run:
52+
name: Move xcode
53+
command: cd /Applications && mv Xcode.app Xcode-13.0.app
54+
5055
- run:
5156
name: Install latest NodeJS
5257
command: brew install node
@@ -66,7 +71,7 @@ jobs:
6671
command: sudo gem install cocoapods
6772

6873
- run:
69-
name: install pods
74+
name: Install pods
7075
command: yarn sampleapp:ios:pod:install
7176

7277
- run:

README.md

Lines changed: 59 additions & 51 deletions
Large diffs are not rendered by default.

apps/AEPSampleApp/App.tsx

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
2-
import { Button, View } from 'react-native';
3-
import { createDrawerNavigator } from '@react-navigation/drawer';
4-
import { NavigationContainer } from '@react-navigation/native';
2+
import {Button, View} from 'react-native';
3+
import {createDrawerNavigator} from '@react-navigation/drawer';
4+
import {NavigationContainer} from '@react-navigation/native';
55
import OptimizeView from './extensions/OptimizeView';
66
import ProfileView from './extensions/ProfileView';
77
import MessagingView from './extensions/MessagingView';
@@ -11,11 +11,14 @@ import ConsentView from './extensions/ConsentView';
1111
import EdgeView from './extensions/EdgeView';
1212
import AssuranceView from './extensions/AssuranceView';
1313
import EdgeIdentityView from './extensions/EdgeIdentityView';
14-
import { NavigationProps } from './types/props';
14+
import TargetView from './extensions/TargetView';
15+
import PlacesView from './extensions/PlacesView';
16+
import {NavigationProps} from './types/props';
17+
import CampaignClassicView from './extensions/CampaignClassicView';
1518

16-
function HomeScreen({ navigation }: NavigationProps) {
19+
function HomeScreen({navigation}: NavigationProps) {
1720
return (
18-
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
21+
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
1922
<Button
2023
onPress={() => navigation.navigate('CoreView')}
2124
title="Core/Lifecycle/Signal"
@@ -31,16 +34,15 @@ function HomeScreen({ navigation }: NavigationProps) {
3134

3235
<Button
3336
onPress={() => navigation.navigate('MessagingView')}
34-
title="Messaging" />
37+
title="Messaging"
38+
/>
3539

3640
<Button
3741
onPress={() => navigation.navigate('OptimizeView')}
38-
title="Optimize"/>
39-
40-
<Button
41-
onPress={() => navigation.navigate('EdgeView')}
42-
title="Edge"
42+
title="Optimize"
4343
/>
44+
45+
<Button onPress={() => navigation.navigate('EdgeView')} title="Edge" />
4446
<Button
4547
onPress={() => navigation.navigate('EdgeIdentityView')}
4648
title="EdgeIdentity"
@@ -53,6 +55,18 @@ function HomeScreen({ navigation }: NavigationProps) {
5355
onPress={() => navigation.navigate('AssuranceView')}
5456
title="Assurance"
5557
/>
58+
<Button
59+
onPress={() => navigation.navigate('TargetView')}
60+
title="Target"
61+
/>
62+
<Button
63+
onPress={() => navigation.navigate('PlacesView')}
64+
title="Places"
65+
/>
66+
<Button
67+
onPress={() => navigation.navigate('CampaignClassicView')}
68+
title="Campaign Classic"
69+
/>
5670
</View>
5771
);
5872
}
@@ -65,15 +79,18 @@ export default function App() {
6579
<Drawer.Navigator initialRouteName="Home">
6680
<Drawer.Screen name="Home" component={HomeScreen} />
6781
<Drawer.Screen name="CoreView" component={CoreView} />
68-
<Drawer.Screen name="ProfileView" component={ProfileView} />
69-
<Drawer.Screen name="IdentityView" component={IdentityView} />
70-
<Drawer.Screen name="MessagingView" component={MessagingView} />
82+
<Drawer.Screen name="AssuranceView" component={AssuranceView} />
83+
<Drawer.Screen name="CampaignClassicView" component={CampaignClassicView} />
84+
<Drawer.Screen name="ConsentView" component={ConsentView} />
7185
<Drawer.Screen name="EdgeView" component={EdgeView} />
7286
<Drawer.Screen name="EdgeIdentityView" component={EdgeIdentityView} />
73-
<Drawer.Screen name="ConsentView" component={ConsentView} />
74-
<Drawer.Screen name="AssuranceView" component={AssuranceView} />
75-
<Drawer.Screen name="OptimizeView" component={OptimizeView}/>
76-
</Drawer.Navigator >
77-
</NavigationContainer >
87+
<Drawer.Screen name="IdentityView" component={IdentityView} />
88+
<Drawer.Screen name="MessagingView" component={MessagingView} />
89+
<Drawer.Screen name="OptimizeView" component={OptimizeView} />
90+
<Drawer.Screen name="PlacesView" component={PlacesView} />
91+
<Drawer.Screen name="ProfileView" component={ProfileView} />
92+
<Drawer.Screen name="TargetView" component={TargetView} />
93+
</Drawer.Navigator>
94+
</NavigationContainer>
7895
);
7996
}

apps/AEPSampleApp/android/app/src/main/java/com/aepsampleapp/MainActivity.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*/
1212
package com.aepsampleapp;
1313

14+
import com.adobe.marketing.mobile.MobileCore;
1415
import com.facebook.react.ReactActivity;
1516
import com.facebook.react.ReactActivityDelegate;
1617
import com.facebook.react.ReactRootView;
@@ -35,6 +36,19 @@ protected ReactActivityDelegate createReactActivityDelegate() {
3536
return new MainActivityDelegate(this, getMainComponentName());
3637
}
3738

39+
@Override
40+
protected void onResume() {
41+
super.onResume();
42+
MobileCore.setApplication(getApplication());
43+
MobileCore.lifecycleStart(null);
44+
}
45+
46+
@Override
47+
protected void onPause() {
48+
super.onPause();
49+
MobileCore.lifecyclePause();
50+
}
51+
3852
public static class MainActivityDelegate extends ReactActivityDelegate {
3953
public MainActivityDelegate(ReactActivity activity, String mainComponentName) {
4054
super(activity, mainComponentName);

apps/AEPSampleApp/android/app/src/main/java/com/aepsampleapp/MainApplication.java

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,20 @@
1414

1515
import android.app.Application;
1616
import android.content.Context;
17-
import com.adobe.marketing.mobile.AdobeCallback;
1817
import com.adobe.marketing.mobile.Assurance;
1918
import com.adobe.marketing.mobile.Edge;
20-
import com.adobe.marketing.mobile.InvalidInitException;
19+
import com.adobe.marketing.mobile.Extension;
2120
import com.adobe.marketing.mobile.Lifecycle;
2221
import com.adobe.marketing.mobile.LoggingMode;
2322
import com.adobe.marketing.mobile.Messaging;
2423
import com.adobe.marketing.mobile.MobileCore;
2524
import com.adobe.marketing.mobile.Signal;
2625
import com.adobe.marketing.mobile.UserProfile;
2726
import com.adobe.marketing.mobile.edge.consent.Consent;
28-
import com.adobe.marketing.mobile.edge.identity.Identity;
2927
import com.adobe.marketing.mobile.optimize.Optimize;
28+
import com.adobe.marketing.mobile.Places;
29+
import com.adobe.marketing.mobile.Target;
3030
import com.aepsampleapp.newarchitecture.MainApplicationReactNativeHost;
31-
import com.adobe.marketing.mobile.InvalidInitException;
3231
import com.facebook.react.PackageList;
3332
import com.facebook.react.ReactApplication;
3433
import com.facebook.react.ReactInstanceManager;
@@ -37,6 +36,7 @@
3736
import com.facebook.react.config.ReactFeatureFlags;
3837
import com.facebook.soloader.SoLoader;
3938
import java.lang.reflect.InvocationTargetException;
39+
import java.util.Arrays;
4040
import java.util.List;
4141

4242
public class MainApplication extends Application implements ReactApplication {
@@ -87,16 +87,15 @@ public void onCreate() {
8787
}
8888

8989
/**
90-
* Loads Flipper in React Native templates. Call this in the onCreate method
91-
* with something like initializeFlipper(this,
92-
* getReactNativeHost().getReactInstanceManager());
90+
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
91+
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
9392
*
9493
* @param context
9594
* @param reactInstanceManager
9695
*/
9796
private static void
9897
initializeFlipper(Context context,
99-
ReactInstanceManager reactInstanceManager) {
98+
ReactInstanceManager reactInstanceManager) {
10099
if (BuildConfig.DEBUG) {
101100
try {
102101
/*
@@ -106,7 +105,7 @@ public void onCreate() {
106105
Class<?> aClass = Class.forName("com.aepsampleapp.ReactNativeFlipper");
107106
aClass
108107
.getMethod("initializeFlipper", Context.class,
109-
ReactInstanceManager.class)
108+
ReactInstanceManager.class)
110109
.invoke(null, context, reactInstanceManager);
111110
} catch (ClassNotFoundException e) {
112111
e.printStackTrace();
@@ -117,26 +116,21 @@ public void onCreate() {
117116
} catch (InvocationTargetException e) {
118117
e.printStackTrace();
119118
}
120-
121-
try {
122-
Edge.registerExtension();
123-
Identity.registerExtension();
124-
Messaging.registerExtension();
125-
UserProfile.registerExtension();
126-
Lifecycle.registerExtension();
127-
Signal.registerExtension();
128-
Consent.registerExtension();
129-
Assurance.registerExtension();
130-
Optimize.registerExtension();
131-
} catch (InvalidInitException e) {
132-
e.printStackTrace();
133-
}
134119
MobileCore.configureWithAppID("YOUR-APP-ID");
135-
MobileCore.start(new AdobeCallback() {
136-
@Override
137-
public void call(Object o) {
138-
MobileCore.lifecycleStart(null);
139-
}
120+
List<Class<? extends Extension>> extensions = Arrays.asList(
121+
Lifecycle.EXTENSION,
122+
Signal.EXTENSION,
123+
Edge.EXTENSION,
124+
com.adobe.marketing.mobile.edge.identity.Identity.EXTENSION,
125+
Messaging.EXTENSION,
126+
UserProfile.EXTENSION,
127+
Assurance.EXTENSION,
128+
Places.EXTENSION,
129+
Target.EXTENSION,
130+
Optimize.EXTENSION,
131+
Consent.EXTENSION);
132+
MobileCore.registerExtensions(extensions, o -> {
133+
MobileCore.lifecycleStart(null);
140134
});
141135
}
142136
}

apps/AEPSampleApp/android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ buildscript {
66
ext {
77
buildToolsVersion = "29.0.3"
88
minSdkVersion = 21
9-
compileSdkVersion = 31
10-
targetSdkVersion = 31
9+
compileSdkVersion = 33
10+
targetSdkVersion = 33
1111

1212
if (System.properties['os.arch'] == "aarch64") {
1313
// For M1 Users we need to use the NDK 24 which added support for aarch64
@@ -22,7 +22,7 @@ buildscript {
2222
mavenCentral()
2323
}
2424
dependencies {
25-
classpath("com.android.tools.build:gradle:7.0.4")
25+
classpath("com.android.tools.build:gradle:7.2.2")
2626
// NOTE: Do not place your application dependencies here; they belong
2727
// in the individual module build.gradle files
2828
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import {CampaignClassic} from '@adobe/react-native-aepcampaignclassic';
2+
import React from 'react';
3+
import {Button, ScrollView, Text, View} from 'react-native';
4+
import styles from '../styles/styles';
5+
import {NavigationProps} from '../types/props';
6+
7+
function CampaignClassicView({navigation}: NavigationProps) {
8+
const extensionVersion = async () => {
9+
const version = await CampaignClassic.extensionVersion();
10+
console.log(`AdobeExperienceSDK: Campaign Classic version: ${version}`);
11+
};
12+
13+
const registerDeviceWithToken = () => {
14+
CampaignClassic.registerDeviceWithToken('myToken', 'myUserKey');
15+
console.log('Device registered!')
16+
}
17+
18+
const trackNotificationClickWithUserInfo = () => {
19+
CampaignClassic.trackNotificationClickWithUserInfo({'_mId': '12345', '_dId': 'testDId'});
20+
console.log('Notification clicked!')
21+
}
22+
23+
const trackNotificationReceiveWithUserInfo = () => {
24+
CampaignClassic.trackNotificationReceiveWithUserInfo({'_mId': '12345', '_dId': 'testDId'});
25+
console.log('Notification received!')
26+
}
27+
28+
29+
return (
30+
<View style={{...styles.container, marginTop: 30}}>
31+
<ScrollView contentContainerStyle={{marginTop: 75}}>
32+
<Button onPress={() => navigation.goBack()} title="Go to main page" />
33+
<Text style={styles.welcome}>Campaign Classic</Text>
34+
<View style={{margin: 5}}>
35+
<Button title="Extension Version" onPress={extensionVersion} />
36+
<Button title="Register Device" onPress={registerDeviceWithToken} />
37+
<Button
38+
title="Track User Click"
39+
onPress={trackNotificationClickWithUserInfo}
40+
/>
41+
<Button
42+
title="Track User Receive"
43+
onPress={trackNotificationReceiveWithUserInfo}
44+
/>
45+
</View>
46+
</ScrollView>
47+
</View>
48+
);
49+
}
50+
51+
export default CampaignClassicView;

apps/AEPSampleApp/extensions/MessagingView.tsx

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,45 @@ governing permissions and limitations under the License.
1212

1313
import React from 'react';
1414
import {Button, Text, View, ScrollView} from 'react-native';
15-
import {Messaging} from '@adobe/react-native-aepmessaging';
15+
import {Message, Messaging} from '@adobe/react-native-aepmessaging';
1616
import styles from '../styles/styles';
1717
import {NavigationProps} from '../types/props';
1818

19-
const messagingExtensionVersion = () =>
20-
Messaging.extensionVersion().then(version =>
21-
console.log('AdobeExperienceSDK: Messaging version: ' + version),
22-
);
19+
const messagingExtensionVersion = async () => {
20+
const version = await Messaging.extensionVersion();
21+
console.log(`AdobeExperienceSDK: Messaging version: ${version}`);
22+
};
23+
24+
const refreshInAppMessages = () => {
25+
Messaging.refreshInAppMessages();
26+
console.log('messages refreshed');
27+
};
28+
29+
const setMessagingDelegate = () => {
30+
Messaging.setMessagingDelegate({
31+
onDismiss: () => console.log('dismissed!'),
32+
onShow: () => console.log('show'),
33+
shouldShowMessage: () => true,
34+
urlLoaded: () => true,
35+
});
36+
console.log('messaging delegate set');
37+
};
38+
39+
const saveMessage = () => {
40+
const message = new Message('1', true);
41+
Messaging.saveMessage(message);
42+
console.log('message saved');
43+
};
2344

2445
const MessagingView = ({navigation}: NavigationProps) => (
2546
<View style={styles.container}>
2647
<ScrollView contentContainerStyle={{marginTop: 75}}>
2748
<Button onPress={() => navigation.goBack()} title="Go to main page" />
2849
<Text style={styles.welcome}>Messaging</Text>
2950
<Button title="extensionVersion()" onPress={messagingExtensionVersion} />
51+
<Button title="refreshInAppMessages()" onPress={refreshInAppMessages} />
52+
<Button title="setMessagingDelegate()" onPress={setMessagingDelegate} />
53+
<Button title="saveMessage()" onPress={saveMessage} />
3054
</ScrollView>
3155
</View>
3256
);

0 commit comments

Comments
 (0)