Updated on 2026-08-14

This commit is contained in:
Tangem 2025-07-08 13:30:51 +05:00
parent 01d7f7221e
commit 48180a9b38
3 changed files with 21 additions and 4 deletions

View file

@ -43,6 +43,7 @@ import com.tangem.features.send.v2.api.entity.PredefinedValues
import com.tangem.features.send.v2.api.subcomponents.destination.SendDestinationComponent
import com.tangem.features.send.v2.api.subcomponents.destination.entity.DestinationUM
import com.tangem.features.send.v2.common.CommonSendRoute
import com.tangem.domain.wallets.models.GetUserWalletError
import com.tangem.features.send.v2.common.SendConfirmAlertFactory
import com.tangem.features.send.v2.common.ui.state.ConfirmUM
import com.tangem.features.send.v2.send.confirm.SendConfirmComponent
@ -157,6 +158,11 @@ internal class SendModel @Inject constructor(
params.callback?.onConvertToAnotherToken(lastAmount = lastAmount)
}
override fun onError(error: GetUserWalletError) {
Timber.w(error.toString())
showAlertError()
}
suspend fun loadFee(): Either<GetFeeError, TransactionFee> {
val predefinedValues = predefinedValues
val transferTransaction = if (predefinedValues is PredefinedValues.Content.Deeplink) {

View file

@ -9,6 +9,7 @@ import com.tangem.common.ui.navigationButtons.NavigationModelCallback
import com.tangem.core.decompose.context.AppComponentContext
import com.tangem.core.decompose.model.getOrCreateModel
import com.tangem.core.ui.decompose.ComposableContentComponent
import com.tangem.domain.wallets.models.GetUserWalletError
import com.tangem.features.send.v2.subcomponents.amount.SendAmountComponentParams.AmountParams
import com.tangem.features.send.v2.subcomponents.amount.model.SendAmountModel
import com.tangem.features.send.v2.subcomponents.amount.ui.SendAmountContent
@ -39,5 +40,6 @@ internal class SendAmountComponent(
interface ModelCallback : NavigationModelCallback {
fun onAmountResult(amountUM: AmountState, isResetPredefined: Boolean)
fun onConvertToAnotherToken(lastAmount: String)
fun onError(error: GetUserWalletError)
}
}

View file

@ -85,10 +85,19 @@ internal class SendAmountModel @Inject constructor(
}
private fun initAppCurrency() {
modelScope.launch {
userWallet = getUserWalletUseCase(params.userWalletId).getOrNull()
appCurrency = getSelectedAppCurrencyUseCase.invokeSync().getOrElse { AppCurrency.Default }
}
getUserWalletUseCase.invokeFlow(params.userWalletId)
.onEach { either ->
either.fold(
ifLeft = { error ->
val amountParams = params as? SendAmountComponentParams.AmountParams
amountParams?.callback?.onError(error)
},
ifRight = { wallet ->
userWallet = wallet
appCurrency = getSelectedAppCurrencyUseCase.invokeSync().getOrElse { AppCurrency.Default }
},
)
}.launchIn(modelScope)
}
private fun subscribeOnCryptoCurrencyStatusFlow() {