-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Aliaksei Nestsiarovich
committed
Jun 8, 2020
0 parents
commit a5bdc83
Showing
81 changed files
with
10,985 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
.arcignore | ||
update-libs.sh | ||
update-version.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
The following authors have created the source code of "react-native-appmetrica" published and distributed by YANDEX LLC as the owner: | ||
|
||
Aliaksei Nestsiarovich <alex98@yandex-team.ru> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2020 YANDEX LLC | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# react-native-appmetrica | ||
React Native bridge to the [AppMetrica](https://appmetrica.yandex.com/) on both iOS and Android. | ||
|
||
## Installation | ||
|
||
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 | ||
|
||
```js | ||
import AppMetrica from 'react-native-appmetrica'; | ||
|
||
// Starts the statistics collection process. | ||
AppMetrica.activateWithConfig({ | ||
apiKey: '...KEY...', | ||
sessionTimeout: 120, | ||
firstActivationAsUpdate: true, | ||
}); | ||
|
||
// Sends a custom event message and additional parameters (optional). | ||
AppMetrica.reportEvent('My event'); | ||
AppMetrica.reportEvent('My event', { foo: 'bar' }); | ||
|
||
// Send a custom error event. | ||
AppMetrica.reportError('My error'); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
/* | ||
* Version for React Native | ||
* © 2020 YANDEX | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* https://yandex.com/legal/appmetrica_sdk_agreement/ | ||
*/ | ||
|
||
// android/build.gradle | ||
|
||
// based on: | ||
// | ||
// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle | ||
// original location: | ||
// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/build.gradle | ||
// | ||
// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/app/build.gradle | ||
// original location: | ||
// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle | ||
|
||
def DEFAULT_COMPILE_SDK_VERSION = 28 | ||
def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3' | ||
def DEFAULT_MIN_SDK_VERSION = 16 | ||
def DEFAULT_TARGET_SDK_VERSION = 28 | ||
|
||
def safeExtGet(prop, fallback) { | ||
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback | ||
} | ||
|
||
apply plugin: 'com.android.library' | ||
apply plugin: 'maven' | ||
|
||
buildscript { | ||
// The Android Gradle plugin is only required when opening the android folder stand-alone. | ||
// This avoids unnecessary downloads and potential conflicts when the library is included as a | ||
// module dependency in an application project. | ||
// ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies | ||
if (project == rootProject) { | ||
repositories { | ||
google() | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:3.4.1' | ||
} | ||
} | ||
} | ||
|
||
apply plugin: 'com.android.library' | ||
apply plugin: 'maven' | ||
|
||
android { | ||
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION) | ||
buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION) | ||
defaultConfig { | ||
minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION) | ||
targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION) | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
lintOptions { | ||
abortOnError false | ||
} | ||
} | ||
|
||
repositories { | ||
// ref: https://www.baeldung.com/maven-local-repository | ||
mavenLocal() | ||
maven { | ||
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm | ||
url "$rootDir/../node_modules/react-native/android" | ||
} | ||
maven { | ||
// Android JSC is installed from npm | ||
url "$rootDir/../node_modules/jsc-android/dist" | ||
} | ||
google() | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
//noinspection GradleDynamicVersion | ||
implementation 'com.facebook.react:react-native:+' // From node_modules | ||
implementation 'com.yandex.android:mobmetricalib:3.13.3' | ||
implementation 'com.android.installreferrer:installreferrer:1.1.2' | ||
} | ||
|
||
def configureReactNativePom(def pom) { | ||
def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text) | ||
|
||
pom.project { | ||
name packageJson.title | ||
artifactId packageJson.name | ||
version = packageJson.version | ||
group = "com.yandex.metrica.plugin.reactnative" | ||
description packageJson.description | ||
url packageJson.repository.baseUrl | ||
|
||
licenses { | ||
license { | ||
name packageJson.license | ||
url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename | ||
distribution 'repo' | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id packageJson.author.username | ||
name packageJson.author.name | ||
} | ||
} | ||
} | ||
} | ||
|
||
afterEvaluate { project -> | ||
// some Gradle build hooks ref: | ||
// https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html | ||
task androidJavadoc(type: Javadoc) { | ||
source = android.sourceSets.main.java.srcDirs | ||
classpath += files(android.bootClasspath) | ||
classpath += files(project.getConfigurations().getByName('compile').asList()) | ||
include '**/*.java' | ||
} | ||
|
||
task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) { | ||
classifier = 'javadoc' | ||
from androidJavadoc.destinationDir | ||
} | ||
|
||
task androidSourcesJar(type: Jar) { | ||
classifier = 'sources' | ||
from android.sourceSets.main.java.srcDirs | ||
include '**/*.java' | ||
} | ||
|
||
android.libraryVariants.all { variant -> | ||
def name = variant.name.capitalize() | ||
def javaCompileTask = variant.javaCompileProvider.get() | ||
|
||
task "jar${name}"(type: Jar, dependsOn: javaCompileTask) { | ||
from javaCompileTask.destinationDir | ||
} | ||
} | ||
|
||
artifacts { | ||
archives androidSourcesJar | ||
archives androidJavadocJar | ||
} | ||
|
||
task installArchives(type: Upload) { | ||
configuration = configurations.archives | ||
repositories.mavenDeployer { | ||
// Deploy to react-native-event-bridge/maven, ready to publish to npm | ||
repository url: "file://${projectDir}/../android/maven" | ||
configureReactNativePom pom | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!-- | ||
~ Version for React Native | ||
~ © 2020 YANDEX | ||
~ You may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ https://yandex.com/legal/appmetrica_sdk_agreement/ | ||
--> | ||
|
||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.yandex.metrica.plugin.reactnative"> | ||
|
||
</manifest> |
Oops, something went wrong.