Updated on 2026-08-14

This commit is contained in:
Tangem 2025-07-01 22:11:33 +05:00
parent 2f160f54d9
commit fe1e883dd8
4 changed files with 15 additions and 6 deletions

View file

@ -26,7 +26,7 @@ internal sealed class WcAppInfoUM : TangemBottomSheetConfigContent {
val appSubtitle: String,
val notification: WcAppInfoSecurityNotification?,
val walletName: String,
val onWalletClick: () -> Unit,
val onWalletClick: (() -> Unit)?,
val networksInfo: WcNetworksInfo,
val onNetworksClick: () -> Unit,
override val connectButtonConfig: WcPrimaryButtonConfig,

View file

@ -20,6 +20,8 @@ import com.tangem.domain.walletconnect.model.WcSessionProposal
import com.tangem.domain.walletconnect.usecase.pair.WcPairState
import com.tangem.domain.walletconnect.usecase.pair.WcPairUseCase
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.domain.wallets.models.isLocked
import com.tangem.domain.wallets.models.isMultiCurrency
import com.tangem.domain.wallets.usecase.GetWalletsUseCase
import com.tangem.features.walletconnect.connections.components.WcPairComponent
import com.tangem.features.walletconnect.connections.components.WcSelectNetworksComponent
@ -38,6 +40,8 @@ internal interface WcPairComponentCallback :
WcSelectWalletComponent.ModelCallback,
WcSelectNetworksComponent.ModelCallback
private const val WC_WALLETS_SELECTOR_MIN_COUNT = 2
@Stable
@ModelScoped
internal class WcPairModel @Inject constructor(
@ -97,6 +101,8 @@ internal class WcPairModel @Inject constructor(
}
is WcPairState.Loading -> appInfoUiState.update { createLoadingState() }
is WcPairState.Proposal -> {
val availableWallets = pairState.dAppSession.proposalNetwork.keys
.filter { !it.isLocked && it.isMultiCurrency }
sessionProposal = pairState.dAppSession
proposalNetwork = sessionProposal.proposalNetwork.getValue(selectedUserWalletFlow.value)
additionallyEnabledNetworks = proposalNetwork.available
@ -110,7 +116,7 @@ internal class WcPairModel @Inject constructor(
stackNavigation.pushNew(
WcAppInfoRoutes.SelectWallet(selectedUserWalletFlow.value.walletId),
)
},
}.takeIf { availableWallets.size >= WC_WALLETS_SELECTOR_MIN_COUNT },
onNetworksClick = {
stackNavigation.pushNew(
WcAppInfoRoutes.SelectNetworks(

View file

@ -15,7 +15,7 @@ internal class WcAppInfoTransformer(
private val dAppVerifiedStateConverter: WcDAppVerifiedStateConverter,
private val onDismiss: () -> Unit,
private val onConnect: (securityStatus: CheckDAppResult) -> Unit,
private val onWalletClick: () -> Unit,
private val onWalletClick: (() -> Unit)?,
private val onNetworksClick: () -> Unit,
private val userWallet: UserWallet,
private val proposalNetwork: WcSessionProposal.ProposalNetwork,

View file

@ -34,6 +34,7 @@ import com.tangem.core.ui.components.bottomsheets.modal.TangemModalBottomSheetTi
import com.tangem.core.ui.components.bottomsheets.modal.TangemModalBottomSheetWithFooter
import com.tangem.core.ui.components.notifications.Notification
import com.tangem.core.ui.components.notifications.NotificationConfig
import com.tangem.core.ui.extensions.clickableSingle
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.extensions.stringResourceSafe
import com.tangem.core.ui.extensions.wrappedList
@ -253,9 +254,11 @@ private fun WcAppInfoSecondBlock(state: WcAppInfoUM.Content, modifier: Modifier
.fillMaxWidth()
.padding(TangemTheme.dimens.spacing12)
WalletRowItem(
modifier = Modifier
.clickable(onClick = state.onWalletClick)
.then(itemsModifier),
modifier = if (state.onWalletClick != null) {
Modifier.clickableSingle(onClick = state.onWalletClick)
} else {
Modifier
}.then(itemsModifier),
walletName = state.walletName,
)
HorizontalDivider(thickness = 1.dp, color = TangemTheme.colors.stroke.primary)