Updated on 2026-08-14
This commit is contained in:
parent
5a96d6e6c3
commit
07c4b49e53
3 changed files with 36 additions and 4 deletions
|
|
@ -8,6 +8,7 @@ data class WcConnectedAppInfoUM(
|
|||
val appIcon: String,
|
||||
val isVerified: Boolean,
|
||||
val verifiedDAppState: VerifiedDAppState,
|
||||
val notification: WcAppInfoSecurityNotification? = null,
|
||||
val appSubtitle: String,
|
||||
val walletName: String,
|
||||
val networks: ImmutableList<WcNetworkInfoItem.Required>,
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import com.tangem.features.walletconnect.connections.entity.VerifiedDAppState
|
|||
import com.tangem.features.walletconnect.connections.entity.WcConnectedAppInfoUM
|
||||
import com.tangem.features.walletconnect.connections.entity.WcNetworkInfoItem
|
||||
import com.tangem.features.walletconnect.connections.entity.WcPrimaryButtonConfig
|
||||
import com.tangem.features.walletconnect.connections.entity.WcAppInfoSecurityNotification
|
||||
import com.tangem.features.walletconnect.connections.model.transformers.WcAppSubtitleConverter
|
||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
|
|
@ -75,6 +76,7 @@ internal class WcConnectedAppInfoModel @Inject constructor(
|
|||
enabled = true,
|
||||
onClick = { disconnect(session) },
|
||||
),
|
||||
notification = extractNotificationInfo(session),
|
||||
onDismiss = ::dismiss,
|
||||
)
|
||||
}
|
||||
|
|
@ -82,6 +84,14 @@ internal class WcConnectedAppInfoModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun extractNotificationInfo(session: WcSession): WcAppInfoSecurityNotification? {
|
||||
return when (session.securityStatus) {
|
||||
CheckDAppResult.SAFE -> null
|
||||
CheckDAppResult.UNSAFE -> WcAppInfoSecurityNotification.SecurityRisk
|
||||
CheckDAppResult.FAILED_TO_VERIFY -> WcAppInfoSecurityNotification.UnknownDomain
|
||||
}
|
||||
}
|
||||
|
||||
private fun extractVerifiedState(session: WcSession): VerifiedDAppState {
|
||||
return if (session.securityStatus == CheckDAppResult.SAFE) {
|
||||
VerifiedDAppState.Verified(onVerifiedClick = {})
|
||||
|
|
|
|||
|
|
@ -21,14 +21,13 @@ import com.tangem.core.ui.components.SecondaryButton
|
|||
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
|
||||
import com.tangem.core.ui.components.bottomsheets.modal.TangemModalBottomSheet
|
||||
import com.tangem.core.ui.components.bottomsheets.modal.TangemModalBottomSheetTitle
|
||||
import com.tangem.core.ui.components.notifications.Notification
|
||||
import com.tangem.core.ui.extensions.resourceReference
|
||||
import com.tangem.core.ui.extensions.stringResourceSafe
|
||||
import com.tangem.core.ui.res.TangemColorPalette
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.features.walletconnect.connections.entity.VerifiedDAppState
|
||||
import com.tangem.features.walletconnect.connections.entity.WcConnectedAppInfoUM
|
||||
import com.tangem.features.walletconnect.connections.entity.WcNetworkInfoItem
|
||||
import com.tangem.features.walletconnect.connections.entity.WcPrimaryButtonConfig
|
||||
import com.tangem.features.walletconnect.connections.entity.*
|
||||
import com.tangem.features.walletconnect.impl.R
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
|
|
@ -73,6 +72,28 @@ private fun WcConnectedAppInfoBSContent(state: WcConnectedAppInfoUM, modifier: M
|
|||
.padding(top = 8.dp)
|
||||
.then(blocksModifier),
|
||||
)
|
||||
state.notification?.let { notification ->
|
||||
val (containerColor, titleColor, iconTint) = when (notification) {
|
||||
WcAppInfoSecurityNotification.SecurityRisk -> Triple(
|
||||
TangemColorPalette.Amaranth.copy(alpha = 0.1F),
|
||||
TangemTheme.colors.text.warning,
|
||||
TangemTheme.colors.icon.warning,
|
||||
)
|
||||
WcAppInfoSecurityNotification.UnknownDomain -> Triple(
|
||||
null,
|
||||
TangemTheme.colors.text.primary1,
|
||||
TangemTheme.colors.icon.attention,
|
||||
)
|
||||
}
|
||||
Notification(
|
||||
modifier = Modifier.padding(top = TangemTheme.dimens.spacing14),
|
||||
config = notification.config,
|
||||
containerColor = containerColor,
|
||||
titleColor = titleColor,
|
||||
subtitleColor = TangemTheme.colors.text.primary1,
|
||||
iconTint = iconTint,
|
||||
)
|
||||
}
|
||||
NetworksBlock(
|
||||
networks = state.networks,
|
||||
modifier = Modifier
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue