Updated on 2026-08-14
This commit is contained in:
parent
c77fcafdc2
commit
b4b35916d9
7 changed files with 55 additions and 12 deletions
|
|
@ -0,0 +1,19 @@
|
|||
package com.tangem.core.analytics.api
|
||||
|
||||
import com.tangem.core.analytics.models.AnalyticsEvent
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
class ResettableOneTimeEventSender(val analyticsEventHandler: AnalyticsEventHandler) {
|
||||
|
||||
private val sentEvents = ConcurrentHashMap<String, AnalyticsEvent>()
|
||||
|
||||
fun sendEventOnce(key: String, event: AnalyticsEvent) {
|
||||
if (sentEvents[key] != null) return
|
||||
analyticsEventHandler.send(event)
|
||||
sentEvents[key] = event
|
||||
}
|
||||
|
||||
fun reset(key: String) {
|
||||
sentEvents.remove(key)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue