Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android kotlin version and min SDK fixes #71

Merged
merged 6 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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["KlaviyoReactNativeSdk_kotlinVersion"]
def kotlinVersion = kotlin_version

repositories {
google()
Expand Down Expand Up @@ -108,7 +109,7 @@ dependencies {
// For < 0.71, this will be from the local maven repo
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-android:0.73.1"
implementation "com.facebook.react:react-native:+"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixed the issue with test apps on <=0.70

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It causes kotlin files to appear broken while editing, unfortunately, because facebook/react imports appear broken. don't know how to fix that yet, but it compiles from the example app.

implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
api "com.github.klaviyo.klaviyo-android-sdk:analytics:2.0.0"
api "com.github.klaviyo.klaviyo-android-sdk:push-fcm:2.0.0"
Expand Down
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryErro
# org.gradle.parallel=true
#Tue Dec 19 15:08:27 EST 2023
KlaviyoReactNativeSdk_compileSdkVersion=31
KlaviyoReactNativeSdk_kotlinVersion=1.7.0
KlaviyoReactNativeSdk_kotlinVersion=1.8.0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.8 is compatible with 1.9.22 so we can stop here for now

KlaviyoReactNativeSdk_minSdkVersion=23
KlaviyoReactNativeSdk_ndkversion=21.4.7075529
KlaviyoReactNativeSdk_targetSdkVersion=31
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class KlaviyoReactNativeSdkModule internal constructor(private val context: Reac
override fun setProfile(profile: ReadableMap) {
val parsedProfile = Profile()

profile.toHashMap().forEach { (key, value) ->
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This triggers a warning about min SDK version of 24.

profile.toHashMap().iterator().forEach { (key, value) ->
when (key) {
LOCATION, PROPERTIES ->
(value as? HashMap<*, *>)?.forEach { (key, value) ->
Expand Down
Loading