diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/entity/WcAppInfoUM.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/entity/WcAppInfoUM.kt index e222f95e6d..5af3637df7 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/entity/WcAppInfoUM.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/entity/WcAppInfoUM.kt @@ -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, diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcPairModel.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcPairModel.kt index bf9adcb783..4b6d7923bb 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcPairModel.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcPairModel.kt @@ -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( diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/transformers/WcAppInfoTransformer.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/transformers/WcAppInfoTransformer.kt index 61d9f198d0..9de8083b7c 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/transformers/WcAppInfoTransformer.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/transformers/WcAppInfoTransformer.kt @@ -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, diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/ui/WcAppInfoBS.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/ui/WcAppInfoBS.kt index 9e2490c0f9..2cbc154342 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/ui/WcAppInfoBS.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/ui/WcAppInfoBS.kt @@ -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)