Updated on 2026-08-14
This commit is contained in:
parent
a8cab0ff83
commit
e374bc907d
13 changed files with 61 additions and 17 deletions
|
|
@ -96,6 +96,7 @@ internal class DefaultWcPairUseCase @AssistedInject constructor(
|
|||
securityStatus = proposalState.dAppSession.securityStatus,
|
||||
networks = sessionForApprove.network.toSet(),
|
||||
connectingTime = DateTime.now().millis,
|
||||
showWalletInfo = proposalState.dAppSession.proposalNetwork.keys.size > 1,
|
||||
)
|
||||
sessionsManager.saveSession(newSession)
|
||||
analytics.send(
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ internal class DefaultWcSessionsManager(
|
|||
securityStatus = storeSession.securityStatus,
|
||||
networks = networks,
|
||||
connectingTime = storeSession.connectingTime,
|
||||
showWalletInfo = wallets.size > 1,
|
||||
)
|
||||
}
|
||||
return wcSessions
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ internal class DefaultWcPairUseCaseTest {
|
|||
securityStatus = CheckDAppResult.SAFE,
|
||||
networks = setOf(),
|
||||
connectingTime = null,
|
||||
showWalletInfo = false,
|
||||
)
|
||||
|
||||
private fun useCaseFactory() = DefaultWcPairUseCase(
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ internal class WcSignUseCaseDelegateTest {
|
|||
redirect = "",
|
||||
),
|
||||
),
|
||||
showWalletInfo = false,
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -11,4 +11,5 @@ data class WcSession(
|
|||
val sdkModel: WcSdkSession,
|
||||
val securityStatus: CheckDAppResult,
|
||||
val connectingTime: Long?,
|
||||
val showWalletInfo: Boolean,
|
||||
)
|
||||
|
|
@ -39,7 +39,7 @@ internal class WcSendTransactionUMConverter @Inject constructor(
|
|||
),
|
||||
),
|
||||
feeState = constructFeeState(useCase = value.useCase, actions = value.actions),
|
||||
walletName = value.useCase.session.wallet.name,
|
||||
walletName = value.useCase.session.wallet.name.takeIf { value.useCase.session.showWalletInfo },
|
||||
networkInfo = networkInfoUMConverter.convert(value.useCase.network),
|
||||
address = value.useCase.walletAddress.toShortAddressText(),
|
||||
estimatedWalletChanges = WcSendReceiveTransactionCheckResultsUM(),
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ internal class WcSignTransactionUMConverter @Inject constructor(
|
|||
onShowVerifiedAlert = value.actions.onShowVerifiedAlert,
|
||||
),
|
||||
),
|
||||
walletName = value.useCase.session.wallet.name,
|
||||
walletName = value.useCase.session.wallet.name.takeIf { value.useCase.session.showWalletInfo },
|
||||
networkInfo = networkInfoUMConverter.convert(value.useCase.network),
|
||||
isLoading = value.signState.domainStep == WcSignStep.Signing,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ internal class WcSignTypedDataUMConverter @Inject constructor(
|
|||
onShowVerifiedAlert = value.actions.onShowVerifiedAlert,
|
||||
),
|
||||
),
|
||||
walletName = value.useCase.session.wallet.name,
|
||||
walletName = value.useCase.session.wallet.name.takeIf { value.useCase.session.showWalletInfo },
|
||||
networkInfo = networkInfoUMConverter.convert(value.useCase.network),
|
||||
addressText = value.useCase.walletAddress.toShortAddressText(),
|
||||
isLoading = value.signState.domainStep == WcSignStep.Signing,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ internal data class WcSendTransactionItemUM(
|
|||
val onSend: () -> Unit,
|
||||
val appInfo: WcTransactionAppInfoContentUM,
|
||||
val estimatedWalletChanges: WcSendReceiveTransactionCheckResultsUM?,
|
||||
val walletName: String,
|
||||
val walletName: String?,
|
||||
val networkInfo: WcNetworkInfoUM,
|
||||
val address: String? = null,
|
||||
val isLoading: Boolean = false,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ internal data class WcSignTransactionItemUM(
|
|||
val onDismiss: () -> Unit,
|
||||
val onSign: () -> Unit,
|
||||
val appInfo: WcTransactionAppInfoContentUM,
|
||||
val walletName: String,
|
||||
val walletName: String?,
|
||||
val networkInfo: WcNetworkInfoUM,
|
||||
val addressText: String? = null,
|
||||
val isLoading: Boolean = false,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import com.tangem.features.walletconnect.transaction.entity.common.WcTransaction
|
|||
|
||||
@Composable
|
||||
internal fun WcSendTransactionItems(
|
||||
walletName: String,
|
||||
walletName: String?,
|
||||
networkInfo: WcNetworkInfoUM,
|
||||
feeState: WcTransactionFeeState,
|
||||
feeSelectorBlockComponent: FeeSelectorBlockComponent?,
|
||||
|
|
@ -44,11 +44,13 @@ internal fun WcSendTransactionItems(
|
|||
.fillMaxWidth()
|
||||
.padding(TangemTheme.dimens.spacing12)
|
||||
|
||||
WcWalletItem(
|
||||
modifier = itemsModifier,
|
||||
walletName = walletName,
|
||||
)
|
||||
DividerWithPadding(start = TangemTheme.dimens.spacing40, end = TangemTheme.dimens.spacing12)
|
||||
if (walletName != null) {
|
||||
WcWalletItem(
|
||||
modifier = itemsModifier,
|
||||
walletName = walletName,
|
||||
)
|
||||
DividerWithPadding(start = TangemTheme.dimens.spacing40, end = TangemTheme.dimens.spacing12)
|
||||
}
|
||||
WcNetworkItem(
|
||||
modifier = itemsModifier,
|
||||
networkInfo = networkInfo,
|
||||
|
|
|
|||
|
|
@ -197,5 +197,40 @@ private class WcSendTransactionStateProvider : CollectionPreviewParameterProvide
|
|||
feeState = WcTransactionFeeState.Success(null, {}),
|
||||
address = "0x345FF...34FA",
|
||||
),
|
||||
WcSendTransactionItemUM(
|
||||
onDismiss = {},
|
||||
onSend = {},
|
||||
appInfo = WcTransactionAppInfoContentUM(
|
||||
appName = "React App",
|
||||
appIcon = "",
|
||||
verifiedState = VerifiedDAppState.Verified {},
|
||||
appSubtitle = "react-app.walletconnect.com",
|
||||
),
|
||||
estimatedWalletChanges = WcSendReceiveTransactionCheckResultsUM(
|
||||
notificationText = TextReference.Str(
|
||||
"The transaction approves erc20 tokens to a known malicious address",
|
||||
),
|
||||
estimatedWalletChanges = WcEstimatedWalletChangesUM(
|
||||
items = persistentListOf(
|
||||
WcEstimatedWalletChangeUM(
|
||||
iconRes = R.drawable.ic_send_new_24,
|
||||
title = resourceReference(R.string.common_send),
|
||||
description = "- 42 USDT",
|
||||
tokenIconUrl = "https://tangem.com",
|
||||
),
|
||||
WcEstimatedWalletChangeUM(
|
||||
iconRes = R.drawable.ic_receive_new_24,
|
||||
title = resourceReference(R.string.common_receive),
|
||||
description = "+ 1,131.46 MATIC",
|
||||
tokenIconUrl = "https://tangem.com",
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
walletName = null,
|
||||
networkInfo = WcNetworkInfoUM(name = "Ethereum", iconRes = R.drawable.img_eth_22),
|
||||
feeState = WcTransactionFeeState.None,
|
||||
address = "0x345FF...34FA",
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
@ -113,11 +113,13 @@ private fun WcSignTransactionItems(state: WcSignTransactionItemUM, modifier: Mod
|
|||
.fillMaxWidth()
|
||||
.padding(12.dp)
|
||||
|
||||
WcWalletItem(
|
||||
modifier = itemsModifier,
|
||||
walletName = state.walletName,
|
||||
)
|
||||
DividerWithPadding(start = 40.dp, end = 12.dp)
|
||||
if (state.walletName != null) {
|
||||
WcWalletItem(
|
||||
modifier = itemsModifier,
|
||||
walletName = state.walletName,
|
||||
)
|
||||
DividerWithPadding(start = 40.dp, end = 12.dp)
|
||||
}
|
||||
WcNetworkItem(
|
||||
modifier = itemsModifier,
|
||||
networkInfo = state.networkInfo,
|
||||
|
|
@ -190,7 +192,7 @@ private class WcSignTransactionStateProvider : CollectionPreviewParameterProvide
|
|||
verifiedState = VerifiedDAppState.Verified {},
|
||||
appSubtitle = "react-app.walletconnect.com",
|
||||
),
|
||||
walletName = "Tangem 2.0",
|
||||
walletName = null,
|
||||
addressText = "0x345FF...34FA",
|
||||
networkInfo = WcNetworkInfoUM(name = "Ethereum", iconRes = R.drawable.img_eth_22),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue