Updated on 2026-08-14
This commit is contained in:
parent
b316ef4d87
commit
370690a359
42 changed files with 486 additions and 35 deletions
|
|
@ -25,6 +25,8 @@ import com.tangem.core.ui.message.EventMessageAction
|
|||
import com.tangem.core.ui.message.SnackbarMessage
|
||||
import com.tangem.core.ui.message.bottomSheetMessage
|
||||
import com.tangem.domain.account.featuretoggle.AccountsFeatureToggles
|
||||
import com.tangem.domain.account.supplier.SingleAccountListSupplier
|
||||
import com.tangem.domain.account.usecase.IsAccountsModeEnabledUseCase
|
||||
import com.tangem.domain.card.common.util.cardTypesResolver
|
||||
import com.tangem.domain.demo.IsDemoCardUseCase
|
||||
import com.tangem.domain.models.PortfolioId
|
||||
|
|
@ -88,6 +90,8 @@ internal class WalletSettingsModel @Inject constructor(
|
|||
private val dismissUpgradeWalletNotificationUseCase: DismissUpgradeWalletNotificationUseCase,
|
||||
private val unlockHotWalletContextualUseCase: UnlockHotWalletContextualUseCase,
|
||||
private val accountsFeatureToggles: AccountsFeatureToggles,
|
||||
private val isAccountsModeEnabledUseCase: IsAccountsModeEnabledUseCase,
|
||||
private val singleAccountListSupplier: SingleAccountListSupplier,
|
||||
private val accountListSortingSaver: AccountListSortingSaver,
|
||||
) : Model() {
|
||||
|
||||
|
|
@ -115,7 +119,18 @@ internal class WalletSettingsModel @Inject constructor(
|
|||
init {
|
||||
getUserWalletUseCase.invoke(params.userWalletId).onRight { wallet ->
|
||||
trackingContextProxy.addContext(wallet)
|
||||
analyticsEventHandler.send(WalletSettingsAnalyticEvents.WalletSettingsScreenOpened())
|
||||
modelScope.launch {
|
||||
val accountsCount = if (isAccountsModeEnabledUseCase.invokeSync()) {
|
||||
singleAccountListSupplier(wallet.walletId)
|
||||
.first()
|
||||
.accounts
|
||||
.size
|
||||
} else {
|
||||
null
|
||||
}
|
||||
val event = WalletSettingsAnalyticEvents.WalletSettingsScreenOpened(accountsCount)
|
||||
analyticsEventHandler.send(event)
|
||||
}
|
||||
}
|
||||
|
||||
fun combineUI(wallet: UserWallet) = combine(
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.tangem.feature.walletsettings.utils
|
|||
|
||||
import com.tangem.common.routing.AppRoute
|
||||
import com.tangem.common.ui.account.AccountPortfolioItemUMConverter
|
||||
import com.tangem.core.analytics.api.AnalyticsEventHandler
|
||||
import com.tangem.core.decompose.di.ModelScoped
|
||||
import com.tangem.core.decompose.model.ParamsContainer
|
||||
import com.tangem.core.decompose.navigation.Router
|
||||
|
|
@ -24,6 +25,7 @@ import com.tangem.domain.models.account.AccountId
|
|||
import com.tangem.domain.models.account.AccountStatus
|
||||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.domain.wallets.analytics.WalletSettingsAnalyticEvents
|
||||
import com.tangem.domain.wallets.extension.isAccountsSupported
|
||||
import com.tangem.feature.walletsettings.component.WalletSettingsComponent
|
||||
import com.tangem.feature.walletsettings.entity.WalletSettingsAccountsUM
|
||||
|
|
@ -46,6 +48,7 @@ internal class AccountItemsDelegate @Inject constructor(
|
|||
private val isAccountsModeEnabledUseCase: IsAccountsModeEnabledUseCase,
|
||||
private val accountListSortingSaver: AccountListSortingSaver,
|
||||
private val accountsFeatureToggles: AccountsFeatureToggles,
|
||||
private val analyticsEventHandler: AnalyticsEventHandler,
|
||||
) {
|
||||
|
||||
private val userWalletId = paramsContainer.require<WalletSettingsComponent.Params>().userWalletId
|
||||
|
|
@ -72,7 +75,10 @@ internal class AccountItemsDelegate @Inject constructor(
|
|||
): List<WalletSettingsAccountsUM> = buildList {
|
||||
fun AccountStatus.CryptoPortfolio.mapCryptoPortfolio(): WalletSettingsAccountsUM {
|
||||
val accountItemUM = AccountPortfolioItemUMConverter(
|
||||
onClick = { openAccountDetails(this.account) },
|
||||
onClick = {
|
||||
analyticsEventHandler.send(WalletSettingsAnalyticEvents.ButtonOpenExistingAccount())
|
||||
openAccountDetails(this.account)
|
||||
},
|
||||
appCurrency = appCurrency,
|
||||
accountBalance = this.tokenList.totalFiatBalance,
|
||||
isBalanceHidden = isBalanceHidden,
|
||||
|
|
@ -107,14 +113,22 @@ internal class AccountItemsDelegate @Inject constructor(
|
|||
title = resourceReference(R.string.account_form_title_create),
|
||||
isAddAccountEnabled = isAddAccountEnabled,
|
||||
onAddAccountClick = {
|
||||
if (isAddAccountEnabled) openAddAccount(userWalletId) else canNotAddAccountDialog()
|
||||
if (isAddAccountEnabled) {
|
||||
analyticsEventHandler.send(WalletSettingsAnalyticEvents.ButtonAddAccount())
|
||||
openAddAccount(userWalletId)
|
||||
} else {
|
||||
canNotAddAccountDialog()
|
||||
}
|
||||
},
|
||||
),
|
||||
archivedAccounts = if (isArchivedAccountsEnabled) {
|
||||
BlockUM(
|
||||
text = resourceReference(R.string.account_archived_accounts),
|
||||
iconRes = R.drawable.ic_archive_24,
|
||||
onClick = { openArchivedAccounts(userWalletId) },
|
||||
onClick = {
|
||||
analyticsEventHandler.send(WalletSettingsAnalyticEvents.ButtonArchivedAccounts())
|
||||
openArchivedAccounts(userWalletId)
|
||||
},
|
||||
)
|
||||
} else {
|
||||
null
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.tangem.feature.walletsettings.utils
|
||||
|
||||
import com.tangem.core.analytics.api.AnalyticsEventHandler
|
||||
import com.tangem.domain.account.usecase.ApplyAccountListSortingUseCase
|
||||
import com.tangem.domain.models.account.AccountId
|
||||
import com.tangem.domain.wallets.analytics.WalletSettingsAnalyticEvents
|
||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
|
|
@ -24,6 +26,7 @@ import kotlin.time.Duration.Companion.seconds
|
|||
@OptIn(FlowPreview::class)
|
||||
internal class AccountListSortingSaver @Inject constructor(
|
||||
private val applyAccountListSortingUseCase: ApplyAccountListSortingUseCase,
|
||||
private val analyticsEventHandler: AnalyticsEventHandler,
|
||||
dispatchers: CoroutineDispatcherProvider,
|
||||
) {
|
||||
|
||||
|
|
@ -41,6 +44,9 @@ internal class AccountListSortingSaver @Inject constructor(
|
|||
applyAccountListSortingUseCase.invoke(accountIds).onLeft {
|
||||
Timber.e("Error while saving account list sorting: $it")
|
||||
}
|
||||
.onRight {
|
||||
analyticsEventHandler.send(WalletSettingsAnalyticEvents.LongtapAccountsOrder())
|
||||
}
|
||||
}
|
||||
.launchIn(coroutineScope)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue