Updated on 2026-08-14
This commit is contained in:
parent
5aa02ecff7
commit
5efe33a6b6
3 changed files with 10 additions and 1 deletions
|
|
@ -31,6 +31,7 @@ data class SwapStateHolder(
|
|||
val bottomSheetConfig: TangemBottomSheetConfig? = null,
|
||||
|
||||
val swapButton: SwapButton,
|
||||
val shouldShowMaxAmount: Boolean,
|
||||
val tosState: TosState? = null,
|
||||
|
||||
val onRefresh: () -> Unit,
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ internal class StateBuilder(
|
|||
changeCardsButtonState = ChangeCardsButtonState.UPDATE_IN_PROGRESS,
|
||||
onShowPermissionBottomSheet = actions.openPermissionBottomSheet,
|
||||
providerState = ProviderState.Empty(),
|
||||
shouldShowMaxAmount = false,
|
||||
priceImpact = PriceImpact.Empty(),
|
||||
)
|
||||
}
|
||||
|
|
@ -187,6 +188,7 @@ internal class StateBuilder(
|
|||
permissionState = uiStateHolder.permissionState,
|
||||
changeCardsButtonState = ChangeCardsButtonState.UPDATE_IN_PROGRESS,
|
||||
priceImpact = PriceImpact.Empty(),
|
||||
shouldShowMaxAmount = shouldShowMaxAmount(fromToken, toToken),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -276,9 +278,14 @@ internal class StateBuilder(
|
|||
PriceImpact.Empty()
|
||||
},
|
||||
tosState = createTosState(swapProvider),
|
||||
shouldShowMaxAmount = shouldShowMaxAmount(fromToken, toCurrencyStatus.currency),
|
||||
)
|
||||
}
|
||||
|
||||
private fun shouldShowMaxAmount(fromToken: CryptoCurrency, toCurrency: CryptoCurrency): Boolean {
|
||||
return !(fromToken is CryptoCurrency.Coin && fromToken.network.id == toCurrency.network.id)
|
||||
}
|
||||
|
||||
private fun createTosState(swapProvider: SwapProvider): TosState {
|
||||
return TosState(
|
||||
tosLink = swapProvider.termsOfUse?.let {
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ internal fun SwapScreenContent(state: SwapStateHolder, modifier: Modifier = Modi
|
|||
}
|
||||
}
|
||||
|
||||
if (keyboard is Keyboard.Opened) {
|
||||
if (state.shouldShowMaxAmount && keyboard is Keyboard.Opened) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.send_max_amount_label),
|
||||
style = TangemTheme.typography.button,
|
||||
|
|
@ -494,6 +494,7 @@ private val state = SwapStateHolder(
|
|||
blockchainId = "POLYGON",
|
||||
providerState = ProviderState.Loading(),
|
||||
priceImpact = PriceImpact.Empty(),
|
||||
shouldShowMaxAmount = true,
|
||||
tosState = TosState(
|
||||
tosLink = LegalState(
|
||||
title = stringReference("Terms of Use"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue