Updated on 2026-08-14

This commit is contained in:
Tangem 2025-09-16 17:48:11 +03:00
parent 45ab6836ad
commit 5c56f04c38
52 changed files with 228 additions and 72 deletions

View file

@ -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)
}

View file

@ -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") }

View file

@ -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,
),
),
)
},