Updated on 2026-08-14
This commit is contained in:
parent
a8a167581d
commit
dae45a7f15
1 changed files with 32 additions and 19 deletions
|
|
@ -9,6 +9,7 @@ import com.tangem.domain.tokens.model.CryptoCurrency
|
|||
import com.tangem.domain.tokens.model.CryptoCurrencyStatus
|
||||
import com.tangem.domain.tokens.model.analytics.TokenExchangeAnalyticsEvent
|
||||
import com.tangem.domain.tokens.model.analytics.TokenOnrampAnalyticsEvent
|
||||
import com.tangem.domain.tokens.model.analytics.TokenScreenAnalyticsEvent
|
||||
import com.tangem.domain.wallets.models.UserWalletId
|
||||
import com.tangem.feature.swap.domain.models.domain.ExchangeStatus
|
||||
import com.tangem.feature.tokendetails.presentation.tokendetails.state.TokenDetailsState
|
||||
|
|
@ -116,19 +117,28 @@ internal class ExpressStatusFactory @AssistedInject constructor(
|
|||
}
|
||||
|
||||
fun getStateWithExpressStatusBottomSheet(expressState: ExpressTransactionStateUM): TokenDetailsState {
|
||||
val analyticEvent = when (expressState) {
|
||||
is ExchangeUM -> TokenExchangeAnalyticsEvent.CexTxStatusOpened(
|
||||
cryptoCurrency.symbol,
|
||||
val analyticEvents = when (expressState) {
|
||||
is ExchangeUM -> listOfNotNull(
|
||||
TokenExchangeAnalyticsEvent.CexTxStatusOpened(
|
||||
cryptoCurrency.symbol,
|
||||
),
|
||||
maybeGetLongTimeExchangeNotificationShowEvent(
|
||||
expressState = expressState,
|
||||
currentStateNotification = null,
|
||||
isBottomSheetShown = true,
|
||||
),
|
||||
)
|
||||
is ExpressTransactionStateUM.OnrampUM -> TokenOnrampAnalyticsEvent.OnrampStatusOpened(
|
||||
tokenSymbol = cryptoCurrency.symbol,
|
||||
provider = expressState.providerName,
|
||||
fiatCurrency = expressState.fromCurrencyCode,
|
||||
is ExpressTransactionStateUM.OnrampUM -> listOf(
|
||||
TokenOnrampAnalyticsEvent.OnrampStatusOpened(
|
||||
tokenSymbol = cryptoCurrency.symbol,
|
||||
provider = expressState.providerName,
|
||||
fiatCurrency = expressState.fromCurrencyCode,
|
||||
),
|
||||
)
|
||||
else -> return currentStateProvider()
|
||||
}
|
||||
|
||||
analyticsEventsHandler.send(analyticEvent)
|
||||
analyticEvents.forEach { analyticsEventsHandler.send(it) }
|
||||
|
||||
return currentStateProvider().copy(
|
||||
bottomSheetConfig = TangemBottomSheetConfig(
|
||||
|
|
@ -146,10 +156,11 @@ internal class ExpressStatusFactory @AssistedInject constructor(
|
|||
val bottomSheetConfig = state.bottomSheetConfig
|
||||
val currentConfig = bottomSheetConfig?.content as? ExpressStatusBottomSheetConfig ?: return bottomSheetConfig
|
||||
|
||||
sendLongTimeExchangeNotificationShowEvent(
|
||||
maybeGetLongTimeExchangeNotificationShowEvent(
|
||||
expressState = expressState,
|
||||
currentStateNotification = (currentConfig.value as? ExchangeUM)?.notification,
|
||||
)
|
||||
isBottomSheetShown = bottomSheetConfig.isShown,
|
||||
)?.let { analyticsEventsHandler.send(it) }
|
||||
|
||||
return bottomSheetConfig.copy(
|
||||
content = if (currentConfig.value != expressState) {
|
||||
|
|
@ -172,21 +183,23 @@ internal class ExpressStatusFactory @AssistedInject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun sendLongTimeExchangeNotificationShowEvent(
|
||||
private fun maybeGetLongTimeExchangeNotificationShowEvent(
|
||||
expressState: ExpressTransactionStateUM,
|
||||
currentStateNotification: ExchangeStatusNotification?,
|
||||
) {
|
||||
isBottomSheetShown: Boolean,
|
||||
): TokenScreenAnalyticsEvent? {
|
||||
val newState = expressState as? ExchangeUM
|
||||
val newStateNotification = newState?.notification
|
||||
if (currentStateNotification !is ExchangeStatusNotification.LongTimeExchange &&
|
||||
newStateNotification is ExchangeStatusNotification.LongTimeExchange
|
||||
return if (currentStateNotification !is ExchangeStatusNotification.LongTimeExchange &&
|
||||
newStateNotification is ExchangeStatusNotification.LongTimeExchange &&
|
||||
isBottomSheetShown
|
||||
) {
|
||||
analyticsEventsHandler.send(
|
||||
TokenExchangeAnalyticsEvent.LongTimeTransaction(
|
||||
token = cryptoCurrency.symbol,
|
||||
provider = newState.provider.name,
|
||||
),
|
||||
TokenExchangeAnalyticsEvent.LongTimeTransaction(
|
||||
token = cryptoCurrency.symbol,
|
||||
provider = newState.provider.name,
|
||||
)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue