diff --git a/build.gradle b/build.gradle
index 14d0602..4671c39 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,16 +1,17 @@
buildscript {
- ext.kotlin_version = '1.8.10'
+ ext.kotlin_version = '2.0.20'
if (!project.hasProperty('version') || project.version.equals('unspecified')) {
project.version = '+'
}
repositories {
+ google()
mavenLocal()
mavenCentral()
- google()
}
+
dependencies {
- classpath 'com.android.tools.build:gradle:7.4.1'
+ classpath 'com.android.tools.build:gradle:8.1.4'
classpath 'com.mparticle:android-kit-plugin:' + project.version
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
@@ -18,7 +19,7 @@ buildscript {
plugins {
id "org.sonarqube" version "3.5.0.2730"
- id "org.jlleitschuh.gradle.ktlint" version "11.2.0"
+ id "org.jlleitschuh.gradle.ktlint" version "13.0.0"
}
sonarqube {
@@ -30,13 +31,29 @@ sonarqube {
}
apply plugin: 'org.jlleitschuh.gradle.ktlint'
-apply plugin: 'com.mparticle.kit'
apply plugin: 'kotlin-android'
+apply plugin: 'com.mparticle.kit'
android {
+ namespace 'com.mparticle.kits.responsys'
+ buildFeatures {
+ buildConfig = true
+ }
defaultConfig {
minSdkVersion 16
}
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_17
+ targetCompatibility JavaVersion.VERSION_17
+ }
+ kotlinOptions {
+ jvmTarget = '17'
+ }
+ testOptions {
+ unitTests.all {
+ jvmArgs += ['--add-opens', 'java.base/java.lang=ALL-UNNAMED']
+ }
+ }
}
dependencies {
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index ae04661..e1bef7e 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-7.5.1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index 388712d..c4e6c98 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -1 +1 @@
-
+
diff --git a/src/main/kotlin/com/mparticle/kits/ResponsysKit.kt b/src/main/kotlin/com/mparticle/kits/ResponsysKit.kt
index 2bbbca1..b10d527 100644
--- a/src/main/kotlin/com/mparticle/kits/ResponsysKit.kt
+++ b/src/main/kotlin/com/mparticle/kits/ResponsysKit.kt
@@ -8,24 +8,34 @@ import com.mparticle.MParticle.IdentityType
import com.mparticle.commerce.CommerceEvent
import com.mparticle.commerce.Product
import com.mparticle.identity.MParticleUser
-import com.mparticle.kits.KitIntegration.*
+import com.mparticle.kits.FilteredIdentityApiRequest
+import com.mparticle.kits.KitIntegration.CommerceListener
+import com.mparticle.kits.KitIntegration.EventListener
+import com.mparticle.kits.KitIntegration.IdentityListener
+import com.mparticle.kits.KitIntegration.PushListener
+import com.mparticle.kits.ReportingMessage
import com.pushio.manager.PIOLogger
import com.pushio.manager.PushIOBroadcastReceiver
import com.pushio.manager.PushIOManager
import com.pushio.manager.exception.ValidationException
import com.pushio.manager.preferences.PushIOPreference
import java.math.BigDecimal
+import java.util.ArrayList
+import java.util.HashMap
-class ResponsysKit : KitIntegration(), PushListener, KitIntegration.EventListener, CommerceListener,
+class ResponsysKit :
+ KitIntegration(),
+ PushListener,
+ KitIntegration.EventListener,
+ CommerceListener,
IdentityListener {
-
private var mPushIOManager: PushIOManager? = null
override fun getInstance(): PushIOManager? = mPushIOManager
override fun onKitCreate(
settings: Map,
- context: Context
+ context: Context,
): List {
PIOLogger.d("Responsys Kit detected")
PIOLogger.v("RK oKC")
@@ -63,7 +73,7 @@ class ResponsysKit : KitIntegration(), PushListener, KitIntegration.EventListene
bigDecimal: BigDecimal,
bigDecimal1: BigDecimal,
s: String,
- map: Map
+ map: Map,
): List = emptyList()
override fun logEvent(commerceEvent: CommerceEvent): List? {
@@ -94,7 +104,8 @@ class ResponsysKit : KitIntegration(), PushListener, KitIntegration.EventListene
if (productAction.equals(Product.PURCHASE, true)) {
mPushIOManager?.trackEngagement(
PushIOManager.PUSHIO_ENGAGEMENT_METRIC_PURCHASE,
- customProperties, null
+ customProperties,
+ null,
)
}
}
@@ -108,12 +119,15 @@ class ResponsysKit : KitIntegration(), PushListener, KitIntegration.EventListene
override fun leaveBreadcrumb(s: String): List = emptyList()
- override fun logError(s: String, map: Map): List = emptyList()
+ override fun logError(
+ s: String,
+ map: Map,
+ ): List = emptyList()
override fun logException(
e: Exception,
map: Map,
- s: String
+ s: String,
): List = emptyList()
override fun logEvent(mpEvent: MPEvent): List? {
@@ -135,7 +149,7 @@ class ResponsysKit : KitIntegration(), PushListener, KitIntegration.EventListene
it.declarePreference(
key,
key,
- PushIOPreference.Type.STRING
+ PushIOPreference.Type.STRING,
)
it.setPreference(key, value)
} catch (e: ValidationException) {
@@ -154,21 +168,29 @@ class ResponsysKit : KitIntegration(), PushListener, KitIntegration.EventListene
return if (reportingMessages.isEmpty()) null else reportingMessages
}
- override fun logScreen(s: String, map: Map): List =
- emptyList()
+ override fun logScreen(
+ s: String,
+ map: Map,
+ ): List = emptyList()
override fun willHandlePushMessage(intent: Intent): Boolean {
PIOLogger.v("RK wHPM")
return isResponsysPush(intent)
}
- override fun onPushMessageReceived(context: Context, intent: Intent) {
+ override fun onPushMessageReceived(
+ context: Context,
+ intent: Intent,
+ ) {
PIOLogger.v("RK oPMR")
val newIntent = Intent(intent)
PushIOBroadcastReceiver().onReceive(getContext(), newIntent)
}
- override fun onPushRegistration(instanceId: String, senderId: String): Boolean {
+ override fun onPushRegistration(
+ instanceId: String,
+ senderId: String,
+ ): Boolean {
PIOLogger.v("RK oPR Instance ID: $instanceId, Sender ID: $senderId")
mPushIOManager?.let {
it.setDeviceToken(instanceId)
@@ -179,13 +201,13 @@ class ResponsysKit : KitIntegration(), PushListener, KitIntegration.EventListene
override fun onIdentifyCompleted(
mParticleUser: MParticleUser,
- filteredIdentityApiRequest: FilteredIdentityApiRequest
+ filteredIdentityApiRequest: FilteredIdentityApiRequest,
) {
}
override fun onLoginCompleted(
mParticleUser: MParticleUser,
- filteredIdentityApiRequest: FilteredIdentityApiRequest
+ filteredIdentityApiRequest: FilteredIdentityApiRequest,
) {
PIOLogger.v("RK oLiC")
registerUserId(mParticleUser)
@@ -193,7 +215,7 @@ class ResponsysKit : KitIntegration(), PushListener, KitIntegration.EventListene
override fun onLogoutCompleted(
mParticleUser: MParticleUser,
- filteredIdentityApiRequest: FilteredIdentityApiRequest
+ filteredIdentityApiRequest: FilteredIdentityApiRequest,
) {
PIOLogger.v("RK oLoC")
mPushIOManager?.unregisterUserId()
@@ -201,7 +223,7 @@ class ResponsysKit : KitIntegration(), PushListener, KitIntegration.EventListene
override fun onModifyCompleted(
mParticleUser: MParticleUser,
- filteredIdentityApiRequest: FilteredIdentityApiRequest
+ filteredIdentityApiRequest: FilteredIdentityApiRequest,
) {
}
@@ -224,10 +246,10 @@ class ResponsysKit : KitIntegration(), PushListener, KitIntegration.EventListene
return userId
}
- private fun isResponsysPush(intent: Intent?): Boolean {
- return intent != null && intent.hasExtra("ei") &&
- !KitUtils.isEmpty(intent.getStringExtra("ei"))
- }
+ private fun isResponsysPush(intent: Intent?): Boolean =
+ intent != null &&
+ intent.hasExtra("ei") &&
+ !KitUtils.isEmpty(intent.getStringExtra("ei"))
private fun processCustomFlags(mpEvent: MPEvent): MutableList {
val reportingMessages: MutableList = ArrayList()
@@ -248,7 +270,7 @@ class ResponsysKit : KitIntegration(), PushListener, KitIntegration.EventListene
PIOLogger.e("Invalid engagement type")
PIOLogger.e(
"Supported engagement types can be accessed from PushIOManager and are of type: " +
- "PushIOManager.PUSHIO_ENGAGEMENT_METRIC_***"
+ "PushIOManager.PUSHIO_ENGAGEMENT_METRIC_***",
)
}
}
@@ -262,4 +284,4 @@ class ResponsysKit : KitIntegration(), PushListener, KitIntegration.EventListene
const val CUSTOM_FLAG_ENGAGEMENT = "Responsys.Custom.e"
const val KIT_NAME = "Responsys"
}
-}
\ No newline at end of file
+}
diff --git a/src/test/kotlin/com/mparticle/kits/ResponsysKitTest.kt b/src/test/kotlin/com/mparticle/kits/KitTests.kt
similarity index 89%
rename from src/test/kotlin/com/mparticle/kits/ResponsysKitTest.kt
rename to src/test/kotlin/com/mparticle/kits/KitTests.kt
index fe1826f..31be187 100644
--- a/src/test/kotlin/com/mparticle/kits/ResponsysKitTest.kt
+++ b/src/test/kotlin/com/mparticle/kits/KitTests.kt
@@ -2,9 +2,12 @@ package com.mparticle.kits
import android.content.Context
import com.mparticle.MParticleOptions
+import com.mparticle.kits.KitIntegration
+import com.mparticle.kits.KitIntegrationFactory
import org.junit.Assert
import org.junit.Test
import org.mockito.Mockito
+import java.util.HashMap
class KitTests {
private val kit: KitIntegration
@@ -27,7 +30,7 @@ class KitTests {
var e: Exception? = null
try {
val kit = kit
- val settings= HashMap()
+ val settings = HashMap()
settings["fake setting"] = "fake"
kit.onKitCreate(settings, Mockito.mock(Context::class.java))
} catch (ex: Exception) {
@@ -50,4 +53,4 @@ class KitTests {
}
Assert.fail("$className not found as a known integration.")
}
-}
\ No newline at end of file
+}