Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
nporter-adbe committed Mar 5, 2019
0 parents commit e5c3519
Show file tree
Hide file tree
Showing 44 changed files with 16,614 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": ["flow", "react-native"],
"plugins": [
["module-resolver", {
"root": [ "./js/" ]
}]
]
}
70 changes: 70 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
[ignore]
; We fork some components by platform
.*/*[.]android.js

; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/

; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*

; Ignore templates for 'react-native init'
<PROJECT_ROOT>/node_modules/react-native/local-cli/.*

; Ignore polyfills
<PROJECT_ROOT>/node_modules/react-native/Libraries/polyfills/.*

; Ignore various node_modules
<PROJECT_ROOT>/node_modules/metro/.*

; Ignore RN jest
<PROJECT_ROOT>/node_modules/react-native/.*

; Ignore Example
<PROJECT_ROOT>/sample/*


[include]
<PROJECT_ROOT>/node_modules/react-native/Libraries/StyleSheet/StyleSheetTypes

[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow
flow-typed/

[options]
module.system=haste

emoji=true

munge_underscores=true

module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'

module.system.node.resolve_dirname=node_modules
module.system.node.resolve_dirname=./src/

module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.file_ext=.native.js

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-9]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-9]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

esproposal.decorators=ignore

module.name_mapper.extension='png' -> 'emptyObject'
module.name_mapper='^react-navigation$' -> 'emptyObject'

; https://github.com/facebook/react-native/issues/14927
module.name_mapper='^./link/link$' -> 'emptyObject'

[version]
0.92.0
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pbxproj -text
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

# OSX
#
.DS_Store

# node.js
#
node_modules/
npm-debug.log
yarn-error.log


# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace


# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml

# BUCK
buck-out/
\.buckd/
*.keystore

2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sample/
.github/
109 changes: 109 additions & 0 deletions LICENSE.md

Large diffs are not rendered by default.

119 changes: 119 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@

# bourbon-platform-react-native-analytics

https://wiki.corp.adobe.com/display/adms/React+Native


## Setup

`npm install`

#### Andriod

Open `android/build.gradle` in Android studio

#### iOS:

Open `ios/RCTACPAnalytics.xcodeproj`

Note: This the Xcode project does not include all dependencies to build. If you want to build the project you should run `pod install` then open the workspace.


## 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.

### 1. Create React Native project

First create a React Native project:

```bash
react-native init MyReactApp
```

### 2. Install JavaScript packages

Install and link the `react-native-acpanalytics` package:

```bash
npm install react-native-acpanalytics
react-native link react-native-acpanalytics
```

### 3. Configure native projects

#### 3.1 Android project

Navigate to `MainApplication.java` under `app/src/main/java/com/<project name>/` and add a call to `RCTACPCoreModule.setApplication()` inside of `onCreate()`.

```java
import com.adobe.marketing.mobile.reactnative.RCTACPCorePackage; // import the package

@Override
public void onCreate() {
super.onCreate();
//...
RCTACPCoreModule.setApplication(this); // add this line
}
```

## Usage

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

##### Getting the extension version:

```javascript
ACPAnalytics.extensionVersion().then(version => console.log("AMSDK: ACPAnalytics version: " + version));
```

##### Registering the extension with Core:

```javascript
ACPAnalytics.registerExtension();
```

##### Get the tracking identifier

```javascript
ACPAnalytics.getTrackingIdentifier().then(identifier => console.log("AMSDK: Tracking identifier: " + identifier));
```
##### Send queued hits

```javascript
ACPAnalytics.sendQueuedHits();
```

##### Get the queue size

```javascript
ACPAnalytics.getQueueSize().then(size => console.log("AMSDK: Queue size: " + size));
```

##### Set the custom visitor identifier

```javascript
ACPAnalytics.setVisitorIdentifier("yourVisitorId");
```

##### Get the custom visitor identifier

```javascript
ACPAnalytics.getVisitorIdentifier().then(vid => console.log("AMSDK: Visitor identifier: " + vid));
```

##### Track app actions

```javascript
ACPCore.trackAction(TODO);
```

##### Track app states

```javascript
ACPCore.trackState(TODO);
```

## License

See LICENSE.md
38 changes: 38 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
buildscript {
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 28
// buildToolsVersion "23.0.1"

defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
}

repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
implementation "com.facebook.react:react-native:+"
implementation 'com.adobe.marketing.mobile:analytics:1.+'
}
Binary file added android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Tue Jan 29 15:04:54 MST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
Loading

0 comments on commit e5c3519

Please sign in to comment.