From b4ae36556d06a8869cba7d6d49acb1f3ef800f19 Mon Sep 17 00:00:00 2001 From: Juma Allan Date: Fri, 6 Dec 2024 14:37:54 +0300 Subject: [PATCH] Fix React Native Configuration (#80) * fix react native configuration * fix react native configuration * fixed kotlin version * Fix kotlin version setup * Fix kotlin version setup --- CHANGELOG.md | 3 +++ android/build.gradle | 18 ++++++++++++------ android/gradle.properties | 1 + example/android/app/build.gradle | 3 ++- example/android/app/src/main/assets/.gitignore | 3 +++ example/android/build.gradle | 4 +++- example/ios/Podfile.lock | 4 ++-- package.json | 2 +- 8 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 example/android/app/src/main/assets/.gitignore diff --git a/CHANGELOG.md b/CHANGELOG.md index bf85f4f4..dc6a19da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Release Notes +## 10.2.2 +* Fixed setting `kotlinVersion` and `kotlinCompilerExtensionVersion` + ## 10.2.1 * Allow skipApiSubmission which will capture Enrollment, Authentication, Doc V and Enhanced DocV without submitting to SmileID and will return captured images file paths * Bump android to 10.3.7 (https://github.com/smileidentity/android/releases/tag/v10.3.7) diff --git a/android/build.gradle b/android/build.gradle index dc9e8f03..b6a07566 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -3,7 +3,6 @@ import com.android.Version buildscript { // Buildscript is evaluated before everything else so we can't use getExtOrDefault def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["SmileId_kotlinVersion"] - def smile_id_sdk_version = rootProject.ext.has("androidVersion") ? rootProject.ext.get("androidVersion") : project.properties["SmileId_androidVersion"] repositories { google() @@ -14,7 +13,9 @@ buildscript { dependencies { classpath "com.android.tools.build:gradle:8.3.2" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "org.jetbrains.kotlin:compose-compiler-gradle-plugin:$kotlin_version" + if (kotlinVersion?.startsWith("2")) { + classpath "org.jetbrains.kotlin:compose-compiler-gradle-plugin:$kotlin_version" + } classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" classpath "org.jlleitschuh.gradle:ktlint-gradle:12.1.1" } @@ -25,12 +26,16 @@ def reactNativeArchitectures() { return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] } +def kotlinVersion = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["SmileId_kotlinVersion"] + apply plugin: "com.android.library" apply plugin: "kotlin-android" apply plugin: 'kotlin-kapt' apply plugin: "org.jlleitschuh.gradle.ktlint" apply plugin: "org.jetbrains.kotlin.plugin.serialization" -apply plugin: "org.jetbrains.kotlin.plugin.compose" +if (kotlinVersion?.startsWith("2")) { + apply plugin: "org.jetbrains.kotlin.plugin.compose" +} def getExtOrDefault(name) { return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["SmileId_" + name] @@ -71,6 +76,7 @@ android { targetSdkVersion getExtOrIntegerDefault("targetSdkVersion") } + buildTypes { release { minifyEnabled false @@ -91,7 +97,7 @@ android { } composeOptions { - kotlinCompilerExtensionVersion rootProject.ext.has("kotlinCompilerExtensionVersion") ? rootProject.ext.get("kotlinCompilerExtensionVersion") : '1.5.11' + kotlinCompilerExtensionVersion rootProject.ext.has("kotlinCompilerExtensionVersion") ? rootProject.ext.get("kotlinCompilerExtensionVersion") : project.properties["SmileId_kotlinCompilerExtensionVersion"] } compileOptions { @@ -112,8 +118,8 @@ repositories { gradlePluginPortal() } -def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : getExtOrDefault("kotlinVersion") -def smile_id_sdk_version = rootProject.ext.has("androidVersion") ? rootProject.ext.get("androidVersion") : getExtOrDefault("androidVersion") +def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["SmileId_kotlinVersion"] +def smile_id_sdk_version = project.properties["SmileId_androidVersion"] dependencies { implementation "com.facebook.react:react-native:0.72" diff --git a/android/gradle.properties b/android/gradle.properties index 25702463..60bccda2 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -4,3 +4,4 @@ SmileId_targetSdkVersion=34 SmileId_compileSdkVersion=34 SmileId_ndkversion=21.4.7075529 SmileId_androidVersion=10.3.7 +SmileId_kotlinCompilerExtensionVersion=1.5.11 diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 0a174a19..93e54760 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -2,6 +2,7 @@ apply plugin: "com.android.application" apply plugin: "com.facebook.react" apply plugin: "kotlin-android" apply plugin: "org.jlleitschuh.gradle.ktlint" +// only needed if we are using kotlin 2.0.0 or later apply plugin: "org.jetbrains.kotlin.plugin.compose" /** * This is the configuration block to customize your React Native Android app. @@ -114,7 +115,7 @@ android { dependencies { // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android") - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" implementation("androidx.compose.runtime:runtime:1.7.5") if (hermesEnabled.toBoolean()) { diff --git a/example/android/app/src/main/assets/.gitignore b/example/android/app/src/main/assets/.gitignore new file mode 100644 index 00000000..6c735647 --- /dev/null +++ b/example/android/app/src/main/assets/.gitignore @@ -0,0 +1,3 @@ +# This .gitignore file is not technically necessary, but it is retained here in order for the assets +# directory to be included in git, as it would otherwise be empty +smile_config.json diff --git a/example/android/build.gradle b/example/android/build.gradle index 5b497188..27df5fa5 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -7,20 +7,22 @@ buildscript { compileSdkVersion = 35 targetSdkVersion = 35 kotlinVersion = "2.0.0" - kotlin_version = "2.0.0" // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP. ndkVersion = "26.1.10909125" } + repositories { google() mavenCentral() gradlePluginPortal() } + dependencies { classpath "com.facebook.react:react-native-gradle-plugin" classpath 'com.android.tools.build:gradle:8.6.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" + // only needed if we are using kotlin 2.0.0 or later classpath "org.jetbrains.kotlin:compose-compiler-gradle-plugin:$kotlinVersion" classpath "org.jlleitschuh.gradle:ktlint-gradle:12.1.1" } diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 7716fa85..2bce1dcc 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -943,7 +943,7 @@ PODS: - React-debug - react-native-safe-area-context (4.14.0): - React-Core - - react-native-smile-id (10.2.1): + - react-native-smile-id (10.2.2): - DoubleConversion - glog - hermes-engine @@ -1444,7 +1444,7 @@ SPEC CHECKSUMS: React-logger: 29fa3e048f5f67fe396bc08af7606426d9bd7b5d React-Mapbuffer: bf56147c9775491e53122a94c423ac201417e326 react-native-safe-area-context: 4532f1a0c5d34a46b9324ccaaedcb5582a302b7d - react-native-smile-id: 532b565ae067ba715dfb06588ebd1d9aaa3eec30 + react-native-smile-id: 51ea0d04401552e49a59558ca6eb1b199cc3f16d React-nativeconfig: 9f223cd321823afdecf59ed00861ab2d69ee0fc1 React-NativeModulesApple: ff7efaff7098639db5631236cfd91d60abff04c0 React-perflogger: 32ed45d9cee02cf6639acae34251590dccd30994 diff --git a/package.json b/package.json index 6bcf6f63..e15adaed 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@smile_identity/react-native", - "version": "10.2.1", + "version": "10.2.2", "description": "Official wrapper for the Smile ID