Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved workspace config to root package.json and Add expo modules support in sample app. #374

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ This repository is a monorepo and contains a collection of React Native modules
| [@adobe/react-native-aeptarget](./packages/target) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aeptarget.svg)](https://www.npmjs.com/package/@adobe/react-native-aeptarget) ![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aeptarget) | [Target](https://developer.adobe.com/client-sdks/documentation/adobe-target)
| [@adobe/react-native-aepcampaignclassic](./packages/campaignclassic) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepcampaignclassic.svg)](https://www.npmjs.com/package/@adobe/react-native-aepcampaignclassic) [![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepcampaignclassic)](https://www.npmjs.com/package/@adobe/react-native-aepcampaignclassic) |[CampaignClassic](https://developer.adobe.com/client-sdks/documentation/adobe-campaign-classic)

> [!NOTE]
> [!NOTE]
> Since version 5.0.0 of the Adobe React Native SDK, all React Native libraries that share the same major version are compatible with each other.

> [!NOTE]
> [!NOTE]
> The React Native libraries within this repository are specifically designed to support the Android and iOS platforms only.


Expand All @@ -40,7 +40,7 @@ To submit iOS apps to the App Store, you must build them using Xcode 15 or later

## iOS Privacy Manifest

> [!IMPORTANT]
> [!IMPORTANT]
> 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/).

## React Native New Architecture Support
Expand Down Expand Up @@ -226,6 +226,25 @@ Underlying Objective-C module 'AEPRulesEngine' not found
```
Refer to the solution [here](https://github.com/adobe/aepsdk-react-native/issues/263#issuecomment-1498393770).

## Integration with Expo

The Adobe Experience Platform SDK is not supported in Expo managed workflow. However, you can use the SDK in the bare workflow. For more information, see the [Expo documentation](https://docs.expo.dev/bare/exploring-bare-workflow/).

### Steps to work with Bare React Native workflow

1. Install expo-modules using the following command:

```bash
npx install-expo-modules@latest
```

2. Make sure the changes are reflected in the desired platform files. For example, in iOS, the changes should be reflected in the `Podfile`. Use this link to verify the changes: https://docs.expo.dev/bare/installing-expo-modules/#configuration-for-ios
3. Clean Xcode build folder and rebuild.
4. If you get an error “Import of C++ module 'Foundation' appears within extern "C" language linkage specification” in EXDefines.h file, then modify the following code snippet in the `EXDefines.h` file:

1. Move the `#import <Foundation/Foundation.h>` from line 82 and move it to end of file at line 115.


## Contributing

Contributions are welcomed! See [CONTRIBUTING](CONTRIBUTING.md) and [development.md](./docs/development.md) guides for more information.
Expand Down
5 changes: 5 additions & 0 deletions apps/AEPSampleApp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,8 @@ yarn-error.log

# testing
/coverage

# Expo
.expo
dist/
web-build/
11 changes: 8 additions & 3 deletions apps/AEPSampleApp/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ governing permissions and limitations under the License.
*/

import * as React from 'react';
import {Button, View} from 'react-native';
import {Button, View, Text} from 'react-native';
import {createDrawerNavigator} from '@react-navigation/drawer';
import {NavigationContainer} from '@react-navigation/native';
import OptimizeView from './extensions/OptimizeView';
Expand All @@ -28,10 +28,12 @@ import TargetView from './extensions/TargetView';
import PlacesView from './extensions/PlacesView';
import {NavigationProps} from './types/props';
import CampaignClassicView from './extensions/CampaignClassicView';
import Constants from 'expo-constants';

function HomeScreen({navigation}: NavigationProps) {
return (
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<Text>Device Name: {Constants.deviceName}</Text>
<Button
onPress={() => navigation.navigate('CoreView')}
title="Core/Lifecycle/Signal"
Expand Down Expand Up @@ -64,7 +66,7 @@ function HomeScreen({navigation}: NavigationProps) {
onPress={() => navigation.navigate('ConsentView')}
title="Consent"
/>
<Button
<Button
onPress={() => navigation.navigate('EdgeBridgeView')}
title="Edge Bridge"
/>
Expand Down Expand Up @@ -97,7 +99,10 @@ export default function App() {
<Drawer.Screen name="Home" component={HomeScreen} />
<Drawer.Screen name="CoreView" component={CoreView} />
<Drawer.Screen name="AssuranceView" component={AssuranceView} />
<Drawer.Screen name="CampaignClassicView" component={CampaignClassicView} />
<Drawer.Screen
name="CampaignClassicView"
component={CampaignClassicView}
/>
<Drawer.Screen name="ConsentView" component={ConsentView} />
<Drawer.Screen name="EdgeBridgeView" component={EdgeBridgeView} />
<Drawer.Screen name="EdgeView" component={EdgeView} />
Expand Down
5 changes: 5 additions & 0 deletions apps/AEPSampleApp/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ react {
//
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
// hermesFlags = ["-O", "-output-source-map"]
//
// Added by install-expo-modules
entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", rootDir.getAbsoluteFile().getParentFile().getAbsolutePath(), "android", "absolute"].execute(null, rootDir).text.trim())
cliFile = new File(["node", "--print", "require.resolve('@expo/cli')"].execute(null, rootDir).text.trim())
bundleCommand = "export:embed"
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag
governing permissions and limitations under the License.
*/
package com.aepsampleapp
import expo.modules.ReactActivityDelegateWrapper

import com.adobe.marketing.mobile.MobileCore
import com.facebook.react.ReactActivity
Expand All @@ -29,7 +30,7 @@ class MainActivity : ReactActivity() {
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
*/
override fun createReactActivityDelegate(): ReactActivityDelegate =
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED, DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled))

override fun onResume() {
super.onResume()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ OF ANY KIND, either express or implied. See the License for the specific languag
governing permissions and limitations under the License.
*/
package com.aepsampleapp
import android.content.res.Configuration
import expo.modules.ApplicationLifecycleDispatcher
import expo.modules.ReactNativeHostWrapper

import android.app.Application
import com.adobe.marketing.mobile.AdobeCallback
Expand Down Expand Up @@ -43,7 +46,7 @@ import java.util.Arrays
class MainApplication : Application(), ReactApplication {

override val reactNativeHost: ReactNativeHost =
object : DefaultReactNativeHost(this) {
ReactNativeHostWrapper(this, object : DefaultReactNativeHost(this) {
override fun getPackages(): List<ReactPackage> =
PackageList(this).packages.apply {
// Packages that cannot be autolinked yet can be added manually here, for example:
Expand All @@ -56,7 +59,7 @@ class MainApplication : Application(), ReactApplication {

override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
}
})

override val reactHost: ReactHost
get() = getDefaultReactHost(this.applicationContext, reactNativeHost)
Expand Down Expand Up @@ -95,5 +98,11 @@ class MainApplication : Application(), ReactApplication {
null
)
})
ApplicationLifecycleDispatcher.onApplicationCreate(this)
}

override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig)
}
}
3 changes: 3 additions & 0 deletions apps/AEPSampleApp/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ rootProject.name = 'AEPSampleApp'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')

apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle")
useExpoModules()
4 changes: 2 additions & 2 deletions apps/AEPSampleApp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ OF ANY KIND, either express or implied. See the License for the specific languag
governing permissions and limitations under the License.
*/

import { AppRegistry } from 'react-native';
import {AppRegistry} from 'react-native';
import App from './App';
import { name as appName } from './app.json';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);
Loading