TP-29164 | Pulse buildEvent Crash fix (#7283)

This commit is contained in:
Girish Siuragani
2023-07-20 14:48:50 +05:30
committed by GitHub
parent 227bf792f1
commit b13cf24165

View File

@@ -20,11 +20,17 @@ object PulseUtils {
@WorkerThread
fun buildEvent(eventName: String, properties: Map<String, String>? = null): PulseEvent {
val propertiesConcurrentHashMap: ConcurrentHashMap<String, String> =
if (properties == null) ConcurrentHashMap() else ConcurrentHashMap(properties)
val propertiesConcurrentHashMap: ConcurrentHashMap<String, String> = ConcurrentHashMap()
properties?.let {
val iterator = it.entries.iterator()
while (iterator.hasNext()) {
val (key, value) = iterator.next()
propertiesConcurrentHashMap[key] = value
}
}
val timeStamp = System.currentTimeMillis()
PulseSDKConfig.getSessionId()?.let {
propertiesConcurrentHashMap.put(SESSION_ID, it)
PulseSDKConfig.getSessionId()?.let { sessionId ->
propertiesConcurrentHashMap[SESSION_ID] = sessionId
}
val eventData = EventData(eventName, timeStamp, propertiesConcurrentHashMap)
PulseLogger.log(LOG_TAG, "Event object created - $eventName")