diff --git a/build.gradle b/build.gradle index 4264768..782a0ab 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ buildscript { ext.kotlin_version = '2.0.20' - if (!project.hasProperty('version') || project.version.equals('unspecified')) { + if (!project.hasProperty('version') || project.version == 'unspecified') { project.version = '+' } @@ -11,8 +11,8 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:8.1.4' - classpath 'com.mparticle:android-kit-plugin:' + project.version + classpath "com.android.tools.build:gradle:8.4.2" + classpath "com.mparticle:android-kit-plugin:${project.version}" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -36,6 +36,7 @@ apply plugin: 'com.mparticle.kit' android { namespace 'com.mparticle.kits.apptentive' + compileSdk 35 buildFeatures { buildConfig = true } @@ -64,6 +65,6 @@ allprojects { } dependencies { - api 'com.apptentive:apptentive-kit-android:6.9.1' + api 'com.apptentive:apptentive-kit-android:7.0.0' testImplementation 'io.mockk:mockk:1.13.3' } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e1bef7e..510e4ef 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/com/mparticle/kits/ApptentiveKit.kt b/src/main/kotlin/com/mparticle/kits/ApptentiveKit.kt index e367628..7065b9e 100644 --- a/src/main/kotlin/com/mparticle/kits/ApptentiveKit.kt +++ b/src/main/kotlin/com/mparticle/kits/ApptentiveKit.kt @@ -4,6 +4,7 @@ import android.app.Application import android.content.Context import apptentive.com.android.feedback.Apptentive import apptentive.com.android.feedback.ApptentiveConfiguration +import apptentive.com.android.feedback.ApptentiveRegion import apptentive.com.android.feedback.RegisterResult import apptentive.com.android.util.InternalUseOnly import apptentive.com.android.util.LogLevel @@ -60,6 +61,24 @@ class ApptentiveKit : RATING_INTERACTION_THROTTLE_LENGTH, TimeUnit.DAYS.toMillis(7), ) + val attributes = MParticle.getInstance()?.getIntegrationAttributes(MParticle.ServiceProviders.APPTENTIVE) + Logger.debug("Setting Apptentive region from attributes: ${attributes?.get("region") ?: "us"}") + configuration.region = + when (attributes?.get("region") ?: "us") { + "us" -> ApptentiveRegion.US + "eu" -> ApptentiveRegion.EU + "cn" -> ApptentiveRegion.CN + "au" -> ApptentiveRegion.AU + "custom" -> { + val region = attributes?.get("region") + if (region != null) { + ApptentiveRegion.Custom(region) + } else { + ApptentiveRegion.US + } + } + else -> ApptentiveRegion.US + } Apptentive.register( context.applicationContext as Application, configuration,