Skip to content

Commit 34244ae

Browse files
authored
Merge pull request #456 from adobe/staging
simplification release along with BOM
2 parents 0e3f601 + e916767 commit 34244ae

File tree

64 files changed

+2055
-2907
lines changed

Some content is hidden

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

64 files changed

+2055
-2907
lines changed

README.md

Lines changed: 18 additions & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ This repository is a monorepo and contains a collection of React Native modules
3030
> [!IMPORTANT]
3131
> The Adobe React Native SDK utilizes the React Native interop layer to ensure compatibility with new architecture.
3232
33-
## Requirements
33+
## Requirements
3434

3535
- React Native
3636

@@ -43,7 +43,7 @@ To submit iOS apps to the App Store, you must build them using Xcode 15 or later
4343
## iOS Privacy Manifest
4444

4545
> [!IMPORTANT]
46-
> Adobe Experience Platform React Native **6.x** libraries now depend on Experience Platform iOS 5.x SDKs, which have been updated to align with Apple's latest guidelines on [privacy manifest](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files). For further details on how Apple's privacy-related announcements affect the Adobe mobile SDK for iOS, please refer to this [document](https://developer.adobe.com/client-sdks/resources/privacy-manifest/).
46+
> Starting from Adobe Experience Platform React Native **6.x**, the libraries depend on Experience Platform iOS 5.x SDKs, which have been updated to align with Apple's latest guidelines on [privacy manifest](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files). For further details on how Apple's privacy-related announcements affect the Adobe mobile SDK for iOS, please refer to this [document](https://developer.adobe.com/client-sdks/resources/privacy-manifest/).
4747
4848
## Expo Support
4949

@@ -76,10 +76,10 @@ The following code snippet shows for Mobile Core and Edge Network extensions as
7676
...
7777
"dependencies": {
7878
"react-native": "0.72.5",
79-
"@adobe/react-native-aepcore": "^6.0.0", //core is required and includes aepcore, aepsignal, aeplifecycle, aepidentity libraries
80-
"@adobe/react-native-aepedge": "^6.0.0",
81-
"@adobe/react-native-aepedgeidentity": "^6.0.0",
82-
"@adobe/react-native-aepedgeconsent": "^6.0.0",
79+
"@adobe/react-native-aepcore": "^7.0.0", //core is required and includes aepcore, aepsignal, aeplifecycle, aepidentity libraries
80+
"@adobe/react-native-aepedge": "^7.0.0",
81+
"@adobe/react-native-aepedgeidentity": "^7.0.0",
82+
"@adobe/react-native-aepedgeconsent": "^7.0.0",
8383
...
8484
},
8585
```
@@ -112,182 +112,25 @@ To update native dependencies to latest available versions, run the following co
112112
cd ios && pod update && cd ..
113113
```
114114

115-
## Initializing
116-
117-
Initializing the SDK should be done in native code inside your `AppDelegate` (iOS) and `MainApplication` (Android). The following code snippets demonstrate how to install and register the AEP Mobile Core and Edge Network extensions. Documentation on how to initialize each extension can be found in _./packages/{extension}/README.md_.
118-
119-
##### **iOS**
120-
121-
```objective-c
122-
//AppDelegate.h
123-
@import AEPCore;
124-
@import AEPServices;
125-
@import AEPLifecycle;
126-
@import AEPSignal;
127-
@import AEPEdge;
128-
@import AEPEdgeIdentity;
129-
@import AEPEdgeConsent;
130-
...
131-
```
132-
133-
```objective-c
134-
//AppDelegate.m
135-
...
136-
@implementation AppDelegate
137-
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
138-
[AEPMobileCore setLogLevel: AEPLogLevelDebug];
139-
[AEPMobileCore configureWithAppId:@"yourAppID"];
140-
141-
const UIApplicationState appState = application.applicationState;
142-
143-
[AEPMobileCore registerExtensions: @[
144-
AEPMobileLifecycle.class,
145-
AEPMobileSignal.class,
146-
AEPMobileEdge.class,
147-
AEPMobileEdgeIdentity.class,
148-
AEPMobileEdgeConsent.class,
149-
] completion:^{
150-
if (appState != UIApplicationStateBackground) {
151-
[AEPMobileCore lifecycleStart:nil}];
152-
}
153-
}];
154-
return YES;
155-
}
156-
157-
@end
158-
159-
```
160-
161-
> To enable the Lifecycle metrics, [implement the Lifecycle APIs](./packages/core/README.md#lifecycle)
115+
## Importing the extension:
116+
In your React Native application, import the extensions.
162117

163-
> Hint : While running iOS application after Adobe Experience Platform SDK installation. If you have build error that states:
164-
> "ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'"
165-
> This is because Adobe Experience Platform SDK now requires the app uses swift interfaces. Add a dummy .swift file to your project to embed the swift standard libs. See the SampleApp presented in this repo for example.
118+
The following example demonstrates how to import core extensions from the Adobe Experience Platform SDK in your React Native application:
166119

167-
##### **Android:**
168-
169-
###### **Java:**
170-
171-
```java
172-
//MainApplication.java
173-
import com.adobe.marketing.mobile.AdobeCallback;
174-
import com.adobe.marketing.mobile.Extension;
175-
import com.adobe.marketing.mobile.LoggingMode;
176-
import com.adobe.marketing.mobile.MobileCore;
177-
import com.adobe.marketing.mobile.Lifecycle;
178-
import com.adobe.marketing.mobile.Signal;
179-
import com.adobe.marketing.mobile.Edge;
180-
import com.adobe.marketing.mobile.edge.consent.Consent;
181-
...
182-
import android.app.Application;
120+
```typescript
121+
import { MobileCore, Lifecycle, Signal, LogLevel, PrivacyStatus, Event } from '@adobe/react-native-aepcore'
183122
```
184123

185-
```java
186-
...
187-
public class MainApplication extends Application implements ReactApplication {
188-
...
189-
@Override
190-
public void on Create(){
191-
super.onCreate();
192-
...
193-
MobileCore.setApplication(this);
194-
MobileCore.setLogLevel(LoggingMode.DEBUG);
195-
MobileCore.configureWithAppID("yourAppID");
196-
List<Class<? extends Extension>> extensions = Arrays.asList(
197-
Lifecycle.EXTENSION,
198-
Signal.EXTENSION,
199-
Edge.EXTENSION,
200-
com.adobe.marketing.mobile.edge.identity.Identity.EXTENSION,
201-
Consent.EXTENSION);
202-
MobileCore.registerExtensions(extensions, o -> {
203-
Log.d(LOG_TAG, "AEP Mobile SDK is initialized");
204-
MobileCore.lifecycleStart(null);
205-
//enable this for Lifecycle. See Note for collecting Lifecycle metrics.
206-
});
207-
}
208-
}
209-
```
124+
Refer to each package's documentation for specific import details.
210125

211-
###### **Kotlin:**
212-
213-
```kotlin
214-
// MainApplication.kt
215-
import com.adobe.marketing.mobile.Edge
216-
import com.adobe.marketing.mobile.Lifecycle
217-
import com.adobe.marketing.mobile.LoggingMode
218-
import com.adobe.marketing.mobile.MobileCore
219-
import com.adobe.marketing.mobile.MobileCore.getApplication
220-
import com.adobe.marketing.mobile.edge.consent.Consent
221-
import com.adobe.marketing.mobile.edge.identity.Identity
222-
```
126+
## Initializing
223127

224-
```kotlin
225-
// MainApplication.kt
226-
class MainApplication : Application(), ReactApplication {
227-
...
228-
override fun onCreate() {
229-
super.onCreate()
230-
231-
MobileCore.setApplication(this);
232-
MobileCore.setLogLevel(LoggingMode.DEBUG)
233-
MobileCore.configureWithAppID("YOUR-APP-ID");
234-
MobileCore.registerExtensions(
235-
listOf(
236-
Lifecycle.EXTENSION,
237-
Edge.EXTENSION,
238-
Identity.EXTENSION,
239-
Consent.EXTENSION
240-
),
241-
) {
242-
Log.d("MainApp", "Adobe Experience Platform Mobile SDK was initialized")
243-
}
244-
245-
SoLoader.init(this, false)
246-
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
247-
// If you opted-in for the New Architecture, we load the native entry point for this app.
248-
load()
249-
}
250-
ApplicationLifecycleDispatcher.onApplicationCreate(this)
251-
}
252-
```
128+
Then, initialize the SDK using the following methods:
129+
- [MobileCore.initializeWithAppId(appId)](https://github.com/adobe/aepsdk-react-native/tree/main/packages/core#initializewithappid)
130+
- [MobileCore.initialize(initOptions)](https://github.com/adobe/aepsdk-react-native/tree/main/packages/core#initialize)
253131

254-
```kotlin
255-
// MainActivity.kt
256-
257-
import android.app.Activity
258-
import android.app.Application.ActivityLifecycleCallbacks
259-
import com.adobe.marketing.mobile.MobileCore
260-
261-
// Implementing global lifecycle callbacks
262-
override fun onCreate(savedInstanceState: Bundle?) {
263-
// Set the theme to AppTheme BEFORE onCreate to support
264-
// coloring the background, status bar, and navigation bar.
265-
// This is required for expo-splash-screen.
266-
setTheme(R.style.AppTheme);
267-
super.onCreate(null)
268-
269-
application.registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
270-
override fun onActivityResumed(activity: Activity) {
271-
MobileCore.setApplication(application)
272-
MobileCore.lifecycleStart(null)
273-
}
274-
275-
override fun onActivityPaused(activity: Activity) {
276-
MobileCore.lifecyclePause()
277-
}
278-
279-
// the following methods aren't needed for our lifecycle purposes, but are
280-
// required to be implemented by the ActivityLifecycleCallbacks object
281-
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {}
282-
override fun onActivityStarted(activity: Activity) {}
283-
override fun onActivityStopped(activity: Activity) {}
284-
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {}
285-
override fun onActivityDestroyed(activity: Activity) {}
286-
})
287-
}
288-
```
289-
290-
> For further details on Lifecycle implementation, please refer to the [Lifecycle API documentation](https://github.com/adobe/aepsdk-react-native/tree/main/packages/core#lifecycle).
132+
> [!NOTE]
133+
> Starting from Adobe Experience Platform React native **7.x**, there is no longer a need to initialize the SDK on the [native platforms](https://github.com/adobe/aepsdk-react-native/tree/v6.x/#initializing), as was required in earlier versions.
291134
292135
## Migration guide
293136

apps/AEPSampleApp/App.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import TargetView from './extensions/TargetView';
2828
import PlacesView from './extensions/PlacesView';
2929
import {NavigationProps} from './types/props';
3030
import CampaignClassicView from './extensions/CampaignClassicView';
31+
import { MobileCore , LogLevel} from '@adobe/react-native-aepcore';
32+
import { useEffect } from 'react';
3133

3234
function HomeScreen({navigation}: NavigationProps) {
3335
return (
@@ -91,6 +93,37 @@ function HomeScreen({navigation}: NavigationProps) {
9193
const Drawer = createDrawerNavigator();
9294

9395
export default function App() {
96+
97+
useEffect(() => {
98+
// If you need more customization, you can use the initOptions object and MobileCore.initialize() method.
99+
100+
// const initOptions = {
101+
// appId: "YOUR-APP-ID", //optional,
102+
// lifecycleAutomaticTrackingEnabled: true, //optional
103+
// lifecycleAdditionalContextData: { "contextDataKey": "contextDataValue" }, //optional
104+
// appGroupIOS: "group.com.your.app.identifier" //optional, for iOS app groups
105+
// };
106+
107+
// MobileCore.initialize(initOptions).then(() => {
108+
// console.log("AEP SDK Initialized");
109+
// }).catch((error) => {
110+
// console.log("AEP SDK Initialization error", error);
111+
// });
112+
113+
// Initialize SDK once in App.tsx or the entry file.
114+
// For functional components, use useEffect with an empty dependency array.
115+
// For class components, call initializeWithAppId inside componentDidMount.
116+
MobileCore.setLogLevel(LogLevel.DEBUG);
117+
MobileCore.initializeWithAppId("YOUR-APP-ID")
118+
.then(() => {
119+
console.log("AEP SDK Initialized");
120+
})
121+
.catch((error) => {
122+
console.error("AEP SDK Initialization error:", error);
123+
});
124+
}, []);
125+
126+
94127
return (
95128
<NavigationContainer>
96129
<Drawer.Navigator initialRouteName="Home">

apps/AEPSampleApp/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ This project is a React Native app set up using `react-native-cli`. It serves as
2020

2121
### Add your App Id:
2222

23-
In `apps/AEPSampleApp/ios/AEPSampleApp/AppDelegate.mm`, find the call to `configureWithAppId` and add your app id.
24-
25-
In `apps/AEPSampleApp/android/app/src/main/java/com/aepsampleapp/MainApplication.java`, find the call to `configureWithAppId` and add your app id.
23+
In `/apps/AEPSampleApp/App.tsx`, locate the call to `MobileCore.initializeWithAppId(appId:"YOUR_APP_ID")` and replace `"YOUR_APP_ID"` with your property App Id.
2624

2725
> Note: App id is configured in a mobile property in Data Collection UI, in Tags. Refer to [configure with App ID per environment](https://developer.adobe.com/client-sdks/home/base/mobile-core/configuration/#configure-with-app-id-per-environment) page for more information.
2826

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ governing permissions and limitations under the License.
1010
*/
1111
package com.aepsampleapp
1212

13-
import com.adobe.marketing.mobile.MobileCore
1413
import com.facebook.react.ReactActivity
1514
import com.facebook.react.ReactActivityDelegate
1615
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
@@ -31,14 +30,4 @@ class MainActivity : ReactActivity() {
3130
override fun createReactActivityDelegate(): ReactActivityDelegate =
3231
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
3332

34-
override fun onResume() {
35-
super.onResume()
36-
MobileCore.setApplication(application);
37-
MobileCore.lifecycleStart(null);
38-
}
39-
40-
override fun onPause() {
41-
super.onPause()
42-
MobileCore.lifecyclePause();
43-
}
4433
}

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

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,6 @@ governing permissions and limitations under the License.
1111
package com.aepsampleapp
1212

1313
import android.app.Application
14-
import com.adobe.marketing.mobile.AdobeCallback
15-
import com.adobe.marketing.mobile.Assurance
16-
import com.adobe.marketing.mobile.Edge
17-
import com.adobe.marketing.mobile.Extension
18-
import com.adobe.marketing.mobile.Lifecycle
19-
import com.adobe.marketing.mobile.LoggingMode
20-
import com.adobe.marketing.mobile.Messaging
21-
import com.adobe.marketing.mobile.MobileCore
22-
import com.adobe.marketing.mobile.Places
23-
import com.adobe.marketing.mobile.Signal
24-
import com.adobe.marketing.mobile.Target
25-
import com.adobe.marketing.mobile.UserProfile
26-
import com.adobe.marketing.mobile.edge.bridge.EdgeBridge
27-
import com.adobe.marketing.mobile.edge.consent.Consent
28-
import com.adobe.marketing.mobile.edge.identity.Identity
29-
import com.adobe.marketing.mobile.optimize.Optimize
3014
import com.facebook.react.PackageList
3115
import com.facebook.react.ReactApplication
3216
import com.facebook.react.ReactHost
@@ -37,8 +21,6 @@ import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
3721
import com.facebook.react.defaults.DefaultReactNativeHost
3822
import com.facebook.react.flipper.ReactNativeFlipper
3923
import com.facebook.soloader.SoLoader
40-
import java.util.Arrays
41-
4224

4325
class MainApplication : Application(), ReactApplication {
4426

@@ -69,31 +51,7 @@ class MainApplication : Application(), ReactApplication {
6951
load()
7052
}
7153
ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager)
72-
73-
74-
MobileCore.setApplication(this)
75-
MobileCore.setLogLevel(LoggingMode.VERBOSE)
76-
MobileCore.configureWithAppID("YOUR-APP-ID")
77-
val extensions: List<Class<out Extension?>> = Arrays.asList(
78-
Lifecycle.EXTENSION,
79-
Signal.EXTENSION,
80-
Edge.EXTENSION,
81-
Identity.EXTENSION,
82-
Consent.EXTENSION,
83-
EdgeBridge.EXTENSION,
84-
Messaging.EXTENSION,
85-
UserProfile.EXTENSION,
86-
Assurance.EXTENSION,
87-
Places.EXTENSION,
88-
Target.EXTENSION,
89-
Optimize.EXTENSION,
90-
com.adobe.marketing.mobile.Identity.EXTENSION
91-
)
92-
MobileCore.registerExtensions(extensions,
93-
AdobeCallback { o: Any? ->
94-
MobileCore.lifecycleStart(
95-
null
96-
)
97-
})
54+
55+
9856
}
9957
}

0 commit comments

Comments
 (0)