diff --git a/.circleci/config.yml b/.circleci/config.yml index 0d1b27ee1..8a5c94809 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,35 +10,44 @@ jobs: unit-test: docker: - image: cimg/node:22.12 + resource_class: large steps: - - checkout + - checkout - - restore_cache: - keys: + - restore_cache: + keys: - yarn-cache-{{ checksum "yarn.lock" }} + - yarn-cache- - - run: - name: Install Node.js and Yarn Dependencies - command: yarn install + - run: + name: Enable Corepack + command: sudo corepack enable - - run: - name: Build the Project - command: yarn run build + - run: + name: Install Node.js and Yarn Dependencies + command: yarn install --immutable --network-timeout 300000 + no_output_timeout: 20m + environment: + NODE_OPTIONS: "--max-old-space-size=4096" - - run: - name: Expo Prebuild - command: cd apps/AEPSampleAppNewArchEnabled && npx expo prebuild + - run: + name: Build the Project + command: yarn run build - - save_cache: - key: yarn-cache-{{ checksum "yarn.lock" }} - paths: - - ./node_modules - - ./apps/AEPSampleAppNewArchEnabled/node_modules + - run: + name: Expo Prebuild + command: cd apps/AEPSampleAppNewArchEnabled && npx expo prebuild - - run: - name: Unit Tests - command: yarn test --watchAll=false --runInBand + - save_cache: + paths: + - .yarn/cache + - .yarn/unplugged + key: yarn-cache-{{ checksum "yarn.lock" }} + + - run: + name: Unit Tests + command: yarn test --watchAll=false --runInBand build-sample-app-android: executor: @@ -47,90 +56,173 @@ jobs: resource_class: large steps: - - checkout + - checkout + + - run: + name: Enable Corepack + command: sudo corepack enable - - run: - name: Install Node.js and Yarn Dependencies - command: yarn install + - run: + name: Install Node.js and Yarn Dependencies + command: yarn install --network-timeout 300000 + no_output_timeout: 20m + environment: + NODE_OPTIONS: "--max-old-space-size=4096" - - run: - name: Build the Project - command: yarn run build + - run: + name: Build the Project + command: yarn run build - - run: - name: Expo Prebuild - command: cd apps/AEPSampleAppNewArchEnabled && npx expo prebuild + - run: + name: Expo Prebuild + command: cd apps/AEPSampleAppNewArchEnabled && npx expo prebuild - - run: - name: Building Android Sample App - command: yarn sampleappnewarchenabled:android:build - environment: - _JAVA_OPTIONS: "-Xmx4096M -XX:MaxMetaspaceSize=512m" + - run: + name: Building Android Sample App + command: yarn sampleappnewarchenabled:android:build + environment: + _JAVA_OPTIONS: "-Xmx4096M -XX:MaxMetaspaceSize=512m" build-sample-app-ios: macos: - xcode: 16.2.0 - resource_class: m2pro.medium + xcode: 16.4.0 + resource_class: m4pro.medium + + steps: + - checkout + + - restore_cache: + keys: + - yarn-cache-{{ checksum "yarn.lock" }} + - yarn-cache- + + - run: + name: Set Xcode Path + command: sudo xcode-select -s /Applications/Xcode.app + + - node/install: + node-version: '22.12.0' + + - run: + name: Enable Corepack + command: sudo corepack enable + + - run: + name: Install Node.js and Yarn Dependencies + command: yarn install --immutable --network-timeout 300000 + no_output_timeout: 20m + environment: + NODE_OPTIONS: "--max-old-space-size=4096" + + - run: + name: Build the Project + command: yarn run build + + - run: + name: Expo Prebuild + command: cd apps/AEPSampleAppNewArchEnabled && npx expo prebuild + + - save_cache: + paths: + - .yarn/cache + - .yarn/unplugged + key: yarn-cache-{{ checksum "yarn.lock" }} + + - run: + name: Install Cocoapods + command: sudo gem install cocoapods + + - run: + name: Install Pods + command: yarn sampleappnewarchenabled:ios:pod:install + + - run: + name: Building iOS Sample App + command: | + cd apps/AEPSampleAppNewArchEnabled/ios + xcodebuild \ + -workspace AEPSampleAppNewArchEnabled.xcworkspace \ + -scheme AEPSampleAppNewArchEnabled \ + -sdk iphonesimulator \ + -destination "generic/platform=iOS Simulator" \ + clean build + + build-aepsampleapp-ios: + macos: + xcode: 16.4.0 + resource_class: m4pro.medium steps: - - checkout - - - restore_cache: - keys: - - ios-yarn-cache-{{ checksum "yarn.lock" }} - - - run: - name: Set Xcode Path - command: sudo xcode-select -s /Applications/Xcode.app - - - node/install: - node-version: '22.12.0' - - - run: - name: Install Node.js and Yarn Dependencies - command: yarn install - - - run: - name: Build the Project - command: yarn run build - - - run: - name: Expo Prebuild - command: cd apps/AEPSampleAppNewArchEnabled && npx expo prebuild - - - save_cache: - key: ios-yarn-cache-{{ checksum "yarn.lock" }} - paths: - - ./node_modules - - ./apps/AEPSampleAppNewArchEnabled/node_modules - - - run: - name: Install Cocoapods - command: sudo gem install cocoapods - - - run: - name: Install Pods - command: yarn sampleappnewarchenabled:ios:pod:install - - - run: - name: Building iOS Sample App - command: | - cd apps/AEPSampleAppNewArchEnabled/ios - xcodebuild \ - -workspace AEPSampleAppNewArchEnabled.xcworkspace \ - -scheme AEPSampleAppNewArchEnabled \ - -sdk iphonesimulator \ - -destination "generic/platform=iOS Simulator" \ - clean build + - checkout + + - restore_cache: + keys: + - yarn-cache-aepsampleapp-{{ checksum "apps/AEPSampleApp/yarn.lock" }} + - yarn-cache-aepsampleapp- + + - run: + name: Set Xcode Path + command: sudo xcode-select -s /Applications/Xcode.app + + - node/install: + node-version: '20.19.4' + + - run: + name: Enable Corepack + command: sudo corepack enable + + - run: + name: Install Root Dependencies + command: yarn install --immutable --network-timeout 300000 + no_output_timeout: 20m + environment: + NODE_OPTIONS: "--max-old-space-size=4096" + + - run: + name: Build the Project + command: yarn run build + + - run: + name: Install AEPSampleApp Dependencies + command: cd apps/AEPSampleApp && yarn install --immutable --network-timeout 300000 + no_output_timeout: 20m + environment: + NODE_OPTIONS: "--max-old-space-size=4096" + + - save_cache: + paths: + - apps/AEPSampleApp/.yarn/cache + - apps/AEPSampleApp/.yarn/unplugged + key: yarn-cache-aepsampleapp-{{ checksum "apps/AEPSampleApp/yarn.lock" }} + + - run: + name: Install Cocoapods + command: sudo gem install cocoapods + + - run: + name: Install Pods + command: yarn sampleapp:ios:pod:install + + - run: + name: Building AEPSampleApp iOS + command: | + cd apps/AEPSampleApp/ios + xcodebuild \ + -workspace AEPSampleApp.xcworkspace \ + -scheme AEPSampleApp \ + -sdk iphonesimulator \ + -destination "generic/platform=iOS Simulator" \ + clean build workflows: version: 2.1 ci-workflow: jobs: - - unit-test - - build-sample-app-ios - # - build-sample-app-android - # Disable the Android build job because of the error below: - # Execution failed for task ':react-native-reanimated:configureCMakeDebug[arm64-v8a]'. - # > [CXX1210] /root/project/apps/AEPSampleApp/node_modules/react-native-reanimated/android/CMakeLists.txt debug|arm64-v8a : No compatible library found - # The Android build job will be enabled once the issue is resolved. + - unit-test + - build-sample-app-ios + - build-aepsampleapp-ios + # - build-sample-app-android + # Disable the Android build job because of the error below: + # Execution failed for task ':react-native-reanimated:configureCMakeDebug[arm64-v8a]'. + # > [CXX1210] /root/project/apps/AEPSampleApp/node_modules/react-native-reanimated/android/CMakeLists.txt debug|arm64-v8a : No compatible library found + # The Android build job will be enabled once the issue is resolved. diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..025dd8c8b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,8 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..af3ad1281 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +/.yarn/** linguist-vendored +/.yarn/releases/* binary +/.yarn/plugins/**/* binary +/.pnp.* binary linguist-generated diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index af2403049..9d1ac9978 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -17,6 +17,8 @@ jobs: uses: actions/setup-node@master with: node-version: 20.19.4 + - name: Enable Corepack + run: corepack enable - name: install dependencies run: yarn install - name: Authenticate with Registry diff --git a/.yarnrc.yml b/.yarnrc.yml index 3186f3f07..e0c77d49a 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -1 +1,7 @@ +compressionLevel: mixed + +enableGlobalCache: false + +nmHoistingLimits: workspaces + nodeLinker: node-modules diff --git a/README.md b/README.md index b1385ec83..56cad773f 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ This repository is a monorepo and contains a collection of React Native modules - React Native -Requires React Native (0.60.0 and above) +Requires React Native (0.83.0 and above) - Xcode diff --git a/apps/AEPSampleApp/App.tsx b/apps/AEPSampleApp/App.tsx index dda609662..1fd42327d 100644 --- a/apps/AEPSampleApp/App.tsx +++ b/apps/AEPSampleApp/App.tsx @@ -11,12 +11,13 @@ governing permissions and limitations under the License. */ import * as React from 'react'; -import {Button, View} from 'react-native'; +import {Button, View, Text, TextInput, ScrollView, StyleSheet, useColorScheme} from 'react-native'; import {createDrawerNavigator} from '@react-navigation/drawer'; -import {NavigationContainer} from '@react-navigation/native'; +import {DarkTheme, DefaultTheme, NavigationContainer} from '@react-navigation/native'; import OptimizeView from './extensions/OptimizeView'; import ProfileView from './extensions/ProfileView'; import MessagingView from './extensions/MessagingView'; +import InboxView from './extensions/InboxView'; import CoreView from './extensions/CoreView'; import IdentityView from './extensions/IdentityView'; import ConsentView from './extensions/ConsentView'; @@ -28,130 +29,138 @@ import TargetView from './extensions/TargetView'; import PlacesView from './extensions/PlacesView'; import {NavigationProps} from './types/props'; import CampaignClassicView from './extensions/CampaignClassicView'; -import { MobileCore , LogLevel} from '@adobe/react-native-aepcore'; -import { useEffect } from 'react'; +import AsyncStorage from '@react-native-async-storage/async-storage'; +import { MobileCore, LogLevel } from '@adobe/react-native-aepcore'; +import { useState, useEffect, createContext, useContext } from 'react'; + +const STORAGE_KEY = 'aep_app_id'; + +const DEFAULT_APP_ID = ''; + +export const AppContext = createContext({ + appId: DEFAULT_APP_ID, + initSDK: (_id: string) => {}, +}); function HomeScreen({navigation}: NavigationProps) { - return ( - -