Updated on 2026-08-14
This commit is contained in:
parent
63b07cccc3
commit
7f3ae26151
11 changed files with 145 additions and 54 deletions
|
|
@ -21,6 +21,7 @@ import com.tangem.domain.feedback.SendFeedbackEmailUseCase
|
|||
import com.tangem.domain.feedback.models.FeedbackEmailType
|
||||
import com.tangem.domain.feedback.models.WalletMetaInfo
|
||||
import com.tangem.domain.models.TokenReceiveConfig
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.pay.TangemPayCryptoCurrencyFactory
|
||||
import com.tangem.domain.pay.model.TangemPayCardBalance
|
||||
import com.tangem.domain.pay.model.TangemPayTopUpData
|
||||
|
|
@ -258,18 +259,9 @@ internal class TangemPayDetailsModel @Inject constructor(
|
|||
.getOrNull()
|
||||
}
|
||||
if (currency != null) {
|
||||
router.push(
|
||||
AppRoute.Swap(
|
||||
currencyFrom = currency,
|
||||
userWalletId = params.userWalletId,
|
||||
isInitialReverseOrder = false,
|
||||
screenSource = AnalyticsParam.ScreensSources.TangemPay.value,
|
||||
tangemPayInput = AppRoute.Swap.TangemPayInput(
|
||||
cryptoAmount = currentBalance.availableForWithdrawal,
|
||||
fiatAmount = currentBalance.availableForWithdrawal,
|
||||
depositAddress = depositAddress,
|
||||
isWithdrawal = true,
|
||||
),
|
||||
uiMessageSender.send(
|
||||
message = TangemPayMessagesFactory.createWithdrawWarning(
|
||||
onGotItClick = { onConfirmWithdrawal(currency, currentBalance, depositAddress) },
|
||||
),
|
||||
)
|
||||
} else {
|
||||
|
|
@ -280,6 +272,27 @@ internal class TangemPayDetailsModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun onConfirmWithdrawal(
|
||||
currency: CryptoCurrency,
|
||||
currentBalance: TangemPayCardBalance,
|
||||
depositAddress: String,
|
||||
) {
|
||||
router.push(
|
||||
AppRoute.Swap(
|
||||
currencyFrom = currency,
|
||||
userWalletId = params.userWalletId,
|
||||
isInitialReverseOrder = false,
|
||||
screenSource = AnalyticsParam.ScreensSources.TangemPay.value,
|
||||
tangemPayInput = AppRoute.Swap.TangemPayInput(
|
||||
cryptoAmount = currentBalance.availableForWithdrawal,
|
||||
fiatAmount = currentBalance.availableForWithdrawal,
|
||||
depositAddress = depositAddress,
|
||||
isWithdrawal = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
private fun fetchBalance(): Job {
|
||||
return modelScope.launch {
|
||||
val result = try {
|
||||
|
|
|
|||
|
|
@ -94,4 +94,23 @@ internal object TangemPayMessagesFactory {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun createWithdrawWarning(onGotItClick: () -> Unit): BottomSheetMessageV2 {
|
||||
return bottomSheetMessage {
|
||||
infoBlock {
|
||||
icon(R.drawable.img_attention_20) {
|
||||
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.Attention
|
||||
}
|
||||
title = TextReference.Res(R.string.tangempay_withdrawal_note_title)
|
||||
body = TextReference.Res(R.string.tangempay_withdrawal_note_description)
|
||||
}
|
||||
primaryButton {
|
||||
text = resourceReference(R.string.common_got_it)
|
||||
onClick {
|
||||
onGotItClick()
|
||||
closeBs()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue