Skip to content

Commit

Permalink
Merge pull request #68 from emartech/MV-305-auto-linking
Browse files Browse the repository at this point in the history
MV-305 autolinking
  • Loading branch information
eduzatoni authored Jul 25, 2022
2 parents 12d3b8a + ca206ee commit d5f7d8e
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 833 deletions.
51 changes: 1 addition & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,8 @@ We created a sample application to help in the integration and give an example.

## Setup

`$ npm install git+ssh://[email protected]/emartech/react-native-emarsys-sdk.git#1.7.0 --save`
`$ npm install git+ssh://[email protected]/emartech/react-native-emarsys-sdk.git#1.8.0 --save`

### Mostly automatic installation

`$ react-native link react-native-emarsys-wrapper`

#### iOS

Add to your Podfile in ios folder, above the `use_native_modules!` function if you use it:
```
pod 'RNEmarsysWrapper', :podspec => '../node_modules/react-native-emarsys-wrapper/ios/RNEmarsysWrapper.podspec'
```


### Manual installation

#### iOS

1. In XCode, in the project navigator, right click `Libraries``Add Files to [your project's name]`
2. Go to `node_modules``react-native-emarsys-wrapper` and add `RNEmarsysWrapper.xcodeproj`
3. In XCode, in the project navigator, select your project. Add `libRNEmarsysWrapper.a` to your project's `Build Phases``Link Binary With Libraries`
4. Add to your Podfile in ios folder:
```
platform :ios, '11.0'

source 'https://github.com/CocoaPods/Specs.git'

target "<TargetName>" do

# Add this line to your Podfile
pod 'RNEmarsysWrapper', :podspec => '../node_modules/react-native-emarsys-wrapper/ios/RNEmarsysWrapper.podspec'
end
```
5. After creating/editing the Podfile, you need to execute the command below to download CocoaPods dependencies: pod install
6. Run your project (`Cmd+R`)

#### Android

1. Open up `android/app/src/main/java/[...]/MainApplication.java`
- Add `import com.emarsys.rnwrapper.RNEmarsysWrapperPackage;` to the imports at the top of the file
- Add `new RNEmarsysWrapperPackage()` to the list returned by the `getPackages()` method
2. Append the following lines to `android/settings.gradle`:
```
include ':react-native-emarsys-wrapper'
project(':react-native-emarsys-wrapper').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-emarsys-wrapper/android')
```
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
```
compile project(':react-native-emarsys-wrapper')
```

### Requirements

Expand Down
4 changes: 2 additions & 2 deletions ios/RNEmarsysWrapper.podspec → RNEmarsysWrapper.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'json'

package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))

Pod::Spec.new do |s|
s.name = "RNEmarsysWrapper"
Expand All @@ -18,6 +18,6 @@ Pod::Spec.new do |s|
s.source_files = "ios/*.{h,m}"
s.requires_arc = true
s.dependency "React", ">= 0.67.3"
s.dependency "EmarsysSDK", "~> 3.2.2"
s.dependency "EmarsysSDK", "~> 3.2.3"

end
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ android {
defaultConfig {
minSdkVersion 24
targetSdkVersion 31
versionCode 7
versionName "1.7"
versionCode 8
versionName "1.8"
}
lintOptions {
abortOnError false
Expand All @@ -46,5 +46,5 @@ repositories {

dependencies {
implementation "com.facebook.react:react-native:+"
implementation "com.emarsys:emarsys-sdk:3.2.2"
implementation "com.emarsys:emarsys-sdk:3.2.5"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-emarsys-wrapper",
"version": "1.7.0",
"version": "1.8.0",
"description": "React Native wrapper for Emarsys SDK",
"main": "index.js",
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions sample/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,16 @@ dependencies {
implementation "com.facebook.react:react-native:+" // From node_modules

implementation "com.google.android.gms:play-services-base:18.0.1"

implementation "me.leolin:ShortcutBadger:1.1.21@aar"

implementation "androidx.appcompat:appcompat:1.4.1"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation "androidx.multidex:multidex:2.0.1"

implementation "com.emarsys:emarsys-sdk:3.2.2"
implementation "com.emarsys:emarsys-firebase:3.2.2"
implementation "com.emarsys:emarsys-sdk:3.2.5"
implementation "com.emarsys:emarsys-firebase:3.2.5"

// JSC from node_modules
if (useIntlJsc) {
implementation 'org.webkit:android-jsc-intl:+'
Expand Down
630 changes: 2 additions & 628 deletions sample/ios/EmarsysApp.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

This file was deleted.

20 changes: 1 addition & 19 deletions sample/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,15 @@ require_relative '../node_modules/@react-native-community/cli-platform-ios/nativ
platform :ios, '11.0'

target 'EmarsysApp' do


config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)

pod 'RNEmarsysWrapper', :podspec => '../node_modules/react-native-emarsys-wrapper/ios/RNEmarsysWrapper.podspec'

pod 'RNReanimated', :path => '../node_modules/react-native-reanimated'

target 'EmarsysAppTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
Expand All @@ -32,18 +24,8 @@ target 'EmarsysApp' do
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end

end

target 'EmarsysApp-tvOS' do
# Pods for EmarsysApp-tvOS
target 'EmarsysApp-tvOSTests' do
inherit! :search_paths
# Pods for testing
end

end

target "EmarsysAppNotificationService" do
pod 'EmarsysNotificationService'
end
end
2 changes: 1 addition & 1 deletion sample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
},
"devDependencies": {
"@babel/core": "^7.17.5",
"@babel/plugin-proposal-decorators": "^7.17.2",
"@babel/preset-env": "^7.18.2",
"@babel/preset-typescript": "^7.17.12",
"@babel/plugin-proposal-decorators": "^7.17.2",
"@babel/runtime": "^7.17.2",
"@react-native-community/eslint-config": "^3.0.1",
"babel-jest": "^28.1.1",
Expand Down

0 comments on commit d5f7d8e

Please sign in to comment.