Skip to content
40 changes: 11 additions & 29 deletions src/main/kotlin/com/mparticle/kits/RoktKit.kt
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class RoktKit : KitIntegration(), CommerceListener, IdentityListener, RoktListen
finalAttributes[MPID] = mpid
} ?: Logger.warning("RoktKit: No user ID available for placement")

addIdentityAttributes(finalAttributes, filterUser)
//addIdentityAttributes(finalAttributes, filterUser)
Comment thread
Mansi-mParticle marked this conversation as resolved.
Outdated


val SANDBOX_MODE_ROKT: String = "sandbox"
Expand Down Expand Up @@ -323,44 +323,26 @@ class RoktKit : KitIntegration(), CommerceListener, IdentityListener, RoktListen
private fun verifyHashedEmail(attributes: MutableMap<String, String>?) {
if (attributes == null) return

val emailKey = MParticle.IdentityType.Email.name.lowercase()
val otherKey = MParticle.IdentityType.Other.name.lowercase()
val emailKey = "Email"
val otherKey = "Other"
Comment thread
Mansi-mParticle marked this conversation as resolved.
Outdated
val emailShaKey = "emailsha256"

val emailSha = attributes.entries.find { it.key.equals(emailShaKey, ignoreCase = true) }?.value
val otherValue = attributes.entries.find { it.key.equals(otherKey, ignoreCase = true) }?.value
val emailSha = attributes[emailShaKey]
val otherValue = attributes[otherKey]

when {
!emailSha.isNullOrEmpty() -> {
// If emailsha256 is already present, remove entries with email and other keys
val iterator = attributes.entries.iterator()
while (iterator.hasNext()) {
val entry = iterator.next()
if (entry.key.equals(emailKey, ignoreCase = true) ||
entry.key.equals(otherKey, ignoreCase = true)) {
iterator.remove()
}
}
attributes.remove(emailKey)
attributes.remove(otherKey)
}

!otherValue.isNullOrEmpty() -> {
Comment thread
Mansi-mParticle marked this conversation as resolved.
Outdated
// If "other" has a value, treat it as hashed email
val iterator = attributes.entries.iterator()
while (iterator.hasNext()) {
val entry = iterator.next()
if (entry.key.equals(emailKey, ignoreCase = true)) {
iterator.remove()
}
}
attributes.remove(emailKey)
attributes[emailShaKey] = otherValue
val iterator2 = attributes.entries.iterator()
while (iterator2.hasNext()) {
val entry = iterator2.next()
if (entry.key.equals(otherKey, ignoreCase = true)) {
iterator2.remove()
}
}
attributes.remove(otherKey)
}

// else do nothing
}
}

Expand Down
Loading