From e0bbf4a1acaed38ea17e8191a143b503c85ca9f0 Mon Sep 17 00:00:00 2001 From: markvdouw Date: Thu, 2 Nov 2023 14:15:29 -0300 Subject: [PATCH] Fix for min api key --- .../com/mparticle/kits/ApptentiveKit.kt | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/main/kotlin/com/mparticle/kits/ApptentiveKit.kt b/src/main/kotlin/com/mparticle/kits/ApptentiveKit.kt index a375dcf..0e29039 100644 --- a/src/main/kotlin/com/mparticle/kits/ApptentiveKit.kt +++ b/src/main/kotlin/com/mparticle/kits/ApptentiveKit.kt @@ -245,20 +245,23 @@ class ApptentiveKit : KitIntegration(), KitIntegration.EventListener, IdentityLi } private fun setUserIdentity(user: MParticleUser?) { - user?.userIdentities?.entries?.forEach { - when (it.key) { - IdentityType.CustomerId -> { - if (KitUtils.isEmpty(Apptentive.getPersonName())) { - // Use id as customer name if no full name is set yet. - Logger.debug("Setting customer id as user name ${it.value}") - Apptentive.setPersonName(it.value) + user?.userIdentities?.entries?.let { + for(i in it.indices){ + val entry = it.elementAt(i) + when (entry.key) { + IdentityType.CustomerId -> { + if (KitUtils.isEmpty(Apptentive.getPersonName())) { + // Use id as customer name if no full name is set yet. + Logger.debug("Setting customer id as user name ${entry.value}") + Apptentive.setPersonName(entry.value) + } } + IdentityType.Email -> { + Logger.debug("Setting customer email ${entry.value}") + Apptentive.setPersonEmail(entry.value) + } + else -> Logger.debug("Other identity type") } - IdentityType.Email -> { - Logger.debug("Setting customer email ${it.value}") - Apptentive.setPersonEmail(it.value) - } - else -> Logger.debug("Other identity type") } } }