Updated on 2026-08-14
This commit is contained in:
parent
45ab6836ad
commit
5c56f04c38
52 changed files with 228 additions and 72 deletions
|
|
@ -37,7 +37,11 @@ data class OnrampAddToPortfolioUM(
|
|||
formatArgs = wrappedList(networkName),
|
||||
)
|
||||
|
||||
data class AddButtonUM(val isProgress: Boolean, val onClick: () -> Unit) {
|
||||
data class AddButtonUM(
|
||||
val isProgress: Boolean,
|
||||
val isTangemIconVisible: Boolean,
|
||||
val onClick: () -> Unit,
|
||||
) {
|
||||
|
||||
val text: TextReference = resourceReference(R.string.common_add_to_portfolio)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,10 +49,20 @@ internal class OnrampAddToPortfolioModel @Inject constructor(
|
|||
currencyName = params.cryptoCurrency.name,
|
||||
networkName = params.cryptoCurrency.network.name,
|
||||
currencyIconState = params.currencyIconState,
|
||||
addButtonUM = OnrampAddToPortfolioUM.AddButtonUM(isProgress = false, onClick = ::onAddClick),
|
||||
addButtonUM = OnrampAddToPortfolioUM.AddButtonUM(
|
||||
isProgress = false,
|
||||
isTangemIconVisible = isTangemIconVisible(),
|
||||
onClick = ::onAddClick,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
private fun isTangemIconVisible(): Boolean {
|
||||
return getUserWalletUseCase(params.userWalletId)
|
||||
.onLeft { Timber.e("Unable to get wallet by id [${params.userWalletId}]: $it") }
|
||||
.fold(ifLeft = { false }, ifRight = { it is UserWallet.Cold })
|
||||
}
|
||||
|
||||
private fun getUserWalletName(): String {
|
||||
return getUserWalletUseCase(params.userWalletId)
|
||||
.onLeft { Timber.e("Unable to get wallet name by id [${params.userWalletId}]: $it") }
|
||||
|
|
|
|||
|
|
@ -149,7 +149,11 @@ private fun PreviewOnrampAddToPortfolioContent() {
|
|||
isGrayscale = false,
|
||||
showCustomBadge = false,
|
||||
),
|
||||
addButtonUM = OnrampAddToPortfolioUM.AddButtonUM(isProgress = false, onClick = {}),
|
||||
addButtonUM = OnrampAddToPortfolioUM.AddButtonUM(
|
||||
isProgress = false,
|
||||
onClick = {},
|
||||
isTangemIconVisible = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue