Updated on 2026-08-14
This commit is contained in:
parent
178417568b
commit
a0c821eb8c
4 changed files with 97 additions and 52 deletions
|
|
@ -7,6 +7,7 @@ import com.tangem.common.routing.AppRouter
|
|||
import com.tangem.common.ui.markets.action.CryptoCurrencyData
|
||||
import com.tangem.common.ui.markets.action.TokenActionsBSContentUM
|
||||
import com.tangem.core.analytics.api.AnalyticsEventHandler
|
||||
import com.tangem.core.analytics.models.AnalyticsEvent
|
||||
import com.tangem.core.analytics.models.AnalyticsParam
|
||||
import com.tangem.core.analytics.models.event.TransferAnalyticsEvent
|
||||
import com.tangem.core.decompose.di.ModelScoped
|
||||
|
|
@ -23,6 +24,7 @@ import com.tangem.domain.models.account.filterCryptoPortfolio
|
|||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.currency.CryptoCurrencyStatus
|
||||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.tokens.model.analytics.TokenScreenAnalyticsEvent
|
||||
import com.tangem.domain.wallets.usecase.GetUserWalletUseCase
|
||||
import com.tangem.features.commonfeatures.api.managefunds.ManageFundsComponent
|
||||
import com.tangem.features.commonfeatures.api.addtoportfolio.AvailableToAddData
|
||||
|
|
@ -153,12 +155,7 @@ internal class ManageFundsModel @Inject constructor(
|
|||
|
||||
override fun onQuickActionClick(action: TokenActionsBSContentUM.Action, shouldDismiss: Boolean) {
|
||||
val event = when (flowType) {
|
||||
ManageFundsComponent.FlowType.AddFunds -> when (action) {
|
||||
TokenActionsBSContentUM.Action.Buy -> ManageFundsAnalyticsEvent.ButtonBuy()
|
||||
TokenActionsBSContentUM.Action.Exchange -> ManageFundsAnalyticsEvent.ButtonSwap()
|
||||
TokenActionsBSContentUM.Action.Receive -> ManageFundsAnalyticsEvent.ButtonReceive()
|
||||
else -> null
|
||||
}
|
||||
ManageFundsComponent.FlowType.AddFunds -> addFundsQuickActionEvent(action)
|
||||
ManageFundsComponent.FlowType.Transfer -> when (action) {
|
||||
TokenActionsBSContentUM.Action.Send -> TransferAnalyticsEvent.ButtonSend()
|
||||
TokenActionsBSContentUM.Action.Exchange -> TransferAnalyticsEvent.ButtonSwap()
|
||||
|
|
@ -173,6 +170,51 @@ internal class ManageFundsModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun addFundsQuickActionEvent(action: TokenActionsBSContentUM.Action): AnalyticsEvent? {
|
||||
val request = tokenActionsTrigger.value
|
||||
return if (launchMode is ManageFundsComponent.LaunchMode.TokenActionsOnly && request != null) {
|
||||
tokenScreenQuickActionEvent(action, request)
|
||||
} else {
|
||||
when (action) {
|
||||
TokenActionsBSContentUM.Action.Buy -> ManageFundsAnalyticsEvent.ButtonBuy()
|
||||
TokenActionsBSContentUM.Action.Exchange -> ManageFundsAnalyticsEvent.ButtonSwap()
|
||||
TokenActionsBSContentUM.Action.Receive -> ManageFundsAnalyticsEvent.ButtonReceive()
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun tokenScreenQuickActionEvent(
|
||||
action: TokenActionsBSContentUM.Action,
|
||||
request: TokenActionsRequest,
|
||||
): AnalyticsEvent? {
|
||||
val token = request.status.currency.symbol
|
||||
val blockchain = request.status.currency.network.name
|
||||
val derivationIndex = request.account.account
|
||||
.takeUnless { it.isMainAccount }
|
||||
?.derivationIndex?.value
|
||||
return when (action) {
|
||||
TokenActionsBSContentUM.Action.Buy -> TokenScreenAnalyticsEvent.ButtonWithParams.ButtonBuy(
|
||||
token = token,
|
||||
blockchain = blockchain,
|
||||
status = TokenScreenAnalyticsEvent.AVAILABLE,
|
||||
derivationIndex = derivationIndex,
|
||||
)
|
||||
TokenActionsBSContentUM.Action.Exchange -> TokenScreenAnalyticsEvent.ButtonWithParams.ButtonExchange(
|
||||
token = token,
|
||||
status = TokenScreenAnalyticsEvent.AVAILABLE,
|
||||
blockchain = blockchain,
|
||||
derivationIndex = derivationIndex,
|
||||
)
|
||||
TokenActionsBSContentUM.Action.Receive -> TokenScreenAnalyticsEvent.ButtonWithParams.ButtonReceive(
|
||||
token = token,
|
||||
status = TokenScreenAnalyticsEvent.AVAILABLE,
|
||||
blockchain = blockchain,
|
||||
)
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
fun buildAvailableToAddDataForChooser(): AvailableToAddData {
|
||||
val byWallet = filteredEntries.value.groupBy { it.userWallet.walletId }
|
||||
return AvailableToAddData(
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ internal class AllOffersModel @Inject constructor(
|
|||
analyticsEventHandler.send(
|
||||
event = OnrampAnalyticsEvent.OnPaymentMethodChosen(paymentMethod = method.methodConfig.method.name),
|
||||
)
|
||||
analyticsEventHandler.send(OnrampAnalyticsEvent.ProvidersScreenOpened())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ import dagger.assisted.AssistedInject
|
|||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.filterIsInstance
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@Suppress("LargeClass")
|
||||
internal class DefaultSendComponent @AssistedInject constructor(
|
||||
|
|
@ -91,49 +90,47 @@ internal class DefaultSendComponent @AssistedInject constructor(
|
|||
lifecycle = lifecycle,
|
||||
mode = ObserveLifecycleMode.CREATE_DESTROY,
|
||||
) { stack ->
|
||||
componentScope.launch {
|
||||
when (val activeComponent = stack.active.instance) {
|
||||
is SendConfirmComponent -> {
|
||||
val fromCurrency = params.currency
|
||||
val fromDerivationIndex = model.accountFlow.value?.derivationIndex?.value
|
||||
.takeIf { model.isAccountModeFlow.value }
|
||||
analyticsEventHandler.send(
|
||||
CommonSendAnalyticEvents.ConfirmationScreenOpened(
|
||||
categoryName = model.analyticCategoryName,
|
||||
source = model.analyticsSendSource,
|
||||
sendBlockchain = fromCurrency.network.name,
|
||||
sendToken = fromCurrency.symbol,
|
||||
fromDerivationIndex = fromDerivationIndex,
|
||||
toDerivationIndex = null,
|
||||
type = model.consumeEntryType(),
|
||||
),
|
||||
)
|
||||
if (model.currentRoute.value.isEditMode) {
|
||||
activeComponent.updateState(model.uiState.value)
|
||||
}
|
||||
}
|
||||
is SendAmountComponent -> {
|
||||
analyticsEventHandler.send(
|
||||
CommonSendAnalyticEvents.AmountScreenOpened(
|
||||
categoryName = model.analyticCategoryName,
|
||||
source = model.analyticsSendSource,
|
||||
type = model.consumeEntryType(),
|
||||
),
|
||||
)
|
||||
activeComponent.updateState(model.uiState.value.amountUM)
|
||||
}
|
||||
is DefaultSendDestinationComponent -> {
|
||||
analyticsEventHandler.send(
|
||||
CommonSendAnalyticEvents.AddressScreenOpened(
|
||||
categoryName = model.analyticCategoryName,
|
||||
source = model.analyticsSendSource,
|
||||
),
|
||||
)
|
||||
activeComponent.updateState(model.uiState.value.destinationUM)
|
||||
when (val activeComponent = stack.active.instance) {
|
||||
is SendConfirmComponent -> {
|
||||
val fromCurrency = params.currency
|
||||
val fromDerivationIndex = model.accountFlow.value?.derivationIndex?.value
|
||||
.takeIf { model.isAccountModeFlow.value }
|
||||
analyticsEventHandler.send(
|
||||
CommonSendAnalyticEvents.ConfirmationScreenOpened(
|
||||
categoryName = model.analyticCategoryName,
|
||||
source = model.analyticsSendSource,
|
||||
sendBlockchain = fromCurrency.network.name,
|
||||
sendToken = fromCurrency.symbol,
|
||||
fromDerivationIndex = fromDerivationIndex,
|
||||
toDerivationIndex = null,
|
||||
type = model.consumeEntryType(),
|
||||
),
|
||||
)
|
||||
if (model.currentRoute.value.isEditMode) {
|
||||
activeComponent.updateState(model.uiState.value)
|
||||
}
|
||||
}
|
||||
model.currentRoute.emit(stack.active.configuration)
|
||||
is SendAmountComponent -> {
|
||||
analyticsEventHandler.send(
|
||||
CommonSendAnalyticEvents.AmountScreenOpened(
|
||||
categoryName = model.analyticCategoryName,
|
||||
source = model.analyticsSendSource,
|
||||
type = model.consumeEntryType(),
|
||||
),
|
||||
)
|
||||
activeComponent.updateState(model.uiState.value.amountUM)
|
||||
}
|
||||
is DefaultSendDestinationComponent -> {
|
||||
analyticsEventHandler.send(
|
||||
CommonSendAnalyticEvents.AddressScreenOpened(
|
||||
categoryName = model.analyticCategoryName,
|
||||
source = model.analyticsSendSource,
|
||||
),
|
||||
)
|
||||
activeComponent.updateState(model.uiState.value.destinationUM)
|
||||
}
|
||||
}
|
||||
model.currentRoute.value = stack.active.configuration
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -339,15 +339,19 @@ internal class WalletContentClickIntentsImplementor @Inject constructor(
|
|||
}
|
||||
|
||||
override fun onNFTClick(userWallet: UserWallet) {
|
||||
val selectedWallet = stateHolder.getSelectedWallet() as? WalletState.MultiCurrency.Content ?: return
|
||||
when (val state = selectedWallet.nftState) {
|
||||
val nftState = if (stateHolder.value.isRedesignEnabled) {
|
||||
stateHolder.getSelectedWalletUM().nftState
|
||||
} else {
|
||||
(stateHolder.getSelectedWallet() as? WalletState.MultiCurrency.Content)?.nftState
|
||||
}
|
||||
when (nftState) {
|
||||
is WalletNFTItemUM.Content -> {
|
||||
analyticsEventHandler.send(
|
||||
NFTAnalyticsEvent.NFTListScreenOpened(
|
||||
state = AnalyticsParam.EmptyFull.Full,
|
||||
allAssetsCount = state.allAssetsCount,
|
||||
collectionsCount = state.collectionsCount,
|
||||
noCollectionAssetsCount = state.noCollectionAssetsCount,
|
||||
allAssetsCount = nftState.allAssetsCount,
|
||||
collectionsCount = nftState.collectionsCount,
|
||||
noCollectionAssetsCount = nftState.noCollectionAssetsCount,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
@ -364,6 +368,7 @@ internal class WalletContentClickIntentsImplementor @Inject constructor(
|
|||
is WalletNFTItemUM.Failed,
|
||||
is WalletNFTItemUM.Hidden,
|
||||
is WalletNFTItemUM.Loading,
|
||||
null,
|
||||
-> Unit
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue