Skip to content

Commit 6fb67c6

Browse files
Fix key capitalization to match conventions used across platforms
1 parent 2bf3a3e commit 6fb67c6

1 file changed

Lines changed: 11 additions & 29 deletions

File tree

src/main/kotlin/com/mparticle/kits/RoktKit.kt

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class RoktKit : KitIntegration(), CommerceListener, IdentityListener, RoktListen
200200
finalAttributes[MPID] = mpid
201201
} ?: Logger.warning("RoktKit: No user ID available for placement")
202202

203-
addIdentityAttributes(finalAttributes, filterUser)
203+
//addIdentityAttributes(finalAttributes, filterUser)
204204

205205

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

326-
val emailKey = MParticle.IdentityType.Email.name.lowercase()
327-
val otherKey = MParticle.IdentityType.Other.name.lowercase()
326+
val emailKey = "Email"
327+
val otherKey = "Other"
328328
val emailShaKey = "emailsha256"
329329

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

333333
when {
334334
!emailSha.isNullOrEmpty() -> {
335-
// If emailsha256 is already present, remove entries with email and other keys
336-
val iterator = attributes.entries.iterator()
337-
while (iterator.hasNext()) {
338-
val entry = iterator.next()
339-
if (entry.key.equals(emailKey, ignoreCase = true) ||
340-
entry.key.equals(otherKey, ignoreCase = true)) {
341-
iterator.remove()
342-
}
343-
}
335+
attributes.remove(emailKey)
336+
attributes.remove(otherKey)
344337
}
345338

346339
!otherValue.isNullOrEmpty() -> {
347-
// If "other" has a value, treat it as hashed email
348-
val iterator = attributes.entries.iterator()
349-
while (iterator.hasNext()) {
350-
val entry = iterator.next()
351-
if (entry.key.equals(emailKey, ignoreCase = true)) {
352-
iterator.remove()
353-
}
354-
}
340+
attributes.remove(emailKey)
355341
attributes[emailShaKey] = otherValue
356-
val iterator2 = attributes.entries.iterator()
357-
while (iterator2.hasNext()) {
358-
val entry = iterator2.next()
359-
if (entry.key.equals(otherKey, ignoreCase = true)) {
360-
iterator2.remove()
361-
}
362-
}
342+
attributes.remove(otherKey)
363343
}
344+
345+
// else do nothing
364346
}
365347
}
366348

0 commit comments

Comments
 (0)