diff --git a/android/build.gradle b/android/build.gradle index 5096db6..25d1950 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,163 +1,65 @@ -/* - * 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/ - */ +buildscript { + if (project == rootProject) { + repositories { + google() + mavenCentral() + jcenter() + } -// android/build.gradle + dependencies { + classpath 'com.android.tools.build:gradle:3.5.3' + } + } +} -// 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 +apply plugin: 'com.android.library' 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) + compileSdkVersion safeExtGet('AwesomeModule_compileSdkVersion', 29) defaultConfig { - minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION) - targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION) + minSdkVersion safeExtGet('AwesomeModule_minSdkVersion', 16) + targetSdkVersion safeExtGet('AwesomeModule_targetSdkVersion', 29) versionCode 1 versionName "1.0" + + } + + buildTypes { + release { + minifyEnabled false + } } lintOptions { - abortOnError false + disable 'GradleCompatible' + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } } 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" + url("$rootDir/../node_modules/react-native/android") } google() + mavenCentral() jcenter() } dependencies { //noinspection GradleDynamicVersion - implementation 'com.facebook.react:react-native:+' // From node_modules - implementation 'com.yandex.android:mobmetricalib:3.18.0' - implementation "com.yandex.android:mobmetricapushlib:1.10.0" + implementation "com.facebook.react:react-native:+" // From node_modules + implementation 'com.yandex.android:mobmetricalib:4.2.0' + implementation "com.yandex.android:mobmetricapushlib:2.1.1" implementation "com.android.support:support-compat:28.0.0" implementation 'com.android.installreferrer:installreferrer:1.1.2' - implementation "com.google.firebase:firebase-messaging:21.0.0" + implementation "com.google.firebase:firebase-messaging:22.0.0" implementation "com.google.android.gms:play-services-base:17.5.0" } - -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 - } - } -} diff --git a/android/src/main/java/com/yandex/metrica/plugin/reactnative/Utils.java b/android/src/main/java/com/yandex/metrica/plugin/reactnative/Utils.java index 93b5ad9..5dbd4a8 100644 --- a/android/src/main/java/com/yandex/metrica/plugin/reactnative/Utils.java +++ b/android/src/main/java/com/yandex/metrica/plugin/reactnative/Utils.java @@ -56,9 +56,9 @@ abstract class Utils { if (configMap.hasKey("firstActivationAsUpdate")) { builder.handleFirstActivationAsUpdate(configMap.getBoolean("firstActivationAsUpdate")); } - if (configMap.hasKey("installedAppCollecting")) { - builder.withInstalledAppCollecting(configMap.getBoolean("installedAppCollecting")); - } + // if (configMap.hasKey("installedAppCollecting")) { + // builder.withInstalledAppCollecting(configMap.getBoolean("installedAppCollecting")); + // } if (configMap.hasKey("location")) { builder.withLocation(toLocation(configMap.getMap("location"))); } diff --git a/package.json b/package.json index 9dc6b3c..c10171f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-native-appmetrica-next", "title": "Yandex AppMetrica React Native Plugin && AppMetricaPushSDK (fireBase CloudMessage)", - "version": "1.0.16", + "version": "1.0.18", "description": "React Native plugin for AppMetrica analytics tool", "main": "index.js", "scripts": { @@ -31,7 +31,7 @@ "license": "MIT", "homepage": "https://appmetrica.yandex.com/docs", "peerDependencies": { - "react-native": ">=0.59.0 <1.0.x" + "react-native": ">=0.65.0 <1.0.x" }, "devDependencies": {} } diff --git a/react-native-appmetrica-next.podspec b/react-native-appmetrica-next.podspec index f30aae5..b032895 100644 --- a/react-native-appmetrica-next.podspec +++ b/react-native-appmetrica-next.podspec @@ -16,6 +16,6 @@ Pod::Spec.new do |s| s.requires_arc = true s.dependency "React" - s.dependency 'YandexMobileMetrica', '4.0.0' + s.dependency 'YandexMobileMetrica', '4.2.0' s.dependency 'YandexMobileMetricaPush', '1.1.1' end