Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

Commit

Permalink
Release 2.0.0-alpha.1
Browse files Browse the repository at this point in the history
2.0.0-alpha.1
* import ACPCore using Cocoapods

* remove the old sample app

* add a brand new sample app

* Update README.md

* Add .circleci/config.yml

* Delete adobe-react-native-acpcore-2.0.0.tgz

* update sample app (android) and makefile

* no message

* update CoacoaPods

* no message

* no message

* no message

* no message

* remove public APIs: start/lifecycleStart/lifecyclPause/registerExtension

* Update README.md

* update the TV sample app to enable autolinking (#112)

* add README for the sample app

* add mavenCentral() to the sample app

* add README for the sample app (#114)

* cleanup

* add copyright header to the sample code

* add copyright header to the sample code (#115)

* add copyright to the sample code

* add copyright header to the sample code (2) (#116)

* update version ->  2.0.0-alpha.1

* Prepare for the (2.0.0) alpha release (#117)

* add copyright header to the sample code

* add copyright to the sample code

* update version ->  2.0.0-alpha.1

* add copyright header to the sample code
  • Loading branch information
yangyansong-adbe authored Aug 3, 2021
1 parent b38aa3b commit d91a05b
Show file tree
Hide file tree
Showing 255 changed files with 75,225 additions and 41,406 deletions.
13 changes: 12 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ jobs:
- 1-gems-{{ checksum "ios/Gemfile.lock" }}

# make sure we're on the right version of cocoapods
- run:
name: Install latest Cocoapods
command: sudo gem install cocoapods

- run:
name: Verify Cocoapods Version
command: cd ios && bundle check || bundle install --path vendor/bundle
Expand Down Expand Up @@ -72,7 +76,10 @@ jobs:

- run:
name: Building Android Sample App
command: make build-sample-android
command: |
export NODE_OPTIONS=--max-old-space-size=8192
make build-sample-android
build-sample-app-ios:
Expand All @@ -85,6 +92,10 @@ jobs:
- run:
name: Install react-native-cli
command: npm install -g react-native-cli

- run:
name: Install latest Cocoapods
command: sudo gem install cocoapods

- run:
name: Copy changes into sample app
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# OSX
#
.DS_Store
Expand All @@ -9,7 +8,6 @@ node_modules/
npm-debug.log
yarn-error.log


# Xcode
#
build/
Expand Down
15 changes: 4 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ build-ios: setup
(cd ios && xcodebuild build -workspace RCT${PROJECT_NAME}.xcworkspace -scheme RCT${PROJECT_NAME})

build-sample-android:
(cd sample/ACP*Sample/android && ./gradlew assembleRelease)
(cd sample/ACP*SampleApp/android && ./gradlew clean assembleRelease -x bundleReleaseJsAndAssets)

build-sample-ios:
(cd sample/ACP*Sample/ios && xcodebuild build -project ACPCoreSample.xcodeproj -scheme ACPCoreSample CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED="NO" CODE_SIGNING_ALLOWED="NO")
(cd sample/ACP*SampleApp/ios && pod update)
(cd sample/ACP*SampleApp/ && npx react-native run-ios)

run-tests:
jest --testPathIgnorePatterns sample/ node_modules/ --modulePathIgnorePatterns sample/ --runInBand
Expand All @@ -28,12 +29,4 @@ run-tests-locally: setup
./node_modules/.bin/jest --testPathIgnorePatterns sample/ node_modules/ --modulePathIgnorePatterns sample/

copy-to-sample:
cd sample/ACP*Sample/ && sh copy-changes-to-sample.sh

# fetches the latest iOS & Android SDK and put them in the project
update-libs:
rm -rf acp-sdks # clean if needed
git clone https://github.com/Adobe-Marketing-Cloud/acp-sdks
cp -a acp-sdks/iOS/${PROJECT_NAME}/ ios/libs/ # copy iOS lib
sh update-android-sdk.sh
rm -rf acp-sdks
(cd sample/ACP*SampleApp && make sync)
17 changes: 3 additions & 14 deletions RCTACPCore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,16 @@ Pod::Spec.new do |s|
s.version = package["version"]
s.summary = "Core library for Adobe Experience Cloud SDK. Written and Supported by Adobe."
s.author = "Adobe Mobile SDK Team"

s.homepage = "https://github.com/adobe/react-native-acpcore"

s.license = "Apache 2.0 License"
s.platforms = { :ios => "10.0", :tvos => "10.0" }

s.source = { :git => "https://github.com/adobe/react-native-acpcore.git", :tag => "#{s.version}" }


s.requires_arc = true

s.dependency "React"
s.dependency "ACPCore"

s.source_files = "ios/**/*.{h,m}"
s.ios.vendored_frameworks = 'ios/libs/ACPCore.xcframework', 'ios/libs/ACPIdentity.xcframework', 'ios/libs/ACPLifecycle.xcframework', 'ios/libs/ACPSignal.xcframework'
s.ios.frameworks = 'UIKit', 'SystemConfiguration', 'WebKit', 'UserNotifications'
s.ios.library = 'sqlite3.0', 'c++', 'z'

s.tvos.vendored_frameworks = 'ios/libs/ACPCoreTV.xcframework', 'ios/libs/ACPIdentityTV.xcframework', 'ios/libs/ACPLifecycleTV.xcframework', 'ios/libs/ACPSignalTV.xcframework'
s.tvos.frameworks = 'SystemConfiguration'
s.tvos.library = 'sqlite3.0', 'c++', 'z'



end
35 changes: 9 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
`@adobe/react-native-acpcore` is a wrapper around the iOS, tvOS and Android [AEP Core SDK](https://aep-sdks.gitbook.io/docs/using-mobile-extensions/mobile-core) to allow for integration with React Native applications. Functionality to enable the Core extension is provided entirely through JavaScript documented below.

## Contents
- [Requirements](#Requirements)
- [Installation](#installation)
- [iOS](#31-ios-project)
- [Next steps](#4-next-steps)
Expand All @@ -20,6 +21,13 @@
- [Signal](#signal)
- [Troubleshooting](#troubleshooting)


## Requirements
- @adobe/react-native-acpcore 1.x
- React Native 0.44.+
- @adobe/react-native-acpcore 2.x
- React Native 0.60.+

## Installation

You need to install the SDK with [npm](https://www.npmjs.com/) and configure the native Android/iOS project in your react native project.
Expand Down Expand Up @@ -214,11 +222,6 @@ ACPCore.dispatchResponseEvent(responseEvent, requestEvent);
ACPIdentity.extensionVersion().then(version => console.log("AdobeExperienceSDK: ACPIdentity version: " + version));
```

##### Registering the extension with Core:
```javascript
ACPIdentity.registerExtension();
```

##### Sync Identifier:
```javascript
ACPIdentity.syncIdentifier("identifierType", "identifier", ACPMobileVisitorAuthenticationState.AUTHENTICATED);
Expand Down Expand Up @@ -287,39 +290,19 @@ var visitorId = new ACPVisitorID(idOrigin?: string, idType: string, id?: string,

### [Lifecycle](https://aep-sdks.gitbook.io/docs/using-mobile-extensions/mobile-core/lifecycle)

> Note: Implementing Lifecycle via Javascript may lead to inaccurate Lifecycle metrics, therefore we recommend implementing Lifecycle in native [Android and iOS code](https://aep-sdks.gitbook.io/docs/using-mobile-extensions/mobile-core/lifecycle). However, if implementing Lifecycle in Javascript is required you can use the [`AppState`](https://facebook.github.io/react-native/docs/appstate) to receive notifications about when your app enters foreground/background. Based on the `AppState` you can make the corresponding calls to `lifecycleStart` and `lifecyclePause`.
> Note: Implementing Lifecycle via Javascript may lead to inaccurate Lifecycle metrics, therefore we recommend implementing Lifecycle in native [Android and iOS code](https://aep-sdks.gitbook.io/docs/using-mobile-extensions/mobile-core/lifecycle).
##### Getting the extension version:
```javascript
ACPLifecycle.extensionVersion().then(version => console.log("AdobeExperienceSDK: ACPLifecycle version: " + version));
```

##### Registering the extension with Core:
```javascript
ACPLifecycle.registerExtension();
```

##### Starting a lifecycle event:
```javascript
ACPCore.lifecycleStart({"lifecycleStart": "myData"});
```

##### Pausing a lifecycle event:
```javascript
ACPCore.lifecyclePause();
```

### [Signal](https://aep-sdks.gitbook.io/docs/using-mobile-extensions/mobile-core/signals)
##### Getting the extension version:
```javascript
ACPSignal.extensionVersion().then(version => console.log("AdobeExperienceSDK: ACPSignal version: " + version));
```

##### Registering the extension with Core:
```javascript
ACPSignal.registerExtension();
```

##### Collecting PII:
```javascript
ACPCore.collectPii({"myPii": "data"});
Expand Down
19 changes: 0 additions & 19 deletions __tests__/ACPCoreTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ describe('ACPCore', () => {
expect(spy).toHaveBeenCalled();
});

test('start is called', async () => {
const spy = jest.spyOn(NativeModules.ACPCore, 'start');
await ACPCore.start();
expect(spy).toHaveBeenCalled();
});

test('configureWithAppId is called with correct parameters', async () => {
const spy = jest.spyOn(NativeModules.ACPCore, 'configureWithAppId');
let appId = "testAppId";
Expand Down Expand Up @@ -139,19 +133,6 @@ describe('ACPCore', () => {
expect(spy).toHaveBeenCalledWith(pushIdentifier);
});

test('lifecycleStart is called with correct parameters', async () => {
const spy = jest.spyOn(NativeModules.ACPCore, 'lifecycleStart');
let contextData = {"testKey": "testValue"};
await ACPCore.lifecycleStart(contextData);
expect(spy).toHaveBeenCalledWith(contextData);
});

test('lifecyclePause is called', async () => {
const spy = jest.spyOn(NativeModules.ACPCore, 'lifecyclePause');
await ACPCore.lifecyclePause();
expect(spy).toHaveBeenCalled();
});

test('collectPii is called with correct parameters', async () => {
const spy = jest.spyOn(NativeModules.ACPCore, 'collectPii');
let contextData = {"testKey": "testValue"};
Expand Down
6 changes: 0 additions & 6 deletions __tests__/ACPIdentityTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ describe('ACPIdentity', () => {
expect(spy).toHaveBeenCalled();
});

test('registerExtension is called', async () => {
const spy = jest.spyOn(NativeModules.ACPIdentity, 'registerExtension');
await ACPIdentity.registerExtension();
expect(spy).toHaveBeenCalled();
});

test('syncIdentifiers is called with correct parameters', async () => {
const spy = jest.spyOn(NativeModules.ACPIdentity, 'syncIdentifiers');
let identifiers = {"testKey": "testValue"};
Expand Down
5 changes: 0 additions & 5 deletions __tests__/ACPLifecycleTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,4 @@ describe('ACPLifecycle', () => {
expect(spy).toHaveBeenCalled();
});

test('registerExtension is called', async () => {
const spy = jest.spyOn(NativeModules.ACPLifecycle, 'registerExtension');
await ACPLifecycle.registerExtension();
expect(spy).toHaveBeenCalled();
});
});
5 changes: 0 additions & 5 deletions __tests__/ACPSignalTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,4 @@ describe('ACPSignal', () => {
expect(spy).toHaveBeenCalled();
});

test('registerExtension is called', async () => {
const spy = jest.spyOn(NativeModules.ACPSignal, 'registerExtension');
await ACPSignal.registerExtension();
expect(spy).toHaveBeenCalled();
});
});
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ repositories {

dependencies {
implementation "com.facebook.react:react-native:+"
api "com.adobe.marketing.mobile:sdk-core:1.8.0"
api "com.adobe.marketing.mobile:sdk-core:1.+"
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,6 @@ public void extensionVersion(final Promise promise) {
promise.resolve(MobileCore.extensionVersion());
}

@ReactMethod
public void start(final Promise promise) {
if (hasStarted.get()) {
promise.resolve(true);
return;
}

MobileCore.start(new AdobeCallback() {
@Override
public void call(Object obj) {
hasStarted.set(true);
promise.resolve(true);
}
});
}

@ReactMethod
public void configureWithAppId(final String appId) {
MobileCore.configureWithAppID(appId);
Expand Down Expand Up @@ -205,16 +189,6 @@ public void setPushIdentifier(final String pushIdentifier) {
MobileCore.setPushIdentifier(pushIdentifier);
}

@ReactMethod
public void lifecycleStart(final ReadableMap additionalContextData) {
MobileCore.lifecycleStart(RCTACPMapUtil.toStringMap(additionalContextData));
}

@ReactMethod
public void lifecyclePause() {
MobileCore.lifecyclePause();
}

@ReactMethod
public void collectPii(final ReadableMap data) {
MobileCore.collectPii(RCTACPMapUtil.toStringMap(data));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,6 @@ public void extensionVersion(final Promise promise) {
promise.resolve(Identity.extensionVersion());
}

@ReactMethod
public void registerExtension() {
try {
Identity.registerExtension();
} catch (InvalidInitException e) {
Log.d(getName(), "Registering Identity extension failed with error: " + e.getMessage());
}
}

@ReactMethod
public void syncIdentifiers(final ReadableMap identifiers) {
Identity.syncIdentifiers(RCTACPMapUtil.toStringMap(identifiers));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,4 @@ public void extensionVersion(final Promise promise) {
promise.resolve(Lifecycle.extensionVersion());
}

@ReactMethod
public void registerExtension() {
try {
Lifecycle.registerExtension();
} catch (InvalidInitException e) {
Log.d(getName(), "Registering Lifecycle extension failed with error: " + e.getMessage());
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,4 @@ public void extensionVersion(final Promise promise) {
promise.resolve(Signal.extensionVersion());
}

@ReactMethod
public void registerExtension() {
try {
Signal.registerExtension();
} catch (InvalidInitException e) {
Log.d(getName(), "Registering Signal extension failed with error: " + e.getMessage());
}
}

}
20 changes: 20 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,24 @@ pod "React-jsinspector", :path => "#{react_native_path}/ReactCommon/jsinspector"
pod 'DoubleConversion', :podspec => "#{react_native_path}/third-party-podspecs/DoubleConversion.podspec"
pod "yoga", :path => "#{react_native_path}/ReactCommon/yoga"
pod "Folly", :podspec => "#{react_native_path}/third-party-podspecs/Folly.podspec"
pod "ACPCore"
end

post_install do |installer|
## Fix for XCode 12.5 beta
find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm",
"_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules", "_initializeModules:(NSArray<Class> *)modules")
end

def find_and_replace(dir, findstr, replacestr)
Dir[dir].each do |name|
text = File.read(name)
replace = text.gsub(findstr,replacestr)
if text != replace
puts "Fix: " + name
File.open(name, "w") { |file| file.puts replace }
STDOUT.flush
end
end
Dir[dir + '*/'].each(&method(:find_and_replace))
end
Loading

0 comments on commit d91a05b

Please sign in to comment.