Updated on 2026-08-14
This commit is contained in:
parent
68fbe17731
commit
b7dc46ae64
7 changed files with 111 additions and 0 deletions
|
|
@ -30,6 +30,8 @@ import com.tangem.domain.walletconnect.usecase.method.*
|
|||
import com.tangem.domain.wallets.models.UserWallet
|
||||
import com.tangem.features.send.v2.api.callbacks.FeeSelectorModelCallback
|
||||
import com.tangem.features.send.v2.api.entity.FeeSelectorUM
|
||||
import com.tangem.features.send.v2.api.feeselector.FeeSelectorReloadData
|
||||
import com.tangem.features.send.v2.api.feeselector.FeeSelectorReloadTrigger
|
||||
import com.tangem.features.send.v2.api.params.FeeSelectorParams
|
||||
import com.tangem.features.walletconnect.connections.routing.WcInnerRoute
|
||||
import com.tangem.features.walletconnect.transaction.components.common.WcTransactionModelParams
|
||||
|
|
@ -53,6 +55,7 @@ import kotlin.properties.Delegates
|
|||
internal class WcSendTransactionModel @Inject constructor(
|
||||
paramsContainer: ParamsContainer,
|
||||
override val dispatchers: CoroutineDispatcherProvider,
|
||||
private val feeSelectorReloadTrigger: FeeSelectorReloadTrigger,
|
||||
private val router: Router,
|
||||
private val clipboardManager: ClipboardManager,
|
||||
private val useCaseFactory: WcRequestUseCaseFactory,
|
||||
|
|
@ -76,6 +79,7 @@ internal class WcSendTransactionModel @Inject constructor(
|
|||
private var signState: WcSignState<*> by Delegates.notNull()
|
||||
private var wcApproval: WcApproval? = null
|
||||
private var sign: () -> Unit = {}
|
||||
private val feeReloadState = MutableStateFlow(false)
|
||||
|
||||
init {
|
||||
@Suppress("UnusedPrivateMember")
|
||||
|
|
@ -116,6 +120,9 @@ internal class WcSendTransactionModel @Inject constructor(
|
|||
wcApproval = useCase as? WcApproval
|
||||
sign = { useCase.sign() }
|
||||
buildUiState(securityCheck, useCase, signState, isApprovalMethod)
|
||||
if (feeReloadState.value) {
|
||||
triggerFeeReload()
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> unknownMethodRunnable()
|
||||
|
|
@ -123,6 +130,13 @@ internal class WcSendTransactionModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun triggerFeeReload() {
|
||||
feeReloadState.value = false
|
||||
modelScope.launch {
|
||||
feeSelectorReloadTrigger.triggerUpdate(data = FeeSelectorReloadData(removeSuggestedFee = true))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles callback with updated [feeSelectorUM] from click FeeSelectorComponent.
|
||||
* We need to trigger navigation to dismiss fee selector component
|
||||
|
|
@ -242,6 +256,7 @@ internal class WcSendTransactionModel @Inject constructor(
|
|||
wcApproval?.getAmount()?.let { currentAmount ->
|
||||
wcApproval?.updateAmount(currentAmount.copy(amount = currentAmount.amount?.copy(value = newValue)))
|
||||
}
|
||||
feeReloadState.value = true
|
||||
}
|
||||
|
||||
fun onClickAllowToSpend() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue