Updated on 2026-08-14

This commit is contained in:
Tangem 2023-06-30 09:26:53 +08:00
parent 65ff4a4b49
commit 9112d2bab8
55 changed files with 492 additions and 389 deletions

View file

@ -1,6 +1,7 @@
package com.tangem.tap.common.extensions
import com.tangem.core.analytics.Analytics
import com.tangem.domain.card.CardTypeResolver
import com.tangem.domain.models.scan.ScanResponse
import com.tangem.tap.common.analytics.paramsInterceptor.LinkedCardContextInterceptor
@ -11,8 +12,8 @@ import com.tangem.tap.common.analytics.paramsInterceptor.LinkedCardContextInterc
/**
* Sets the new context
*/
fun Analytics.setContext(scanResponse: ScanResponse) {
addParamsInterceptor(LinkedCardContextInterceptor(scanResponse))
fun Analytics.setContext(scanResponse: ScanResponse, cardTypeResolver: CardTypeResolver) {
addParamsInterceptor(LinkedCardContextInterceptor(scanResponse, cardTypeResolver))
}
/**
@ -25,9 +26,13 @@ fun Analytics.eraseContext() {
/**
* Adds a new context and keeps a previous context as the parent of the new one
*/
fun Analytics.addContext(scanResponse: ScanResponse) {
fun Analytics.addContext(scanResponse: ScanResponse, cardTypeResolver: CardTypeResolver) {
val currentContext = removeParamsInterceptor(LinkedCardContextInterceptor.id()) as? LinkedCardContextInterceptor
val newContext = LinkedCardContextInterceptor(scanResponse, parent = currentContext)
val newContext = LinkedCardContextInterceptor(
scanResponse = scanResponse,
cardTypeResolver = cardTypeResolver,
parent = currentContext,
)
addParamsInterceptor(newContext)
}