Updated on 2026-08-14
This commit is contained in:
parent
21a63d246b
commit
676936e073
3 changed files with 24 additions and 37 deletions
|
|
@ -36,7 +36,12 @@ import com.tangem.core.ui.utils.DEFAULT_ANIMATION_DURATION
|
|||
fun PasteButton(isPasteButtonVisible: Boolean, onClick: (String) -> Unit, modifier: Modifier = Modifier) {
|
||||
val clipboardManager = LocalClipboardManager.current
|
||||
val hapticFeedback = LocalHapticFeedback.current
|
||||
|
||||
val isPasteEnabled = !clipboardManager.getText()?.text.isNullOrEmpty()
|
||||
val color = if (isPasteEnabled) {
|
||||
TangemTheme.colors.button.primary
|
||||
} else {
|
||||
TangemTheme.colors.button.secondary
|
||||
}
|
||||
AnimatedVisibility(
|
||||
visible = isPasteButtonVisible,
|
||||
label = "Paste Button Visibility Animation",
|
||||
|
|
@ -50,7 +55,7 @@ fun PasteButton(isPasteButtonVisible: Boolean, onClick: (String) -> Unit, modifi
|
|||
color = TangemTheme.colors.text.primary2,
|
||||
modifier = Modifier
|
||||
.background(
|
||||
color = TangemTheme.colors.button.primary,
|
||||
color = color,
|
||||
shape = TangemTheme.shapes.roundedCornersXMedium,
|
||||
)
|
||||
.padding(
|
||||
|
|
@ -60,6 +65,7 @@ fun PasteButton(isPasteButtonVisible: Boolean, onClick: (String) -> Unit, modifi
|
|||
.clickable(
|
||||
interactionSource = remember { MutableInteractionSource() },
|
||||
indication = rememberRipple(radius = TangemTheme.dimens.radius8),
|
||||
enabled = isPasteEnabled,
|
||||
onClick = {
|
||||
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
|
||||
onClick(
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import com.tangem.features.send.impl.presentation.state.fee.FeeSelectorState
|
|||
import com.tangem.features.send.impl.presentation.state.fee.SendFeeNotification
|
||||
import com.tangem.features.send.impl.presentation.viewmodel.SendClickIntents
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
|
||||
private const val FEE_SELECTOR_KEY = "FEE_SELECTOR_KEY"
|
||||
private const val FEE_CUSTOM_KEY = "FEE_CUSTOM_KEY"
|
||||
|
|
@ -37,9 +36,8 @@ internal fun SendSpeedAndFeeContent(state: SendStates.FeeState?, clickIntents: S
|
|||
),
|
||||
) {
|
||||
feeSelector(state, clickIntents)
|
||||
topNotifications(notifications)
|
||||
customFee(feeSendState)
|
||||
middleNotifications(notifications)
|
||||
notifications(notifications)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -56,29 +54,6 @@ private fun LazyListScope.feeSelector(state: SendStates.FeeState, clickIntents:
|
|||
}
|
||||
}
|
||||
|
||||
private fun LazyListScope.topNotifications(
|
||||
configs: ImmutableList<SendFeeNotification>,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
notifications(
|
||||
configs = configs.filter {
|
||||
it is SendFeeNotification.Error.ExceedsBalance ||
|
||||
it is SendFeeNotification.Warning.NetworkFeeUnreachable
|
||||
}.toImmutableList(),
|
||||
modifier = modifier,
|
||||
)
|
||||
}
|
||||
|
||||
private fun LazyListScope.middleNotifications(
|
||||
configs: ImmutableList<SendFeeNotification>,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
notifications(
|
||||
configs = configs.filterIsInstance<SendFeeNotification.Warning.TooHigh>().toImmutableList(),
|
||||
modifier = modifier,
|
||||
)
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
private fun LazyListScope.notifications(
|
||||
configs: ImmutableList<SendFeeNotification>,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package com.tangem.features.send.impl.presentation.viewmodel
|
||||
|
||||
import androidx.compose.runtime.getValue
|
||||
|
|
@ -308,15 +307,22 @@ internal class SendViewModel @Inject constructor(
|
|||
coinCryptoCurrencyStatus = coinCurrencyStatus
|
||||
feeCryptoCurrencyStatus = feeCurrencyStatus
|
||||
|
||||
if (transactionId != null && amount != null && destinationAddress != null) {
|
||||
uiState = stateFactory.getReadyState(amount, destinationAddress)
|
||||
stateRouter.showFee()
|
||||
} else {
|
||||
getWalletsAndRecent()
|
||||
uiState = stateFactory.getReadyState()
|
||||
stateRouter.showRecipient()
|
||||
when {
|
||||
uiState.sendState.isSuccess -> {
|
||||
stateRouter.showSend()
|
||||
}
|
||||
transactionId != null && amount != null && destinationAddress != null -> {
|
||||
uiState = stateFactory.getReadyState(amount, destinationAddress)
|
||||
stateRouter.showFee()
|
||||
updateNotifications()
|
||||
}
|
||||
else -> {
|
||||
getWalletsAndRecent()
|
||||
uiState = stateFactory.getReadyState()
|
||||
stateRouter.showRecipient()
|
||||
updateNotifications()
|
||||
}
|
||||
}
|
||||
updateNotifications()
|
||||
}
|
||||
|
||||
private fun getWalletsAndRecent() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue