init
This commit is contained in:
parent
b651948d45
commit
f606229340
30
README.md
30
README.md
@ -1,33 +1,39 @@
|
|||||||
# react-native-appmetrica
|
# react-native-appmetrica-next
|
||||||
|
|
||||||
React Native bridge to the [AppMetrica](https://appmetrica.yandex.com/) on both iOS and Android.
|
React Native bridge to the [AppMetrica](https://appmetrica.yandex.com/) on both iOS and Android.
|
||||||
|
react-native-push-next library functionality is expanded [react-native-appmetrica](https://github.com/yandexmobile/react-native-appmetrica)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. `npm install react-native-appmetrica --save`
|
`npm install react-native-appmetrica-next --save`
|
||||||
2. If React Native version <= 0.59: \
|
or
|
||||||
`react-native link react-native-appmetrica`
|
`yearn add react-native-appmetrica-next`
|
||||||
3. iOS only
|
|
||||||
* if `${PROJECT_DIR}/ios/Podfile` exists: \
|
1. If React Native version <= 0.59: \
|
||||||
|
`react-native link react-native-appmetrica-next`
|
||||||
|
2. iOS only
|
||||||
|
|
||||||
|
- if `${PROJECT_DIR}/ios/Podfile` exists: \
|
||||||
`npx pod-install`
|
`npx pod-install`
|
||||||
* if `${PROJECT_DIR}/ios/Podfile` don't exists: \
|
- 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`
|
[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 'react-native-appmetrica';
|
import AppMetrica from "react-native-appmetrica-next";
|
||||||
|
|
||||||
// Starts the statistics collection process.
|
// Starts the statistics collection process.
|
||||||
AppMetrica.activate({
|
AppMetrica.activate({
|
||||||
apiKey: '...KEY...',
|
apiKey: "...KEY...",
|
||||||
sessionTimeout: 120,
|
sessionTimeout: 120,
|
||||||
firstActivationAsUpdate: true,
|
firstActivationAsUpdate: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Sends a custom event message and additional parameters (optional).
|
// Sends a custom event message and additional parameters (optional).
|
||||||
AppMetrica.reportEvent('My event');
|
AppMetrica.reportEvent("My event");
|
||||||
AppMetrica.reportEvent('My event', { foo: 'bar' });
|
AppMetrica.reportEvent("My event", { foo: "bar" });
|
||||||
|
|
||||||
// Send a custom error event.
|
// Send a custom error event.
|
||||||
AppMetrica.reportError('My error');
|
AppMetrica.reportError("My error");
|
||||||
```
|
```
|
||||||
|
@ -81,7 +81,7 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
//noinspection GradleDynamicVersion
|
//noinspection GradleDynamicVersion
|
||||||
implementation 'com.facebook.react:react-native:+' // From node_modules
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
||||||
implementation 'com.yandex.android:mobmetricalib:3.13.3'
|
implementation 'com.yandex.android:mobmetricalib:3.18.0'
|
||||||
implementation 'com.android.installreferrer:installreferrer:1.1.2'
|
implementation 'com.android.installreferrer:installreferrer:1.1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,13 +11,13 @@ import {StyleSheet, Text, View, ScrollView, SafeAreaView} from 'react-native';
|
|||||||
|
|
||||||
import AppMetrica from 'react-native-appmetrica';
|
import AppMetrica from 'react-native-appmetrica';
|
||||||
|
|
||||||
function getRactNativeVersion() {
|
function getReactNativeVersion() {
|
||||||
const reactNativePackage = require('./node_modules/react-native/package.json');
|
const reactNativePackage = require('./node_modules/react-native/package.json');
|
||||||
return reactNativePackage.version;
|
return reactNativePackage.version;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isReactNativeVersion(major, minor = 0, path = 0) {
|
function isReactNativeVersion(major, minor = 0, path = 0) {
|
||||||
const {curMajor, curMinor, curPath} = getRactNativeVersion()
|
const {curMajor, curMinor, curPath} = getReactNativeVersion()
|
||||||
.split('.')
|
.split('.')
|
||||||
.map(it => +it);
|
.map(it => +it);
|
||||||
if (curMajor === major) {
|
if (curMajor === major) {
|
||||||
@ -61,7 +61,7 @@ export default class App extends Component<Props> {
|
|||||||
<View style={styles.sectionContainer}>
|
<View style={styles.sectionContainer}>
|
||||||
<Text style={styles.sectionTitle}>React Native Version</Text>
|
<Text style={styles.sectionTitle}>React Native Version</Text>
|
||||||
<Text style={styles.sectionDescription}>
|
<Text style={styles.sectionDescription}>
|
||||||
{getRactNativeVersion()}
|
{getReactNativeVersion()}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.sectionContainer}>
|
<View style={styles.sectionContainer}>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "AppMetricaReactNativeSample",
|
"name": "AppMetricaReactNativeSample",
|
||||||
"version": "0.0.1",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"android": "react-native run-android",
|
"android": "react-native run-android",
|
||||||
@ -12,17 +12,19 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react": "16.9.0",
|
"react": "16.9.0",
|
||||||
"react-native": "0.61.5",
|
"react-native": "0.61.5",
|
||||||
"react-native-appmetrica": "file:../appmetrica-plugin"
|
"react-native-appmetrica-next": "file:../"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.6.2",
|
"@babel/core": "^7.11.1",
|
||||||
"@babel/runtime": "^7.6.2",
|
"@babel/runtime": "^7.11.2",
|
||||||
"@react-native-community/eslint-config": "^0.0.5",
|
"@react-native-community/eslint-config": "^2.0.0",
|
||||||
"babel-jest": "^24.9.0",
|
"babel-jest": "^26.3.0",
|
||||||
"eslint": "^6.5.1",
|
"eslint": "^7.7.0",
|
||||||
"jest": "^24.9.0",
|
"jest": "^26.4.0",
|
||||||
"metro-react-native-babel-preset": "^0.56.0",
|
"metro-react-native-babel-preset": "^0.62.0",
|
||||||
"react-test-renderer": "16.9.0"
|
"prettier": "2.1.1",
|
||||||
|
"eslint-plugin-prettier": "3.1.4",
|
||||||
|
"react-test-renderer": "16.13.1"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"preset": "react-native"
|
"preset": "react-native"
|
||||||
|
6449
example/yarn.lock
6449
example/yarn.lock
File diff suppressed because it is too large
Load Diff
@ -30,6 +30,5 @@
|
|||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react-native": ">=0.59.0 <1.0.x"
|
"react-native": ">=0.59.0 <1.0.x"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -3,18 +3,18 @@ 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|
|
Pod::Spec.new do |s|
|
||||||
s.name = "react-native-appmetrica"
|
s.name = "react-native-appmetrica-next-next"
|
||||||
s.version = package["version"]
|
s.version = package["version"]
|
||||||
s.summary = package["description"]
|
s.summary = package["description"]
|
||||||
s.homepage = package["homepage"]
|
s.homepage = package["homepage"]
|
||||||
s.license = package["license"]
|
s.license = package["license"]
|
||||||
s.authors = { "Yandex LLC" => "appmetrica@yandex-team.com" }
|
s.authors = { "Yandex LLC" => "appmetrica@yandex-team.com" }
|
||||||
s.platforms = { :ios => "9.0" }
|
s.platforms = { :ios => "9.0" }
|
||||||
s.source = { :git => "https://github.com/yandexmobile/react-native-appmetrica.git", :tag => "#{s.version}" }
|
s.source = { :git => "https://github.com/yandexmobile/react-native-appmetrica-next.git", :tag => "#{s.version}" }
|
||||||
|
|
||||||
s.source_files = "ios/**/*.{h,m,swift}"
|
s.source_files = "ios/**/*.{h,m,swift}"
|
||||||
s.requires_arc = true
|
s.requires_arc = true
|
||||||
|
|
||||||
s.dependency "React"
|
s.dependency "React"
|
||||||
s.dependency 'YandexMobileMetrica', '3.9.4'
|
s.dependency 'YandexMobileMetrica', '3.12.0'
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user