Updated on 2026-08-14

This commit is contained in:
Tangem 2023-02-17 14:08:05 +03:00
parent 69fe86f07c
commit e77bfba92a
13 changed files with 72 additions and 47 deletions

View file

@ -1,21 +0,0 @@
package com.tangem.tap.common.analytics.paramsInterceptor
import com.tangem.core.analytics.AnalyticsEvent
import com.tangem.core.analytics.api.ParamsInterceptor
import com.tangem.tap.common.analytics.events.AnalyticsParam
/**
[REDACTED_AUTHOR]
*/
class BatchIdParamsInterceptor(
val batchId: String,
) : ParamsInterceptor {
override fun id(): String = this::class.java.simpleName
override fun canBeAppliedTo(event: AnalyticsEvent): Boolean = true
override fun intercept(params: MutableMap<String, String>) {
params[AnalyticsParam.Batch] = batchId
}
}

View file

@ -37,15 +37,24 @@ class CardContextInterceptor(
ProductType.Note -> "Note"
ProductType.Twins -> "Twin"
ProductType.Wallet -> "Wallet"
ProductType.SaltPay -> when (scanResponse.isSaltPayVisa()) {
true -> "Visa"
else -> "Visa Backup"
ProductType.SaltPay -> if (scanResponse.isSaltPayVisa()) {
"Visa"
} else {
"Visa Backup"
}
ProductType.Start2Coin -> "Start2Coin"
else -> when (DemoHelper.isDemoCard(scanResponse)) {
// TODO: separate demo cards
true -> "Demo Wallet | Demo Note"
else -> "Other"
else -> if (DemoHelper.isDemoCard(scanResponse)) {
if (DemoHelper.isTestDemoCard(scanResponse)) {
"Demo Test"
} else {
when (scanResponse.card.cardId.substring(0..1)) {
"AC" -> "Demo Wallet"
"AB" -> "Demo Note"
else -> "Demo Other"
}
}
} else {
"Other"
}
}
}

View file

@ -0,0 +1,16 @@
package com.tangem.tap.common.extensions
import com.tangem.core.analytics.Analytics
import com.tangem.domain.common.ScanResponse
import com.tangem.tap.common.analytics.paramsInterceptor.CardContextInterceptor
/**
[REDACTED_AUTHOR]
*/
fun Analytics.addCardContext(scanResponse: ScanResponse) {
addParamsInterceptor(CardContextInterceptor(scanResponse))
}
fun Analytics.eraseCardContext() {
removeParamsInterceptor(CardContextInterceptor.id())
}