Updated on 2026-08-14
This commit is contained in:
parent
4dc994e8cf
commit
03da1731ea
24 changed files with 335 additions and 92 deletions
|
|
@ -2,21 +2,13 @@ package com.tangem.features.managetokens.component
|
|||
|
||||
import com.tangem.core.decompose.factory.ComponentFactory
|
||||
import com.tangem.core.ui.decompose.ComposableContentComponent
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
|
||||
interface ManageTokensComponent : ComposableContentComponent {
|
||||
|
||||
data class Params(
|
||||
val mode: ManageTokensMode,
|
||||
val source: ManageTokensSource,
|
||||
) {
|
||||
constructor(userWalletId: UserWalletId?, source: ManageTokensSource) : this(
|
||||
source = source,
|
||||
mode = userWalletId
|
||||
?.let { ManageTokensMode.Wallet(userWalletId) }
|
||||
?: ManageTokensMode.None,
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
interface Factory : ComponentFactory<Params, ManageTokensComponent>
|
||||
}
|
||||
|
|
@ -17,6 +17,13 @@ sealed interface ManageTokensMode {
|
|||
}
|
||||
|
||||
sealed interface AddCustomTokenMode {
|
||||
data class Wallet(val userWalletId: UserWalletId) : AddCustomTokenMode
|
||||
|
||||
val userWalletId: UserWalletId
|
||||
get() = when (this) {
|
||||
is Account -> accountId.userWalletId
|
||||
is Wallet -> userWalletId
|
||||
}
|
||||
|
||||
data class Wallet(override val userWalletId: UserWalletId) : AddCustomTokenMode
|
||||
data class Account(val accountId: AccountId) : AddCustomTokenMode
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue