Updated on 2026-08-14
This commit is contained in:
parent
7f71ef182e
commit
ed053eb38f
10 changed files with 83 additions and 42 deletions
|
|
@ -24,7 +24,7 @@ internal class SendAmountFieldConverter(
|
|||
),
|
||||
placeholder = TextReference.Str(DEFAULT_VALUE),
|
||||
isError = false,
|
||||
error = TextReference.Res(R.string.send_insufficient_funds),
|
||||
error = TextReference.Res(R.string.swapping_insufficient_funds),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import androidx.compose.material.Text
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.tangem.core.ui.components.SpacerH24
|
||||
|
|
@ -35,7 +36,7 @@ private fun ChooseFeeBottomSheetContent(content: ChooseFeeBottomSheetConfig) {
|
|||
modifier = Modifier.background(TangemTheme.colors.background.primary),
|
||||
) {
|
||||
Text(
|
||||
text = "Choose fee", // todo replace with strings
|
||||
text = stringResource(R.string.common_fee_selector_title),
|
||||
style = TangemTheme.typography.subtitle1,
|
||||
color = TangemTheme.colors.text.primary1,
|
||||
modifier = Modifier
|
||||
|
|
@ -53,9 +54,7 @@ private fun ChooseFeeBottomSheetContent(content: ChooseFeeBottomSheetConfig) {
|
|||
FeeItemsBlock(content)
|
||||
}
|
||||
Text(
|
||||
text = "Network transaction fees are small charges paid to support network security, incentivize " +
|
||||
"validators," +
|
||||
" allocate resources, and determine transaction priority.", // todo replace with strings
|
||||
text = stringResource(R.string.common_fee_selector_footer),
|
||||
style = TangemTheme.typography.caption2,
|
||||
color = TangemTheme.colors.text.secondary,
|
||||
modifier = Modifier
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheet
|
||||
|
|
@ -18,6 +19,7 @@ import com.tangem.core.ui.extensions.stringReference
|
|||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.feature.swap.models.states.ChooseProviderBottomSheetConfig
|
||||
import com.tangem.feature.swap.models.states.ProviderState
|
||||
import com.tangem.feature.swap.presentation.R
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
|
||||
@Composable
|
||||
|
|
@ -33,7 +35,7 @@ private fun ChooseProviderBottomSheetContent(content: ChooseProviderBottomSheetC
|
|||
modifier = Modifier.background(TangemTheme.colors.background.primary),
|
||||
) {
|
||||
Text(
|
||||
text = "Choose provider",
|
||||
text = stringResource(R.string.express_choose_providers_title),
|
||||
style = TangemTheme.typography.subtitle1,
|
||||
color = TangemTheme.colors.text.primary1,
|
||||
modifier = Modifier
|
||||
|
|
@ -41,7 +43,7 @@ private fun ChooseProviderBottomSheetContent(content: ChooseProviderBottomSheetC
|
|||
.align(Alignment.CenterHorizontally),
|
||||
)
|
||||
Text(
|
||||
text = "Providers facilitate transactions, ensuring smooth and efficient token exchanges",
|
||||
text = stringResource(R.string.express_choose_providers_subtitle),
|
||||
style = TangemTheme.typography.caption2,
|
||||
color = TangemTheme.colors.text.secondary,
|
||||
modifier = Modifier
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ fun ProviderItem(state: ProviderState, modifier: Modifier = Modifier, isSelected
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("LongMethod")
|
||||
@Composable
|
||||
private fun ProviderContentState(
|
||||
state: ProviderState.Content,
|
||||
|
|
|
|||
|
|
@ -120,8 +120,11 @@ internal class StateBuilder(
|
|||
warnings = listOf(
|
||||
SwapWarning.NoAvailableTokensToSwap(
|
||||
notificationConfig = NotificationConfig(
|
||||
title = stringReference("No tokens"),
|
||||
subtitle = stringReference("Swap tokens not available"),
|
||||
title = resourceReference(R.string.warning_express_no_exchangeable_coins_title),
|
||||
subtitle = resourceReference(
|
||||
id = R.string.warning_express_no_exchangeable_coins_description,
|
||||
formatArgs = wrappedList(fromToken.currency.name),
|
||||
),
|
||||
iconResId = R.drawable.img_attention_20,
|
||||
),
|
||||
),
|
||||
|
|
@ -210,8 +213,9 @@ internal class StateBuilder(
|
|||
),
|
||||
)
|
||||
}
|
||||
if (quoteModel.permissionState !is PermissionDataState.PermissionReadyForRequest &&
|
||||
!quoteModel.preparedSwapConfigState.isFeeEnough
|
||||
if (quoteModel.preparedSwapConfigState.isAllowedToSpend &&
|
||||
!quoteModel.preparedSwapConfigState.isFeeEnough &&
|
||||
quoteModel.preparedSwapConfigState.isBalanceEnough
|
||||
) {
|
||||
warnings.add(
|
||||
SwapWarning.UnableToCoverFeeWarning(
|
||||
|
|
@ -439,7 +443,7 @@ internal class StateBuilder(
|
|||
|
||||
return FeeItemState.Content(
|
||||
feeType = feeType,
|
||||
title = stringReference("Fee"), // todo replace with string
|
||||
title = resourceReference(R.string.common_fee_label),
|
||||
amountCrypto = fee.feeCryptoFormatted,
|
||||
symbolCrypto = fee.cryptoSymbol,
|
||||
amountFiatFormatted = fee.feeFiatFormatted,
|
||||
|
|
@ -611,6 +615,7 @@ internal class StateBuilder(
|
|||
)
|
||||
}
|
||||
|
||||
@Suppress("LongParameterList")
|
||||
fun showSelectProviderBottomSheet(
|
||||
uiState: SwapStateHolder,
|
||||
selectedProviderId: String,
|
||||
|
|
@ -624,7 +629,7 @@ internal class StateBuilder(
|
|||
}
|
||||
val unavailableProviderStates = unavailableProviders.map {
|
||||
it.convertToUnavailableProviderState(
|
||||
alertText = stringReference("Unavailable for pair"),
|
||||
alertText = resourceReference(R.string.express_provider_not_available),
|
||||
selectionType = ProviderState.SelectionType.NONE,
|
||||
)
|
||||
}
|
||||
|
|
@ -701,7 +706,7 @@ internal class StateBuilder(
|
|||
return listOf(
|
||||
FeeItemState.Content(
|
||||
feeType = this.normalFee.feeType,
|
||||
title = stringReference("Fee"), // todo replace with string
|
||||
title = resourceReference(R.string.common_fee_label),
|
||||
amountCrypto = this.normalFee.feeCryptoFormatted,
|
||||
symbolCrypto = this.normalFee.cryptoSymbol,
|
||||
amountFiatFormatted = this.normalFee.feeFiatFormatted,
|
||||
|
|
@ -710,7 +715,7 @@ internal class StateBuilder(
|
|||
),
|
||||
FeeItemState.Content(
|
||||
feeType = this.priorityFee.feeType,
|
||||
title = stringReference("Fee"), // todo replace with string
|
||||
title = resourceReference(R.string.common_fee_label),
|
||||
amountCrypto = this.priorityFee.feeCryptoFormatted,
|
||||
symbolCrypto = this.priorityFee.cryptoSymbol,
|
||||
amountFiatFormatted = this.priorityFee.feeFiatFormatted,
|
||||
|
|
@ -733,8 +738,9 @@ internal class StateBuilder(
|
|||
onProviderClick = onProviderSelect,
|
||||
selectionType = ProviderState.SelectionType.SELECT,
|
||||
)
|
||||
// todo handle error
|
||||
is SwapState.SwapError -> provider.convertToUnavailableProviderState(
|
||||
alertText = stringReference("Available from"),
|
||||
alertText = resourceReference(R.string.express_provider_min_amount, wrappedList("10")),
|
||||
selectionType = ProviderState.SelectionType.NONE,
|
||||
onProviderClick = onProviderSelect,
|
||||
)
|
||||
|
|
@ -765,15 +771,18 @@ internal class StateBuilder(
|
|||
fromToken: CryptoCurrency,
|
||||
onBuyClick: () -> Unit,
|
||||
): NotificationConfig {
|
||||
// todo add strings
|
||||
return NotificationConfig(
|
||||
title = stringReference("Unable to cover ${fromToken.name} fee"),
|
||||
subtitle = stringReference(
|
||||
"To make transaction you need to deposit some ${fromToken.name} ${fromToken.symbol}",
|
||||
title = resourceReference(
|
||||
R.string.warning_express_not_enough_fee_for_token_tx_title,
|
||||
wrappedList(fromToken.network.name),
|
||||
),
|
||||
subtitle = resourceReference(
|
||||
R.string.warning_express_not_enough_fee_for_token_tx_description,
|
||||
wrappedList(fromToken.network.name, fromToken.network.currencySymbol),
|
||||
),
|
||||
iconResId = fromToken.networkIconResId,
|
||||
buttonsState = NotificationConfig.ButtonsState.SecondaryButtonConfig(
|
||||
text = stringReference("Buy ${fromToken.name}"),
|
||||
text = resourceReference(R.string.common_buy_currency, wrappedList(fromToken.name)),
|
||||
onClick = onBuyClick,
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue