Compare commits

..

No commits in common. "master" and "2.0.0" have entirely different histories.

3 changed files with 73 additions and 47 deletions

View File

@ -3,18 +3,25 @@ React Native bridge to the [AppMetrica](https://appmetrica.yandex.com/) on both
## Installation ## Installation
1. `npm install @jil/react-native-appmetrica --save` 1. `npm install react-native-appmetrica --save`
2. If React Native version <= 0.59: \
`react-native link react-native-appmetrica`
3. iOS only
* if `${PROJECT_DIR}/ios/Podfile` exists: \
`npx pod-install`
* if `${PROJECT_DIR}/ios/Podfile` don't exists: \
[Setup AppMetrica](https://appmetrica.yandex.com/docs/mobile-sdk-dg/tasks/ios-quickstart.html) and placed frameworks at `${PROJECT_DIR}/ios/Frameworks`
## Usage ## Usage
```js ```js
import AppMetrica from '@ijl/react-native-appmetrica'; import AppMetrica from 'react-native-appmetrica';
// Starts the statistics collection process. // Starts the statistics collection process.
AppMetrica.activate({ AppMetrica.activateWithConfig({
apiKey: '...KEY...', apiKey: '...KEY...',
sessionTimeout: 120, sessionTimeout: 120,
firstActivationAsUpdate: false, firstActivationAsUpdate: true,
}); });
// Sends a custom event message and additional parameters (optional). // Sends a custom event message and additional parameters (optional).

View File

@ -28,7 +28,7 @@ def safeExtGet(prop, fallback) {
} }
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
apply plugin: 'maven-publish' apply plugin: 'maven'
buildscript { buildscript {
// The Android Gradle plugin is only required when opening the android folder stand-alone. // The Android Gradle plugin is only required when opening the android folder stand-alone.
@ -47,7 +47,7 @@ buildscript {
} }
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
apply plugin: 'maven-publish' apply plugin: 'maven'
android { android {
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION) compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
@ -113,47 +113,47 @@ def configureReactNativePom(def pom) {
} }
} }
// afterEvaluate { project -> afterEvaluate { project ->
// // some Gradle build hooks ref: // some Gradle build hooks ref:
// // https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html // https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
// task androidJavadoc(type: Javadoc) { task androidJavadoc(type: Javadoc) {
// source = android.sourceSets.main.java.srcDirs source = android.sourceSets.main.java.srcDirs
// classpath += files(android.bootClasspath) classpath += files(android.bootClasspath)
// classpath += files(project.getConfigurations().getByName('compile').asList()) classpath += files(project.getConfigurations().getByName('compile').asList())
// include '**/*.java' include '**/*.java'
// } }
// task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) { task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
// classifier = 'javadoc' classifier = 'javadoc'
// from androidJavadoc.destinationDir from androidJavadoc.destinationDir
// } }
// task androidSourcesJar(type: Jar) { task androidSourcesJar(type: Jar) {
// classifier = 'sources' classifier = 'sources'
// from android.sourceSets.main.java.srcDirs from android.sourceSets.main.java.srcDirs
// include '**/*.java' include '**/*.java'
// } }
// android.libraryVariants.all { variant -> android.libraryVariants.all { variant ->
// def name = variant.name.capitalize() def name = variant.name.capitalize()
// def javaCompileTask = variant.javaCompileProvider.get() def javaCompileTask = variant.javaCompileProvider.get()
// task "jar${name}"(type: Jar, dependsOn: javaCompileTask) { task "jar${name}"(type: Jar, dependsOn: javaCompileTask) {
// from javaCompileTask.destinationDir from javaCompileTask.destinationDir
// } }
// } }
// artifacts { artifacts {
// archives androidSourcesJar archives androidSourcesJar
// archives androidJavadocJar archives androidJavadocJar
// } }
// task installArchives(type: Upload) { task installArchives(type: Upload) {
// configuration = configurations.archives configuration = configurations.archives
// repositories.mavenDeployer { repositories.mavenDeployer {
// // Deploy to react-native-event-bridge/maven, ready to publish to npm // Deploy to react-native-event-bridge/maven, ready to publish to npm
// repository url: "file://${projectDir}/../android/maven" repository url: "file://${projectDir}/../android/maven"
// configureReactNativePom pom configureReactNativePom pom
// } }
// } }
// } }

View File

@ -1,16 +1,35 @@
{ {
"name": "@ijl/react-native-appmetrica", "name": "react-native-appmetrica",
"title": "Yandex AppMetrica React Native Plugin", "title": "Yandex AppMetrica React Native Plugin",
"version": "2.0.2", "version": "2.0.0",
"description": "React Native plugin for AppMetrica analytics tool", "description": "React Native plugin for AppMetrica analytics tool",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"repository": {
"type": "git",
"url": "git+https://github.com/yandexmobile/react-native-appmetrica.git"
},
"keywords": [
"yandex",
"appmetrica",
"metrica",
"analytics",
"tracking",
"react-native",
"ecosystem:react-native",
"react-native-ios",
"react-native-android"
],
"author": {
"name": "YANDEX LLC"
},
"license": "MIT", "license": "MIT",
"homepage": "https://appmetrica.yandex.com/docs", "homepage": "https://appmetrica.yandex.com/docs",
"peerDependencies": { "peerDependencies": {
"react-native": ">=0.59.0 <1.0.x" "react-native": ">=0.59.0 <1.0.x"
}, },
"devDependencies": {} "devDependencies": {
}
} }