Skip to content

Commit 5db8833

Browse files
Address review comments
1 parent 16143c1 commit 5db8833

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,11 @@ class RoktKit : KitIntegration(), CommerceListener, IdentityListener, RoktListen
327327
val otherKey = MParticle.IdentityType.Other.name.lowercase()
328328
val emailShaKey = "emailsha256"
329329

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

333333
when {
334-
!emailSha.isNullOrEmpty() -> {
334+
!emailShaValue.isNullOrEmpty() -> {
335335
// If emailsha256 is already present, remove entries with email and other keys
336336
val iterator = attributes.entries.iterator()
337337
while (iterator.hasNext()) {
@@ -344,26 +344,19 @@ class RoktKit : KitIntegration(), CommerceListener, IdentityListener, RoktListen
344344
}
345345

346346
!otherValue.isNullOrEmpty() -> {
347-
// If "other" has a value, treat it as hashed email
348347
val iterator = attributes.entries.iterator()
349348
while (iterator.hasNext()) {
350349
val entry = iterator.next()
351350
if (entry.key.equals(emailKey, ignoreCase = true)) {
352351
iterator.remove()
353352
}
354-
}
355-
attributes[emailShaKey] = otherValue
356-
val iterator2 = attributes.entries.iterator()
357-
while (iterator2.hasNext()) {
358-
val entry = iterator2.next()
359353
if (entry.key.equals(otherKey, ignoreCase = true)) {
360-
iterator2.remove()
354+
iterator.remove()
361355
}
362356
}
357+
attributes[emailShaKey] = otherValue
363358
}
364-
// else: do nothing
365359
}
366-
Logger.debug("Mansi "+attributes.size)
367360
}
368361

369362
private fun getStringForIdentity(identityType: IdentityType): String {

0 commit comments

Comments
 (0)