Updated on 2026-08-14
This commit is contained in:
parent
58d7b0f393
commit
94c46ca16d
19 changed files with 61 additions and 126 deletions
|
|
@ -33,7 +33,6 @@ import com.tangem.features.account.analytics.AccountSettingsAnalyticEvents.Compa
|
|||
import com.tangem.features.account.analytics.WalletSettingsAccountAnalyticEvents
|
||||
import com.tangem.features.account.createedit.entity.AccountCreateEditUM
|
||||
import com.tangem.features.account.createedit.entity.AccountCreateEditUMBuilder
|
||||
import com.tangem.features.account.createedit.entity.AccountCreateEditUMBuilder.Companion.portfolioIcon
|
||||
import com.tangem.features.account.createedit.entity.AccountCreateEditUMBuilder.Companion.toggleProgress
|
||||
import com.tangem.features.account.createedit.entity.AccountCreateEditUMBuilder.Companion.updateButton
|
||||
import com.tangem.features.account.createedit.entity.AccountCreateEditUMBuilder.Companion.updateColorSelect
|
||||
|
|
@ -173,7 +172,7 @@ internal class AccountCreateEditModel @Inject constructor(
|
|||
val name = state.account.name.toDomain().getOrNull() ?: return
|
||||
val icon = CryptoPortfolioIconConverter.convertBack(state.account.portfolioIcon)
|
||||
val isNewName = name != params.account.accountName
|
||||
val isNewIcon = icon != params.account.portfolioIcon
|
||||
val isNewIcon = icon != params.account.icon
|
||||
val derivationIndex = params.account.derivationIndex.value
|
||||
analyticsEventHandler.send(AccountSettingsAnalyticEvents.ButtonSave(name, icon, derivationIndex))
|
||||
|
||||
|
|
@ -258,7 +257,7 @@ internal class AccountCreateEditModel @Inject constructor(
|
|||
is AccountCreateEditComponent.Params.Create -> isValidName
|
||||
is AccountCreateEditComponent.Params.Edit -> {
|
||||
val oldName = params.account.accountName.toUM()
|
||||
val oldIcon = CryptoPortfolioIconConverter.convert(params.account.portfolioIcon)
|
||||
val oldIcon = CryptoPortfolioIconConverter.convert(params.account.icon)
|
||||
|
||||
val isNewName = this.account.name.trim() != oldName
|
||||
val isNewIcon = this.account.portfolioIcon != oldIcon
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import com.tangem.core.res.R
|
|||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.resourceReference
|
||||
import com.tangem.core.ui.extensions.wrappedList
|
||||
import com.tangem.domain.models.account.Account
|
||||
import com.tangem.domain.models.account.CryptoPortfolioIcon
|
||||
import com.tangem.features.account.AccountCreateEditComponent
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
|
|
@ -37,10 +36,8 @@ internal class AccountCreateEditUMBuilder(
|
|||
)
|
||||
is AccountCreateEditComponent.Params.Edit -> AccountCreateEditUM.Account(
|
||||
name = params.account.accountName.toUM(),
|
||||
portfolioIcon = CryptoPortfolioIconConverter.convert(params.account.portfolioIcon),
|
||||
derivationInfo = createAccountDerivationInfo(
|
||||
index = (params.account as Account.CryptoPortfolio).derivationIndex.value,
|
||||
),
|
||||
portfolioIcon = CryptoPortfolioIconConverter.convert(params.account.icon),
|
||||
derivationInfo = createAccountDerivationInfo(index = params.account.derivationIndex.value),
|
||||
inputPlaceholder = resourceReference(R.string.account_form_placeholder_edit_account),
|
||||
onNameChange = onNameChange,
|
||||
)
|
||||
|
|
@ -50,7 +47,7 @@ internal class AccountCreateEditUMBuilder(
|
|||
fun initColorsUM(onColorSelect: (CryptoPortfolioIcon.Color) -> Unit): AccountCreateEditUM.Colors {
|
||||
val selected: CryptoPortfolioIcon.Color = when (params) {
|
||||
is AccountCreateEditComponent.Params.Create -> createIcon.color
|
||||
is AccountCreateEditComponent.Params.Edit -> params.account.portfolioIcon.color
|
||||
is AccountCreateEditComponent.Params.Edit -> params.account.icon.color
|
||||
}
|
||||
return AccountCreateEditUM.Colors(
|
||||
selected = selected,
|
||||
|
|
@ -62,7 +59,7 @@ internal class AccountCreateEditUMBuilder(
|
|||
fun initIconsUM(onIconSelect: (CryptoPortfolioIcon.Icon) -> Unit): AccountCreateEditUM.Icons {
|
||||
val selected: CryptoPortfolioIcon.Icon = when (params) {
|
||||
is AccountCreateEditComponent.Params.Create -> createIcon.value
|
||||
is AccountCreateEditComponent.Params.Edit -> params.account.portfolioIcon.value
|
||||
is AccountCreateEditComponent.Params.Edit -> params.account.icon.value
|
||||
}
|
||||
return AccountCreateEditUM.Icons(
|
||||
selected = selected,
|
||||
|
|
@ -85,13 +82,6 @@ internal class AccountCreateEditUMBuilder(
|
|||
}
|
||||
|
||||
internal companion object {
|
||||
|
||||
val Account.portfolioIcon: CryptoPortfolioIcon
|
||||
get() = when (this) {
|
||||
is Account.CryptoPortfolio -> this.icon
|
||||
is Account.Payment -> TODO("[REDACTED_JIRA]")
|
||||
}
|
||||
|
||||
fun AccountCreateEditUM.updateColorSelect(color: CryptoPortfolioIcon.Color): AccountCreateEditUM {
|
||||
val newIcon = this.account.portfolioIcon.copy(
|
||||
color = color,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import com.tangem.domain.models.wallet.isMultiCurrency
|
|||
import com.tangem.domain.wallets.usecase.GetUserWalletUseCase
|
||||
import com.tangem.features.account.AccountDetailsComponent
|
||||
import com.tangem.features.account.analytics.AccountSettingsAnalyticEvents
|
||||
import com.tangem.features.account.createedit.entity.AccountCreateEditUMBuilder.Companion.portfolioIcon
|
||||
import com.tangem.features.account.details.entity.AccountDetailsUM
|
||||
import com.tangem.features.account.details.entity.AccountDetailsUM.ArchiveMode
|
||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||
|
|
@ -164,7 +163,7 @@ internal class AccountDetailsModel @Inject constructor(
|
|||
?.isMultiCurrency == true
|
||||
return AccountDetailsUM(
|
||||
accountName = account.accountName.toUM().value,
|
||||
accountIcon = CryptoPortfolioIconConverter.convert(account.portfolioIcon),
|
||||
accountIcon = CryptoPortfolioIconConverter.convert(account.icon),
|
||||
onCloseClick = { router.pop() },
|
||||
onAccountEditClick = { onEditAccountClick(account) },
|
||||
onManageTokensClick = { onManageTokensClick(account) },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue