Updated on 2026-08-14

This commit is contained in:
Tangem 2025-07-07 18:10:46 +05:00
parent b01b0ef4ca
commit 410ecb6fc0
14 changed files with 311 additions and 195 deletions

View file

@ -41,12 +41,14 @@ internal fun getWcCommonScreen(
val state = model.uiState.value ?: error("in this step state should be not null")
feeSelectorComponentFactory.create(
context = appComponentContext,
onDismiss = model::popBack,
params = FeeSelectorParams.FeeSelectorDetailsParams(
state = state.feeSelectorUM,
onLoadFee = model::loadFee,
cryptoCurrencyStatus = model.cryptoCurrencyStatus,
callback = model,
suggestedFeeState = model.suggestedFeeState,
feeDisplaySource = FeeSelectorParams.FeeDisplaySource.BottomSheet,
),
)
}

View file

@ -26,9 +26,10 @@ internal class WcSendTransactionComponent(
state = state.feeSelectorUM,
onLoadFee = model::loadFee,
cryptoCurrencyStatus = model.cryptoCurrencyStatus,
callback = model,
suggestedFeeState = model.suggestedFeeState,
feeDisplaySource = FeeSelectorParams.FeeDisplaySource.BottomSheet,
),
onResult = model::updateFee,
)
}

View file

@ -7,4 +7,6 @@ internal interface WcCommonTransactionModel {
val uiState: StateFlow<WcCommonTransactionUM?>
fun dismiss()
fun popBack()
}

View file

@ -67,6 +67,10 @@ internal class WcAddNetworkModel @Inject constructor(
_uiState.value?.transaction?.onDismiss?.invoke() ?: router.pop()
}
override fun popBack() {
router.pop()
}
fun showTransactionRequest() {
stackNavigation.pushNew(WcTransactionRoutes.TransactionRequestInfo)
}

View file

@ -118,7 +118,20 @@ internal class WcSendTransactionModel @Inject constructor(
}
}
/**
* Handles callback with updated [feeSelectorUM] from click FeeSelectorComponent.
* We need to trigger navigation to dismiss fee selector component
*/
override fun onFeeResult(feeSelectorUM: FeeSelectorUM) {
updateFee(feeSelectorUM)
popBack()
}
/**
* Handles fee updates.
* Also handles fee results from FeeSelectorBlockComponent
*/
fun updateFee(feeSelectorUM: FeeSelectorUM) {
_uiState.update { it?.copy(feeSelectorUM = feeSelectorUM) }
val fee = (feeSelectorUM as? FeeSelectorUM.Content)?.selectedFeeItem?.fee ?: return
(useCase as? WcMutableFee)?.updateFee(fee)
@ -186,6 +199,10 @@ internal class WcSendTransactionModel @Inject constructor(
_uiState.value?.transaction?.onDismiss?.invoke() ?: router.pop()
}
override fun popBack() {
stackNavigation.pop()
}
fun showTransactionRequest() {
stackNavigation.pushNew(WcTransactionRoutes.TransactionRequestInfo)
}

View file

@ -2,6 +2,7 @@ package com.tangem.features.walletconnect.transaction.model
import androidx.compose.runtime.Stable
import com.arkivanov.decompose.router.stack.StackNavigation
import com.arkivanov.decompose.router.stack.pop
import com.arkivanov.decompose.router.stack.pushNew
import com.tangem.core.decompose.di.ModelScoped
import com.tangem.core.decompose.model.Model
@ -76,6 +77,10 @@ internal class WcSignTransactionModel @Inject constructor(
_uiState.value?.transaction?.onDismiss?.invoke() ?: router.pop()
}
override fun popBack() {
stackNavigation.pop()
}
fun showTransactionRequest() {
stackNavigation.pushNew(WcTransactionRoutes.TransactionRequestInfo)
}