Updated on 2026-08-14

This commit is contained in:
Tangem 2025-08-04 14:50:59 +05:00
parent a2f10e3503
commit 5b2fb1b22c
3 changed files with 15 additions and 4 deletions

View file

@ -7,10 +7,12 @@ import com.tangem.utils.converter.Converter
internal object WcConnectButtonAvailabilityConverter : Converter<WcConnectButtonAvailabilityConverter.Input, Boolean> {
override fun convert(value: Input): Boolean {
val (missingNetworks, requiredNetworks, availableNetworks, selectedNetworks) = value
val missing = value.missingNetworks
val required = value.requiredNetworks
val available = value.availableNetworks
val selected = value.selectedNetworks
return missingNetworks.isEmpty() &&
(requiredNetworks.isNotEmpty() || availableNetworks.isNotEmpty() || selectedNetworks.isNotEmpty())
return missing.isEmpty() && (required.isNotEmpty() || available.isNotEmpty() || selected.isNotEmpty())
}
data class Input(

View file

@ -10,7 +10,11 @@ import kotlinx.collections.immutable.toImmutableList
@Suppress("DestructuringDeclarationWithTooManyEntries")
internal object WcNetworksInfoConverter : Converter<WcNetworksInfoConverter.Input, WcNetworksInfo> {
override fun convert(value: Input): WcNetworksInfo {
val (missing, required, available, notAdded, additionallyEnabled) = value
val missing = value.missingNetworks
val required = value.requiredNetworks
val available = value.availableNetworks
val notAdded = value.notAddedNetworks
val additionallyEnabled = value.additionallyEnabledNetworks
return when {
missing.isNotEmpty() -> WcNetworksInfo.MissingRequiredNetworkInfo(missing.joinToString { it.name })
required.isEmpty() && available.isEmpty() && notAdded.isNotEmpty() -> WcNetworksInfo.NoneNetworksAdded

View file

@ -90,6 +90,7 @@ internal class WcSendTransactionModel @Inject constructor(
private var wcApproval: WcApproval? = null
private var sign: () -> Unit = {}
private val feeReloadState = MutableStateFlow(false)
private val signatureReceivedAnalyticsSendState = MutableStateFlow(false)
init {
@Suppress("UnusedPrivateMember")
@ -373,6 +374,8 @@ internal class WcSendTransactionModel @Inject constructor(
useCase: WcSignUseCase<*>,
securityCheck: Lce<Throwable, BlockAidTransactionCheck.Result>,
) {
if (signatureReceivedAnalyticsSendState.value) return
val emulationStatus = when (securityCheck) {
is Lce.Content -> when (securityCheck.content.result.simulation) {
SimulationResult.FailedToSimulate -> EmulationStatus.CanNotEmulate
@ -389,5 +392,7 @@ internal class WcSendTransactionModel @Inject constructor(
emulationStatus = emulationStatus,
),
)
signatureReceivedAnalyticsSendState.value = true
}
}