From ea94cb52551aef66fb115b9baa72e4118cb4b035 Mon Sep 17 00:00:00 2001 From: Sergio Morales Date: Thu, 16 Dec 2021 16:21:31 +0100 Subject: [PATCH 1/4] refactor build.gradle --- README.md | 2 +- android/build.gradle | 82 +++++++++++++-------------------------- android/gradle.properties | 2 + package.json | 6 +++ 4 files changed, 36 insertions(+), 56 deletions(-) create mode 100644 android/gradle.properties diff --git a/README.md b/README.md index cc232be..497ca11 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Linking the package manually is not required anymore with [Autolinking](https:// Include the library in your `android/app/build.gradle`: -`implementation 'com.kustomer.chat:ui:2.9.1'` +`implementation 'com.kustomer.chat:ui:2.9.+'` ### iOS diff --git a/android/build.gradle b/android/build.gradle index a159bc6..9df42f8 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,65 +1,41 @@ // 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_COMPILE_SDK_VERSION = 29 +def DEFAULT_BUILD_TOOLS_VERSION = '29.0.0' def DEFAULT_MIN_SDK_VERSION = 21 -def DEFAULT_TARGET_SDK_VERSION = 28 -def LIFECYLCE_VERSION = "2.3.1" +def DEFAULT_TARGET_SDK_VERSION = 29 +def DEFAULT_GRADLE_VERSION= "4.1.2" +def DEFAULT_KOTLIN_VERSION= "1.4.21" -def safeExtGet(prop, fallback) { - rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback -} - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'maven' +configurations.maybeCreate("default") buildscript { - ext.getExtOrDefault = {name -> - return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['ReactNativeKustomer_' + name] - } - // 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() - maven { - url 'https://kustomer.bintray.com/android' - } - } + ext.safeExtGet = {prop, fallback -> + rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback + } + + ext { + kotlinVersion = '1.4.21' + gradleVersion = '4.1.2' + buildToolsVersion = "29.0.0" + minSdkVersion = 21 + compileSdkVersion = 29 + targetSdkVersion = 29 + } - dependencies { - classpath 'com.android.tools.build:gradle:3.4.1' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.20" - } - } else { - repositories { - jcenter() - maven { - url 'https://kustomer.bintray.com/android' - } - } + repositories { + google() + mavenCentral() + } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50") - } + dependencies { + classpath "com.android.tools.build:gradle:4.1.2" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21" } } apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' apply plugin: 'maven' android { @@ -95,12 +71,8 @@ repositories { } dependencies { - //noinspection GradleDynamicVersion implementation 'com.facebook.react:react-native:+' // From node_modules - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.50" - implementation 'com.kustomer.chat:ui:2.9.2' - implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$LIFECYLCE_VERSION" - implementation "androidx.lifecycle:lifecycle-livedata-ktx:$LIFECYLCE_VERSION" + implementation 'com.kustomer.chat:ui:2.9.+' } def configureReactNativePom(def pom) { diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 0000000..08eeaf4 --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,2 @@ +DEFAULT_KOTLIN_VERSION=1.4.21 +DEFAULT_GRADLE_VERSION=4.1.2 \ No newline at end of file diff --git a/package.json b/package.json index 7c2c935..3d94eab 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,12 @@ "name": "Paula Pallarés Borràs", "email": "paulap@reby.co" }, + "contributors": [ + { + "name" : "sejoDjoseon", + "email" : "sergio@reby.co" + } + ], "license": "MIT", "licenseFilename": "LICENSE", "readmeFilename": "README.md", From 647400d576bfe95b737cd7d3c61ae918a5a61789 Mon Sep 17 00:00:00 2001 From: Sergio Morales Date: Thu, 16 Dec 2021 16:41:46 +0100 Subject: [PATCH 2/4] bump-version --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 29f36b6..65cef59 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-kustomer-sdk", - "version": "2.0.1", + "version": "2.0.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 3d94eab..41627b4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-native-kustomer-sdk", "title": "React Native Kustomer SDK", - "version": "2.0.1", + "version": "2.0.2", "description": "Kustomer SDK for React Native", "main": "index.js", "files": [ From 1861efb5d71fb8fe9d3887f1267b98a6d503182d Mon Sep 17 00:00:00 2001 From: Sergio Morales Date: Thu, 16 Dec 2021 16:46:04 +0100 Subject: [PATCH 3/4] remove useless docu --- README.md | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/README.md b/README.md index 497ca11..7b64703 100644 --- a/README.md +++ b/README.md @@ -54,34 +54,6 @@ public class MainApplication extends Application implements ReactApplication { } ``` -Add the following permissions to your `AndroidManifest.xml`: - -```xml - - - - - - - - - - - - - - - - - - - - - - - -``` - To customize Kustomer's theme, add a new style in `colors.xml` overwriting the values you want to replace, for example: ```xml From 242b672db59d757b4bc88084f05389964d373733 Mon Sep 17 00:00:00 2001 From: Sergio Morales Date: Thu, 16 Dec 2021 17:13:52 +0100 Subject: [PATCH 4/4] fix properties --- android/build.gradle | 11 ++--------- android/gradle.properties | 6 +++++- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 9df42f8..37f6dd7 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,12 +1,5 @@ // android/build.gradle -def DEFAULT_COMPILE_SDK_VERSION = 29 -def DEFAULT_BUILD_TOOLS_VERSION = '29.0.0' -def DEFAULT_MIN_SDK_VERSION = 21 -def DEFAULT_TARGET_SDK_VERSION = 29 -def DEFAULT_GRADLE_VERSION= "4.1.2" -def DEFAULT_KOTLIN_VERSION= "1.4.21" - configurations.maybeCreate("default") buildscript { @@ -29,8 +22,8 @@ buildscript { } dependencies { - classpath "com.android.tools.build:gradle:4.1.2" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21" + classpath "com.android.tools.build:gradle:${safeExtGet('gradleVersion', DEFAULT_GRADLE_VERSION)}" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion', DEFAULT_KOTLIN_VERSION)}" } } diff --git a/android/gradle.properties b/android/gradle.properties index 08eeaf4..a758319 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,2 +1,6 @@ DEFAULT_KOTLIN_VERSION=1.4.21 -DEFAULT_GRADLE_VERSION=4.1.2 \ No newline at end of file +DEFAULT_GRADLE_VERSION=4.1.2 +DEFAULT_COMPILE_SDK_VERSION=29 +DEFAULT_BUILD_TOOLS_VERSION =29.0.0 +DEFAULT_MIN_SDK_VERSION=21 +DEFAULT_TARGET_SDK_VERSION=29 \ No newline at end of file