Updated on 2026-08-14

This commit is contained in:
Tangem 2026-03-16 12:58:48 +05:00
parent 16a83cf56d
commit 9fb5124c38
30 changed files with 528 additions and 801 deletions

View file

@ -10,10 +10,10 @@ import com.tangem.core.decompose.di.GlobalUiMessageSender
import com.tangem.core.decompose.ui.UiMessageSender
import com.tangem.core.ui.R
import com.tangem.core.ui.coil.ImagePreloader
import com.tangem.core.ui.components.bottomsheets.message.*
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.message.BottomSheetMessage
import com.tangem.core.ui.message.EventMessageAction
import com.tangem.core.ui.message.SnackbarMessage
import com.tangem.core.ui.message.bottomSheetMessage
import com.tangem.datasource.api.common.config.managers.ApiConfigsManager
import com.tangem.domain.appcurrency.FetchAppCurrenciesUseCase
import com.tangem.domain.balancehiding.BalanceHidingSettings
@ -216,30 +216,28 @@ internal class MainViewModel @Inject constructor(
if (!settings.isUpdateFromToast) {
listenToFlipsUseCase.changeUpdateEnabled(false)
val message = BottomSheetMessage.invoke(
iconResId = R.drawable.ic_eye_off_outline_24,
title = resourceReference(R.string.balance_hidden_title),
message = resourceReference(R.string.balance_hidden_description),
onDismissRequest = ::onBottomSheetDismissed,
firstActionBuilder = {
EventMessageAction(
title = resourceReference(R.string.balance_hidden_got_it_button),
onClick = {
onHiddenBalanceNotificationAction(isPermanent = false)
onDismissRequest()
},
)
},
secondActionBuilder = {
EventMessageAction(
title = resourceReference(R.string.balance_hidden_do_not_show_button),
onClick = {
onHiddenBalanceNotificationAction(isPermanent = true)
onDismissRequest()
},
)
},
)
val message = bottomSheetMessage {
infoBlock {
title = resourceReference(R.string.balance_hidden_title)
body = resourceReference(R.string.balance_hidden_description)
icon(R.drawable.ic_eye_off_outline_24)
}
onDismiss { onBottomSheetDismissed() }
primaryButton {
text = resourceReference(R.string.balance_hidden_got_it_button)
onClick = {
onHiddenBalanceNotificationAction(isPermanent = false)
closeBs()
}
}
secondaryButton {
text = resourceReference(R.string.balance_hidden_do_not_show_button)
onClick = {
onHiddenBalanceNotificationAction(isPermanent = true)
closeBs()
}
}
}
messageSender.send(message)
}
}

View file

@ -1,156 +1,293 @@
package com.tangem.core.ui.components.bottomsheets.message
import android.content.res.Configuration
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.material3.Icon
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import androidx.compose.ui.unit.dp
import androidx.compose.ui.util.fastForEach
import com.tangem.core.ui.R
import com.tangem.core.ui.components.PrimaryButton
import com.tangem.core.ui.components.SecondaryButton
import com.tangem.core.ui.components.bottomsheets.sheet.TangemBottomSheet
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
import com.tangem.core.ui.extensions.isNullOrEmpty
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUM.Button.IconOrder
import com.tangem.core.ui.components.bottomsheets.modal.TangemModalBottomSheet
import com.tangem.core.ui.components.bottomsheets.modal.TangemModalBottomSheetTitle
import com.tangem.core.ui.components.buttons.common.TangemButton
import com.tangem.core.ui.components.buttons.common.TangemButtonIconPosition
import com.tangem.core.ui.components.buttons.common.TangemButtonsDefaults
import com.tangem.core.ui.components.icons.HighlightedIcon
import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.resolveAnnotatedReference
import com.tangem.core.ui.extensions.resolveReference
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toPersistentList
@Composable
fun MessageBottomSheet(config: TangemBottomSheetConfig) {
TangemBottomSheet(config) { notification: MessageBottomSheetUM ->
Content(model = notification)
fun MessageBottomSheet(state: MessageBottomSheetUM, onDismissRequest: () -> Unit) {
val stateWithOnDismiss = remember(state) {
state.copy(
onDismissRequest = {
state.onDismissRequest.invoke()
onDismissRequest()
},
)
}
val config = TangemBottomSheetConfig(
isShown = true,
content = stateWithOnDismiss,
onDismissRequest = stateWithOnDismiss.onDismissRequest,
)
TangemModalBottomSheet(
config = config,
title = {
TangemModalBottomSheetTitle(
endIconRes = R.drawable.ic_close_24,
onEndClick = stateWithOnDismiss.onDismissRequest,
)
},
content = { content: MessageBottomSheetUM -> MessageBottomSheetContent(content) },
)
}
@Composable
fun MessageBottomSheetContent(state: MessageBottomSheetUM, modifier: Modifier = Modifier) {
Column(modifier = modifier) {
state.elements.fastForEach { element ->
when (element) {
is MessageBottomSheetUM.InfoBlock -> {
ContentContainer(
modifier = Modifier
.heightIn(min = TangemTheme.dimens.size180)
.fillMaxWidth()
.padding(horizontal = TangemTheme.dimens.spacing16)
.padding(bottom = 32.dp),
state = element,
)
}
else -> Unit
}
}
ButtonsContainer(
modifier = Modifier.fillMaxWidth(),
closeScope = state.closeScope,
buttons = state.elements.filterIsInstance<MessageBottomSheetUM.Button>().toPersistentList(),
)
}
}
@Composable
internal fun Content(model: MessageBottomSheetUM, modifier: Modifier = Modifier) {
Column(
modifier = modifier.padding(horizontal = 16.dp),
verticalArrangement = Arrangement.spacedBy(40.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Box(modifier = Modifier)
if (model.iconResId != null) {
Icon(
modifier = Modifier.size(48.dp),
painter = painterResource(model.iconResId),
tint = TangemTheme.colors.icon.primary1,
contentDescription = null,
private fun ContentContainer(state: MessageBottomSheetUM.InfoBlock, modifier: Modifier = Modifier) {
Column(modifier = modifier, horizontalAlignment = Alignment.CenterHorizontally) {
BottomSheetIconContainer(state.icon, state.iconImage)
state.title?.let { title ->
Text(
modifier = Modifier
.fillMaxWidth()
.padding(top = TangemTheme.dimens.spacing24),
text = title.resolveReference(),
style = TangemTheme.typography.h3,
color = TangemTheme.colors.text.primary1,
textAlign = TextAlign.Center,
)
}
Column(
modifier = Modifier
.padding(horizontal = 16.dp)
.fillMaxWidth(),
verticalArrangement = Arrangement.spacedBy(16.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
if (!model.title.isNullOrEmpty()) {
Text(
text = model.title.resolveReference(),
style = TangemTheme.typography.h2,
color = TangemTheme.colors.text.primary1,
textAlign = TextAlign.Center,
)
}
state.body?.let { body ->
Text(
text = model.message.resolveReference(),
modifier = Modifier
.fillMaxWidth()
.padding(top = TangemTheme.dimens.spacing8),
text = body.resolveAnnotatedReference(),
style = TangemTheme.typography.body2,
color = TangemTheme.colors.text.secondary,
textAlign = TextAlign.Center,
)
}
Column(
modifier = Modifier
.padding(bottom = 16.dp)
.fillMaxWidth(),
verticalArrangement = Arrangement.spacedBy(12.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
if (model.primaryAction != null) {
PrimaryButton(
modifier = Modifier.fillMaxWidth(),
text = model.primaryAction.text.resolveReference(),
enabled = model.primaryAction.isEnabled,
onClick = model.primaryAction.onClick,
)
}
if (model.secondaryAction != null) {
SecondaryButton(
modifier = Modifier.fillMaxWidth(),
text = model.secondaryAction.text.resolveReference(),
enabled = model.secondaryAction.isEnabled,
onClick = model.secondaryAction.onClick,
)
}
state.chip?.let { chip ->
BottomSheetChip(
modifier = Modifier.padding(top = TangemTheme.dimens.spacing16),
chip = chip,
)
}
}
}
// region Preview
@Composable
@Preview(showBackground = true, widthDp = 360)
@Preview(showBackground = true, widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES)
private fun Preview_NotificationBottomSheet(
@PreviewParameter(MessageBottomSheetUMPreviewProvider::class) params: MessageBottomSheetUM,
private fun BottomSheetIconContainer(
icon: MessageBottomSheetUM.Icon?,
iconImage: MessageBottomSheetUM.IconImage?,
modifier: Modifier = Modifier,
) {
TangemThemePreview {
MessageBottomSheet(
config = TangemBottomSheetConfig(
content = params,
isShown = true,
onDismissRequest = {},
),
if (icon != null) {
BottomSheetIcon(icon, modifier)
} else if (iconImage != null) {
Image(
modifier = modifier
.size(TangemTheme.dimens.size56)
.clip(CircleShape),
painter = painterResource(id = iconImage.res),
contentDescription = null,
)
}
}
private class MessageBottomSheetUMPreviewProvider : PreviewParameterProvider<MessageBottomSheetUM> {
val balancesHiddenMessage = MessageBottomSheetUM(
iconResId = R.drawable.ic_eye_off_outline_24,
title = resourceReference(R.string.balance_hidden_title),
message = resourceReference(R.string.balance_hidden_description),
primaryAction = MessageBottomSheetUM.ActionUM(
text = resourceReference(R.string.balance_hidden_got_it_button),
onClick = {},
),
secondaryAction = MessageBottomSheetUM.ActionUM(
text = resourceReference(R.string.balance_hidden_do_not_show_button),
onClick = {},
),
)
@Composable
private fun BottomSheetIcon(icon: MessageBottomSheetUM.Icon, modifier: Modifier = Modifier) {
val tint = when (icon.type) {
MessageBottomSheetUM.Icon.Type.Unspecified -> Color.Unspecified
MessageBottomSheetUM.Icon.Type.Accent -> TangemTheme.colors.icon.accent
MessageBottomSheetUM.Icon.Type.Informative -> TangemTheme.colors.icon.informative
MessageBottomSheetUM.Icon.Type.Attention -> TangemTheme.colors.icon.attention
MessageBottomSheetUM.Icon.Type.Warning -> TangemTheme.colors.icon.warning
}
override val values: Sequence<MessageBottomSheetUM>
get() = sequenceOf(
balancesHiddenMessage,
balancesHiddenMessage.copy(title = null),
balancesHiddenMessage.copy(iconResId = null),
balancesHiddenMessage.copy(primaryAction = null),
balancesHiddenMessage.copy(secondaryAction = null),
balancesHiddenMessage.copy(
primaryAction = null,
secondaryAction = null,
),
balancesHiddenMessage.copy(
title = null,
iconResId = null,
primaryAction = null,
secondaryAction = null,
),
)
val backgroundColor = when (icon.backgroundType) {
MessageBottomSheetUM.Icon.BackgroundType.Unspecified -> TangemTheme.colors.icon.informative
MessageBottomSheetUM.Icon.BackgroundType.SameAsTint -> tint
MessageBottomSheetUM.Icon.BackgroundType.Accent -> TangemTheme.colors.icon.accent
MessageBottomSheetUM.Icon.BackgroundType.Informative -> TangemTheme.colors.icon.informative
MessageBottomSheetUM.Icon.BackgroundType.Attention -> TangemTheme.colors.icon.attention
MessageBottomSheetUM.Icon.BackgroundType.Warning -> TangemTheme.colors.icon.warning
}
HighlightedIcon(
modifier = modifier,
icon = icon.res,
iconTint = tint,
backgroundColor = backgroundColor,
)
}
// endregion Preview
@Composable
private fun BottomSheetChip(chip: MessageBottomSheetUM.Chip, modifier: Modifier = Modifier) {
val color = when (chip.type) {
MessageBottomSheetUM.Chip.Type.Unspecified -> TangemTheme.colors.text.primary1
MessageBottomSheetUM.Chip.Type.Warning -> TangemTheme.colors.text.warning
}
Text(
modifier = modifier
.background(
shape = RoundedCornerShape(TangemTheme.dimens.radius16),
color = color.copy(alpha = 0.1F),
)
.padding(vertical = TangemTheme.dimens.spacing4, horizontal = TangemTheme.dimens.spacing12),
text = chip.text.resolveReference(),
style = TangemTheme.typography.caption1,
color = color,
)
}
@Suppress("LongMethod")
@Composable
private fun ButtonsContainer(
buttons: ImmutableList<MessageBottomSheetUM.Button>,
closeScope: MessageBottomSheetUM.CloseScope,
modifier: Modifier = Modifier,
) {
Column(
modifier = modifier.padding(all = TangemTheme.dimens.spacing16),
verticalArrangement = Arrangement.spacedBy(TangemTheme.dimens.spacing8),
) {
buttons.fastForEach { button ->
val icon = button.icon?.let { iconResId ->
when (button.iconOrder) {
IconOrder.Start -> TangemButtonIconPosition.Start(iconResId)
IconOrder.End -> TangemButtonIconPosition.End(iconResId)
}
} ?: TangemButtonIconPosition.None
TangemButton(
modifier = Modifier.fillMaxWidth(),
text = button.text?.resolveReference().orEmpty(),
icon = icon,
onClick = { button.onClick?.invoke(closeScope) },
colors = if (button.isPrimary) {
TangemButtonsDefaults.primaryButtonColors
} else {
TangemButtonsDefaults.secondaryButtonColors
},
enabled = true,
showProgress = false,
textStyle = TangemTheme.typography.subtitle1,
)
}
}
}
@Preview(showBackground = true, widthDp = 360)
@Preview(showBackground = true, widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
private fun Preview() {
TangemThemePreview {
MessageBottomSheet(
messageBottomSheetUM {
infoBlock {
icon(R.drawable.img_knight_shield_32) {
type = MessageBottomSheetUM.Icon.Type.Attention
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.SameAsTint
}
title = TextReference.Str("Title Title Title")
body = TextReference.Str("Body")
chip(text = TextReference.Str("Some chip information"))
}
primaryButton {
text = TextReference.Str("Test")
icon = R.drawable.ic_tangem_24
}
secondaryButton {
icon = R.drawable.ic_tangem_24
text = TextReference.Str("asdasd")
onClick {
closeBs()
}
}
},
onDismissRequest = {},
)
}
}
@Preview(showBackground = true, widthDp = 360)
@Preview(showBackground = true, widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
private fun Preview2() {
TangemThemePreview {
MessageBottomSheet(
messageBottomSheetUM {
infoBlock {
iconImage = MessageBottomSheetUM.IconImage(R.drawable.img_visa_notification)
title = TextReference.Str("Title Title Title")
body = TextReference.Str("Body")
chip(text = TextReference.Str("Some chip information"))
}
primaryButton {
text = TextReference.Str("Test")
icon = R.drawable.ic_tangem_24
}
secondaryButton {
icon = R.drawable.ic_tangem_24
text = TextReference.Str("asdasd")
onClick {
closeBs()
}
}
},
onDismissRequest = {},
)
}
}

View file

@ -1,20 +1,143 @@
package com.tangem.core.ui.components.bottomsheets.message
import androidx.annotation.DrawableRes
import androidx.compose.runtime.Immutable
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent
import com.tangem.core.ui.extensions.TextReference
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toPersistentList
@Immutable
data class MessageBottomSheetUM(
@DrawableRes val iconResId: Int?,
val title: TextReference?,
val message: TextReference,
val primaryAction: ActionUM?,
val secondaryAction: ActionUM?,
var elements: ImmutableList<Element> = persistentListOf(),
var onDismissRequest: () -> Unit = {},
) : TangemBottomSheetConfigContent {
data class ActionUM(
val text: TextReference,
val isEnabled: Boolean = true,
val onClick: () -> Unit,
)
}
@Immutable
inner class CloseScope {
fun closeBs() {
onDismissRequest()
}
}
val closeScope = CloseScope()
@Immutable
sealed interface Element
@Immutable
data class Icon(
@DrawableRes internal var res: Int,
var type: Type = Type.Unspecified,
var backgroundType: BackgroundType = BackgroundType.Unspecified,
) : Element {
enum class Type {
Unspecified, Accent, Informative, Attention, Warning,
}
enum class BackgroundType {
Unspecified, SameAsTint, Accent, Informative, Attention, Warning,
}
}
@Immutable
data class IconImage(@DrawableRes internal var res: Int) : Element
@Immutable
data class Chip(
internal var text: TextReference,
var type: Type = Type.Unspecified,
) : Element {
enum class Type {
Unspecified, Warning
}
}
@Immutable
data class InfoBlock(
internal var icon: Icon? = null,
internal var iconImage: IconImage? = null,
internal var chip: Chip? = null,
var title: TextReference? = null,
var body: TextReference? = null,
) : Element
@Immutable
data class Button(
internal var isPrimary: Boolean = false,
var text: TextReference? = null,
@DrawableRes internal var iconInternal: Int? = null,
internal var iconOrder: IconOrder = IconOrder.Start,
var onClick: (CloseScope.() -> Unit)? = null,
) : Element {
var icon: Int? = iconInternal
set(value) {
iconOrder = if (text == null) {
IconOrder.Start
} else {
IconOrder.End
}
field = value
}
enum class IconOrder {
Start, End
}
}
}
@Target(AnnotationTarget.TYPE)
@DslMarker
annotation class MessageBottomSheetDsl
// region: DSL
fun messageBottomSheetUM(init: @MessageBottomSheetDsl MessageBottomSheetUM.() -> Unit) =
MessageBottomSheetUM().apply(init)
fun MessageBottomSheetUM.onDismiss(block: () -> Unit) = apply { onDismissRequest = block }
@Suppress("NestedScopeFunctions")
fun MessageBottomSheetUM.infoBlock(init: @MessageBottomSheetDsl MessageBottomSheetUM.InfoBlock.() -> Unit) = apply {
val element = MessageBottomSheetUM.InfoBlock().apply(init)
elements = (elements + element).toPersistentList()
}
@Suppress("NestedScopeFunctions")
fun MessageBottomSheetUM.InfoBlock.icon(@DrawableRes res: Int, init: MessageBottomSheetUM.Icon.() -> Unit = {}) =
apply {
icon = MessageBottomSheetUM.Icon(res).apply(init)
}
fun MessageBottomSheetUM.InfoBlock.iconImage(@DrawableRes res: Int) = apply {
iconImage = MessageBottomSheetUM.IconImage(res)
}
@Suppress("NestedScopeFunctions")
fun MessageBottomSheetUM.InfoBlock.chip(text: TextReference, init: MessageBottomSheetUM.Chip.() -> Unit = {}) = apply {
chip = MessageBottomSheetUM.Chip(text).apply(init)
}
@Suppress("NestedScopeFunctions")
internal fun MessageBottomSheetUM.button(init: @MessageBottomSheetDsl MessageBottomSheetUM.Button.() -> Unit) = apply {
val element = MessageBottomSheetUM.Button().apply(init)
elements = (elements + element).toPersistentList()
}
@Suppress("NestedScopeFunctions")
fun MessageBottomSheetUM.primaryButton(init: @MessageBottomSheetDsl MessageBottomSheetUM.Button.() -> Unit) = apply {
button { isPrimary = true; apply(init) }
}
@Suppress("NestedScopeFunctions")
fun MessageBottomSheetUM.secondaryButton(init: @MessageBottomSheetDsl MessageBottomSheetUM.Button.() -> Unit) = apply {
button { isPrimary = false; apply(init) }
}
fun MessageBottomSheetUM.Button.onClick(block: MessageBottomSheetUM.CloseScope.() -> Unit) = apply {
onClick = block
}
// endregion

View file

@ -1,142 +0,0 @@
package com.tangem.core.ui.components.bottomsheets.message
import androidx.annotation.DrawableRes
import androidx.compose.runtime.Immutable
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent
import com.tangem.core.ui.extensions.TextReference
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toPersistentList
@Immutable
data class MessageBottomSheetUMV2(
var elements: ImmutableList<Element> = persistentListOf(),
var onDismissRequest: () -> Unit = {},
) : TangemBottomSheetConfigContent {
@Immutable
inner class CloseScope {
fun closeBs() {
onDismissRequest()
}
}
val closeScope = CloseScope()
@Immutable
sealed interface Element
@Immutable
data class Icon(
@DrawableRes internal var res: Int,
var type: Type = Type.Unspecified,
var backgroundType: BackgroundType = BackgroundType.Unspecified,
) : Element {
enum class Type {
Unspecified, Accent, Informative, Attention, Warning,
}
enum class BackgroundType {
Unspecified, SameAsTint, Accent, Informative, Attention, Warning,
}
}
@Immutable
data class IconImage(@DrawableRes internal var res: Int) : Element
@Immutable
data class Chip(
internal var text: TextReference,
var type: Type = Type.Unspecified,
) : Element {
enum class Type {
Unspecified, Warning
}
}
@Immutable
data class InfoBlock(
internal var icon: Icon? = null,
internal var iconImage: IconImage? = null,
internal var chip: Chip? = null,
var title: TextReference? = null,
var body: TextReference? = null,
) : Element
@Immutable
data class Button(
internal var isPrimary: Boolean = false,
var text: TextReference? = null,
@DrawableRes internal var iconInternal: Int? = null,
internal var iconOrder: IconOrder = IconOrder.Start,
var onClick: (CloseScope.() -> Unit)? = null,
) : Element {
var icon: Int? = iconInternal
set(value) {
iconOrder = if (text == null) {
IconOrder.Start
} else {
IconOrder.End
}
field = value
}
enum class IconOrder {
Start, End
}
}
}
@Target(AnnotationTarget.TYPE)
@DslMarker
annotation class MessageBottomSheetV2Dsl
// region: DSL
fun messageBottomSheetUM(init: @MessageBottomSheetV2Dsl MessageBottomSheetUMV2.() -> Unit) =
MessageBottomSheetUMV2().apply(init)
fun MessageBottomSheetUMV2.onDismiss(block: () -> Unit) = MessageBottomSheetUMV2().apply { onDismissRequest = block }
fun MessageBottomSheetUMV2.infoBlock(init: @MessageBottomSheetV2Dsl MessageBottomSheetUMV2.InfoBlock.() -> Unit) =
apply {
val element = MessageBottomSheetUMV2.InfoBlock().apply(init)
elements = (elements + element).toPersistentList()
}
fun MessageBottomSheetUMV2.InfoBlock.icon(@DrawableRes res: Int, init: MessageBottomSheetUMV2.Icon.() -> Unit = {}) =
apply {
icon = MessageBottomSheetUMV2.Icon(res).apply(init)
}
fun MessageBottomSheetUMV2.InfoBlock.iconImage(@DrawableRes res: Int) = apply {
iconImage = MessageBottomSheetUMV2.IconImage(res)
}
fun MessageBottomSheetUMV2.InfoBlock.chip(text: TextReference, init: MessageBottomSheetUMV2.Chip.() -> Unit = {}) =
apply {
chip = MessageBottomSheetUMV2.Chip(text).apply(init)
}
internal fun MessageBottomSheetUMV2.button(init: @MessageBottomSheetV2Dsl MessageBottomSheetUMV2.Button.() -> Unit) =
apply {
val element = MessageBottomSheetUMV2.Button().apply(init)
elements = (elements + element).toPersistentList()
}
fun MessageBottomSheetUMV2.primaryButton(init: @MessageBottomSheetV2Dsl MessageBottomSheetUMV2.Button.() -> Unit) =
apply {
button { isPrimary = true; apply(init) }
}
fun MessageBottomSheetUMV2.secondaryButton(init: @MessageBottomSheetV2Dsl MessageBottomSheetUMV2.Button.() -> Unit) =
apply {
button { isPrimary = false; apply(init) }
}
fun MessageBottomSheetUMV2.Button.onClick(block: MessageBottomSheetUMV2.CloseScope.() -> Unit) = apply {
onClick = block
}
// endregion

View file

@ -1,290 +0,0 @@
package com.tangem.core.ui.components.bottomsheets.message
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.util.fastForEach
import com.tangem.core.ui.R
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUMV2.Button.IconOrder
import com.tangem.core.ui.components.bottomsheets.modal.TangemModalBottomSheet
import com.tangem.core.ui.components.bottomsheets.modal.TangemModalBottomSheetTitle
import com.tangem.core.ui.components.buttons.common.TangemButton
import com.tangem.core.ui.components.buttons.common.TangemButtonIconPosition
import com.tangem.core.ui.components.buttons.common.TangemButtonsDefaults
import com.tangem.core.ui.components.icons.HighlightedIcon
import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.resolveAnnotatedReference
import com.tangem.core.ui.extensions.resolveReference
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toPersistentList
@Composable
fun MessageBottomSheetV2(state: MessageBottomSheetUMV2, onDismissRequest: () -> Unit) {
val stateWithOnDismiss = remember(state) {
state.copy(
onDismissRequest = {
state.onDismissRequest.invoke()
onDismissRequest()
},
)
}
val config = TangemBottomSheetConfig(
isShown = true,
content = stateWithOnDismiss,
onDismissRequest = stateWithOnDismiss.onDismissRequest,
)
TangemModalBottomSheet(
config = config,
title = {
TangemModalBottomSheetTitle(
endIconRes = R.drawable.ic_close_24,
onEndClick = stateWithOnDismiss.onDismissRequest,
)
},
content = { content: MessageBottomSheetUMV2 -> MessageBottomSheetV2Content(content) },
)
}
@Composable
fun MessageBottomSheetV2Content(state: MessageBottomSheetUMV2, modifier: Modifier = Modifier) {
Column(modifier = modifier) {
state.elements.fastForEach { element ->
when (element) {
is MessageBottomSheetUMV2.InfoBlock -> {
ContentContainer(
modifier = Modifier
.heightIn(min = TangemTheme.dimens.size180)
.fillMaxWidth()
.padding(horizontal = TangemTheme.dimens.spacing16)
.padding(bottom = 32.dp),
state = element,
)
}
else -> Unit
}
}
ButtonsContainer(
modifier = Modifier.fillMaxWidth(),
closeScope = state.closeScope,
buttons = state.elements.filterIsInstance<MessageBottomSheetUMV2.Button>().toPersistentList(),
)
}
}
@Composable
private fun ContentContainer(state: MessageBottomSheetUMV2.InfoBlock, modifier: Modifier = Modifier) {
Column(modifier = modifier, horizontalAlignment = Alignment.CenterHorizontally) {
BottomSheetIconContainer(state.icon, state.iconImage)
state.title?.let { title ->
Text(
modifier = Modifier
.fillMaxWidth()
.padding(top = TangemTheme.dimens.spacing24),
text = title.resolveReference(),
style = TangemTheme.typography.h3,
color = TangemTheme.colors.text.primary1,
textAlign = TextAlign.Center,
)
}
state.body?.let { body ->
Text(
modifier = Modifier
.fillMaxWidth()
.padding(top = TangemTheme.dimens.spacing8),
text = body.resolveAnnotatedReference(),
style = TangemTheme.typography.body2,
color = TangemTheme.colors.text.secondary,
textAlign = TextAlign.Center,
)
}
state.chip?.let { chip ->
BottomSheetChip(
modifier = Modifier.padding(top = TangemTheme.dimens.spacing16),
chip = chip,
)
}
}
}
@Composable
private fun BottomSheetIconContainer(
icon: MessageBottomSheetUMV2.Icon?,
iconImage: MessageBottomSheetUMV2.IconImage?,
modifier: Modifier = Modifier,
) {
if (icon != null) {
BottomSheetIcon(icon, modifier)
} else if (iconImage != null) {
Image(
modifier = modifier
.size(TangemTheme.dimens.size56)
.clip(CircleShape),
painter = painterResource(id = iconImage.res),
contentDescription = null,
)
}
}
@Composable
private fun BottomSheetIcon(icon: MessageBottomSheetUMV2.Icon, modifier: Modifier = Modifier) {
val tint = when (icon.type) {
MessageBottomSheetUMV2.Icon.Type.Unspecified -> Color.Unspecified
MessageBottomSheetUMV2.Icon.Type.Accent -> TangemTheme.colors.icon.accent
MessageBottomSheetUMV2.Icon.Type.Informative -> TangemTheme.colors.icon.informative
MessageBottomSheetUMV2.Icon.Type.Attention -> TangemTheme.colors.icon.attention
MessageBottomSheetUMV2.Icon.Type.Warning -> TangemTheme.colors.icon.warning
}
val backgroundColor = when (icon.backgroundType) {
MessageBottomSheetUMV2.Icon.BackgroundType.Unspecified -> TangemTheme.colors.icon.informative
MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint -> tint
MessageBottomSheetUMV2.Icon.BackgroundType.Accent -> TangemTheme.colors.icon.accent
MessageBottomSheetUMV2.Icon.BackgroundType.Informative -> TangemTheme.colors.icon.informative
MessageBottomSheetUMV2.Icon.BackgroundType.Attention -> TangemTheme.colors.icon.attention
MessageBottomSheetUMV2.Icon.BackgroundType.Warning -> TangemTheme.colors.icon.warning
}
HighlightedIcon(
modifier = modifier,
icon = icon.res,
iconTint = tint,
backgroundColor = backgroundColor,
)
}
@Composable
private fun BottomSheetChip(chip: MessageBottomSheetUMV2.Chip, modifier: Modifier = Modifier) {
val color = when (chip.type) {
MessageBottomSheetUMV2.Chip.Type.Unspecified -> TangemTheme.colors.text.primary1
MessageBottomSheetUMV2.Chip.Type.Warning -> TangemTheme.colors.text.warning
}
Text(
modifier = modifier
.background(
shape = RoundedCornerShape(TangemTheme.dimens.radius16),
color = color.copy(alpha = 0.1F),
)
.padding(vertical = TangemTheme.dimens.spacing4, horizontal = TangemTheme.dimens.spacing12),
text = chip.text.resolveReference(),
style = TangemTheme.typography.caption1,
color = color,
)
}
@Suppress("LongMethod")
@Composable
private fun ButtonsContainer(
buttons: ImmutableList<MessageBottomSheetUMV2.Button>,
closeScope: MessageBottomSheetUMV2.CloseScope,
modifier: Modifier = Modifier,
) {
Column(
modifier = modifier.padding(all = TangemTheme.dimens.spacing16),
verticalArrangement = Arrangement.spacedBy(TangemTheme.dimens.spacing8),
) {
buttons.fastForEach { button ->
val icon = button.icon?.let { iconResId ->
when (button.iconOrder) {
IconOrder.Start -> TangemButtonIconPosition.Start(iconResId)
IconOrder.End -> TangemButtonIconPosition.End(iconResId)
}
} ?: TangemButtonIconPosition.None
TangemButton(
modifier = Modifier.fillMaxWidth(),
text = button.text?.resolveReference().orEmpty(),
icon = icon,
onClick = { button.onClick?.invoke(closeScope) },
colors = if (button.isPrimary) {
TangemButtonsDefaults.primaryButtonColors
} else {
TangemButtonsDefaults.secondaryButtonColors
},
enabled = true,
showProgress = false,
textStyle = TangemTheme.typography.subtitle1,
)
}
}
}
@Preview
@Composable
private fun Preview() {
TangemThemePreview {
MessageBottomSheetV2(
messageBottomSheetUM {
infoBlock {
icon(R.drawable.img_knight_shield_32) {
type = MessageBottomSheetUMV2.Icon.Type.Attention
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
}
title = TextReference.Str("Title Title Title")
body = TextReference.Str("Body")
chip(text = TextReference.Str("Some chip information"))
}
primaryButton {
text = TextReference.Str("Test")
icon = R.drawable.ic_tangem_24
}
secondaryButton {
icon = R.drawable.ic_tangem_24
text = TextReference.Str("asdasd")
onClick {
closeBs()
}
}
},
onDismissRequest = {},
)
}
}
@Preview
@Composable
private fun Preview2() {
TangemThemePreview {
MessageBottomSheetV2(
messageBottomSheetUM {
infoBlock {
iconImage = MessageBottomSheetUMV2.IconImage(R.drawable.img_visa_notification)
title = TextReference.Str("Title Title Title")
body = TextReference.Str("Body")
chip(text = TextReference.Str("Some chip information"))
}
primaryButton {
text = TextReference.Str("Test")
icon = R.drawable.ic_tangem_24
}
secondaryButton {
icon = R.drawable.ic_tangem_24
text = TextReference.Str("asdasd")
onClick {
closeBs()
}
}
},
onDismissRequest = {},
)
}
}

View file

@ -4,8 +4,8 @@ import androidx.annotation.DrawableRes
import androidx.compose.runtime.Immutable
import com.tangem.core.decompose.ui.UiMessage
import com.tangem.core.ui.R
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUMV2
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetV2Dsl
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetDsl
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUM
import com.tangem.core.ui.components.bottomsheets.message.messageBottomSheetUM
import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.resourceReference
@ -156,65 +156,22 @@ data class GlobalLoadingMessage(val isShow: Boolean) : EventMessage
/**
* Shows a bottom sheet.
*
* @param iconResId The icon to show in the bottom sheet.
* Optional, `null` by default.
* @param title The title of the bottom sheet. Optional, `null` by default.
* @param message The message to show in the bottom sheet.
* @param firstAction The first action to perform. Optional, `null` by default.
* @param secondAction The second action to perform. Optional, `null` by default.
* @param onDismissRequest The action to perform when the bottom sheet is dismissed.
* @param messageBottomSheetUM The content of the bottom sheet.
* */
@Immutable
data class BottomSheetMessage(
@DrawableRes val iconResId: Int? = null,
val title: TextReference? = null,
val message: TextReference,
val firstAction: EventMessageAction? = null,
val secondAction: EventMessageAction? = null,
val onDismissRequest: () -> Unit = {},
) : EventMessage {
companion object {
/**
* Builder for [BottomSheetMessage].
*
* @param iconResId The icon to show in the bottom sheet. Optional, `null` by default.
* @param title The title of the bottom sheet. Optional, `null` by default.
* @param message The message to show in the bottom sheet.
* @param onDismissRequest The action to perform when the bottom sheet is dismissed.
* @param firstActionBuilder The builder for the first action. Optional, `null` by default.
* @param secondActionBuilder The builder for the second action. Optional, `null` by default.
* */
operator fun invoke(
@DrawableRes iconResId: Int?,
title: TextReference?,
message: TextReference,
onDismissRequest: () -> Unit = {},
firstActionBuilder: (EventMessageAction.BuilderScope.() -> EventMessageAction)? = null,
secondActionBuilder: (EventMessageAction.BuilderScope.() -> EventMessageAction)? = null,
): BottomSheetMessage {
val buttonsScope = EventMessageAction.BuilderScope(onDismissRequest)
return BottomSheetMessage(
iconResId = iconResId,
title = title,
message = message,
onDismissRequest = onDismissRequest,
firstAction = firstActionBuilder?.invoke(buttonsScope),
secondAction = secondActionBuilder?.invoke(buttonsScope),
)
}
}
}
@Immutable
data class BottomSheetMessageV2(
val messageBottomSheetUMV2: MessageBottomSheetUMV2,
val messageBottomSheetUM: MessageBottomSheetUM,
) : EventMessage
fun bottomSheetMessage(init: @MessageBottomSheetV2Dsl MessageBottomSheetUMV2.() -> Unit) =
BottomSheetMessageV2(messageBottomSheetUM(init))
/**
* Builder for [BottomSheetMessage].
*
* @param init The builder lambda with receiver of type [MessageBottomSheetUM].
*
* @return [BottomSheetMessage] with the specified content.
*/
fun bottomSheetMessage(init: @MessageBottomSheetDsl MessageBottomSheetUM.() -> Unit) =
BottomSheetMessage(messageBottomSheetUM(init))
/**
* Represents an action button in the dialog.

View file

@ -19,18 +19,11 @@ import androidx.compose.ui.window.DialogProperties
import com.tangem.core.ui.components.BasicDialog
import com.tangem.core.ui.components.DialogButtonUM
import com.tangem.core.ui.components.SpacerHMax
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheet
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUM
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetV2
import com.tangem.core.ui.components.snackbar.TangemTopSnackbarHostState
import com.tangem.core.ui.event.EventEffect
import com.tangem.core.ui.extensions.resolveReference
import com.tangem.core.ui.res.LocalEventMessageHandler
import com.tangem.core.ui.res.LocalRedesignEnabled
import com.tangem.core.ui.res.LocalSnackbarHostState
import com.tangem.core.ui.res.LocalTopSnackbarHostState
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.*
@Composable
fun EventMessageEffect(
@ -50,7 +43,6 @@ fun EventMessageEffect(
var dialogMessage: DialogMessage? by remember { mutableStateOf(value = null) }
var bottomSheetMessage: BottomSheetMessage? by remember { mutableStateOf(value = null) }
var bottomSheetMessageV2: BottomSheetMessageV2? by remember { mutableStateOf(value = null) }
var loadingMessage: GlobalLoadingMessage? by remember { mutableStateOf(value = null) }
val isRedesignEnabled = LocalRedesignEnabled.current
@ -69,9 +61,6 @@ fun EventMessageEffect(
is BottomSheetMessage -> {
bottomSheetMessage = message
}
is BottomSheetMessageV2 -> {
bottomSheetMessageV2 = message
}
is ToastMessage -> {
onShowToast(message, context)
}
@ -97,18 +86,8 @@ fun EventMessageEffect(
bottomSheetMessage?.let { message ->
MessageBottomSheet(
message = message,
onDismissRequest = {
bottomSheetMessage = null
message.onDismissRequest()
},
)
}
bottomSheetMessageV2?.let { message ->
MessageBottomSheetV2(
state = message.messageBottomSheetUMV2,
onDismissRequest = { bottomSheetMessageV2 = null },
state = message.messageBottomSheetUM,
onDismissRequest = { bottomSheetMessage = null },
)
}
@ -141,41 +120,6 @@ private fun LoadingDialog() {
}
}
@Composable
private fun MessageBottomSheet(message: BottomSheetMessage, onDismissRequest: () -> Unit) {
val config = TangemBottomSheetConfig(
isShown = true,
content = MessageBottomSheetUM(
iconResId = message.iconResId,
title = message.title,
message = message.message,
primaryAction = message.firstAction?.let { action ->
MessageBottomSheetUM.ActionUM(
text = action.title,
isEnabled = action.isEnabled,
onClick = {
action.onClick()
onDismissRequest()
},
)
},
secondaryAction = message.secondAction?.let { action ->
MessageBottomSheetUM.ActionUM(
text = action.title,
isEnabled = action.isEnabled,
onClick = {
action.onClick()
onDismissRequest()
},
)
},
),
onDismissRequest = onDismissRequest,
)
MessageBottomSheet(config)
}
@Composable
private fun MessageDialog(message: DialogMessage, onDismissRequest: () -> Unit) {
BasicDialog(

View file

@ -53,8 +53,8 @@ internal class AddExistingWalletImportModel @Inject constructor(
get() = bottomSheetMessage {
infoBlock {
icon(R.drawable.ic_passcode_lock_56) {
type = MessageBottomSheetUMV2.Icon.Type.Accent
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
type = MessageBottomSheetUM.Icon.Type.Accent
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.SameAsTint
}
title = resourceReference(R.string.common_passphrase)
body = resourceReference(R.string.onboarding_bottom_sheet_passphrase_description)

View file

@ -12,7 +12,7 @@ import com.tangem.core.decompose.model.ParamsContainer
import com.tangem.core.decompose.navigation.Router
import com.tangem.core.decompose.ui.UiMessageSender
import com.tangem.core.navigation.url.UrlOpener
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUMV2
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUM
import com.tangem.core.ui.components.bottomsheets.message.icon
import com.tangem.core.ui.components.bottomsheets.message.infoBlock
import com.tangem.core.ui.components.bottomsheets.message.onClick
@ -66,8 +66,8 @@ internal class WalletHardwareBackupModel @Inject constructor(
bottomSheetMessage {
infoBlock {
icon(R.drawable.ic_passcode_lock_32) {
type = MessageBottomSheetUMV2.Icon.Type.Accent
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
type = MessageBottomSheetUM.Icon.Type.Accent
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.SameAsTint
}
title = resourceReference(R.string.hw_backup_need_finish_first)
body = resourceReference(R.string.hw_backup_to_upgrade_description)

View file

@ -9,8 +9,8 @@ val unexpectedErrorAlertBS
get() = bottomSheetMessage {
infoBlock {
icon(R.drawable.img_knight_shield_32) {
type = MessageBottomSheetUMV2.Icon.Type.Attention
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
type = MessageBottomSheetUM.Icon.Type.Attention
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.SameAsTint
}
title = resourceReference(R.string.unexpected_error_title)
body = resourceReference(R.string.unexpected_error_description)

View file

@ -4,7 +4,7 @@ import androidx.annotation.DrawableRes
import androidx.compose.runtime.Immutable
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUMV2
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUM
import com.tangem.core.ui.extensions.TextReference
import kotlinx.collections.immutable.ImmutableList
@ -15,18 +15,18 @@ internal data class SwapChooseTokenNetworkUM(
@Immutable
internal sealed class SwapChooseTokenNetworkContentUM : TangemBottomSheetConfigContent {
abstract val messageContent: MessageBottomSheetUMV2
abstract val messageContent: MessageBottomSheetUM
data class Loading(
override val messageContent: MessageBottomSheetUMV2,
override val messageContent: MessageBottomSheetUM,
) : SwapChooseTokenNetworkContentUM()
data class Error(
override val messageContent: MessageBottomSheetUMV2,
override val messageContent: MessageBottomSheetUM,
) : SwapChooseTokenNetworkContentUM()
data class Content(
override val messageContent: MessageBottomSheetUMV2,
override val messageContent: MessageBottomSheetUM,
val swapNetworks: ImmutableList<SwapChooseNetworkUM>,
) : SwapChooseTokenNetworkContentUM()
}

View file

@ -7,12 +7,12 @@ import com.tangem.features.swap.v2.impl.R
internal object SwapChooseTokenFactory {
fun getErrorMessage(tokenName: String, onDismiss: () -> Unit): MessageBottomSheetUMV2 {
fun getErrorMessage(tokenName: String, onDismiss: () -> Unit): MessageBottomSheetUM {
return messageBottomSheetUM {
infoBlock {
icon(R.drawable.ic_alert_triangle_20) {
type = MessageBottomSheetUMV2.Icon.Type.Attention
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
type = MessageBottomSheetUM.Icon.Type.Attention
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.SameAsTint
}
title = resourceReference(R.string.express_swap_not_supported_title, wrappedList(tokenName))
body = resourceReference(R.string.express_swap_not_supported_text)

View file

@ -73,7 +73,7 @@ internal fun SwapChooseTokenNetworkContent(state: SwapChooseTokenNetworkContentU
is SwapChooseTokenNetworkContentUM.Content -> SwapChooseTokenNetworkContentList(targetState.swapNetworks)
else -> {
Box {
MessageBottomSheetV2Content(
MessageBottomSheetContent(
state = targetState.messageContent,
modifier = Modifier
.conditional(targetState is SwapChooseTokenNetworkContentUM.Loading) {
@ -180,8 +180,8 @@ private class PreviewProvider : PreviewParameterProvider<SwapChooseTokenNetworkC
messageContent = messageBottomSheetUM {
infoBlock {
icon(R.drawable.ic_alert_triangle_20) {
type = MessageBottomSheetUMV2.Icon.Type.Attention
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.Unspecified
type = MessageBottomSheetUM.Icon.Type.Attention
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.Unspecified
}
title = stringReference("Shiba Inu is not suppoerted")
body = stringReference("This token is not supported. Please choose a different token to swap.")
@ -196,8 +196,8 @@ private class PreviewProvider : PreviewParameterProvider<SwapChooseTokenNetworkC
messageContent = messageBottomSheetUM {
infoBlock {
icon(R.drawable.ic_alert_triangle_20) {
type = MessageBottomSheetUMV2.Icon.Type.Attention
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
type = MessageBottomSheetUM.Icon.Type.Attention
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.SameAsTint
}
title = stringReference("Shiba Inu is not supported")
body = stringReference("This token is not supported. Please choose a different token to swap.")
@ -212,8 +212,8 @@ private class PreviewProvider : PreviewParameterProvider<SwapChooseTokenNetworkC
messageContent = messageBottomSheetUM {
infoBlock {
icon(R.drawable.img_attention_20) {
type = MessageBottomSheetUMV2.Icon.Type.Attention
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
type = MessageBottomSheetUM.Icon.Type.Attention
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.SameAsTint
}
title = stringReference("Shiba Inu is not suppoerted")
body = stringReference("This token is not supported. Please choose a different token to swap.")
@ -238,8 +238,8 @@ private class PreviewProvider : PreviewParameterProvider<SwapChooseTokenNetworkC
messageContent = messageBottomSheetUM {
infoBlock {
icon(R.drawable.img_attention_20) {
type = MessageBottomSheetUMV2.Icon.Type.Attention
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
type = MessageBottomSheetUM.Icon.Type.Attention
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.SameAsTint
}
title = stringReference("Shiba Inu is not suppoerted")
body = stringReference("This token is not supported. Please choose a different token to swap.")
@ -288,8 +288,8 @@ private class PreviewProvider : PreviewParameterProvider<SwapChooseTokenNetworkC
messageContent = messageBottomSheetUM {
infoBlock {
icon(R.drawable.img_attention_20) {
type = MessageBottomSheetUMV2.Icon.Type.Attention
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
type = MessageBottomSheetUM.Icon.Type.Attention
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.SameAsTint
}
title = stringReference("Shiba Inu is not suppoerted")
body = stringReference("This token is not supported. Please choose a different token to swap.")

View file

@ -1,14 +1,14 @@
package com.tangem.features.tangempay.entity
import androidx.annotation.DrawableRes
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUMV2
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUM
import com.tangem.core.ui.extensions.TextReference
import kotlinx.collections.immutable.ImmutableList
internal data class TangemPayAddFundsUM(
val items: ImmutableList<TangemPayAddFundsItemUM>,
val dismiss: () -> Unit,
val errorMessage: MessageBottomSheetUMV2?,
val errorMessage: MessageBottomSheetUM?,
)
internal data class TangemPayAddFundsItemUM(

View file

@ -1,6 +1,6 @@
package com.tangem.features.tangempay.entity
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUMV2
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUM
internal sealed class TangemPayViewPinUM {
@ -17,7 +17,7 @@ internal sealed class TangemPayViewPinUM {
) : TangemPayViewPinUM()
data class Error(
val errorMessage: MessageBottomSheetUMV2,
val errorMessage: MessageBottomSheetUM,
override val onDismiss: () -> Unit,
) : TangemPayViewPinUM()
}

View file

@ -22,7 +22,7 @@ internal class TangemPayAddFundsUMConverter(
dismiss = listener::onDismissAddFunds,
errorMessage = TangemPayMessagesFactory.createErrorMessage(
errorType = TangemPayDetailsErrorType.Receive,
).messageBottomSheetUMV2,
).messageBottomSheetUM,
)
} else {
TangemPayAddFundsUM(

View file

@ -1,7 +1,7 @@
package com.tangem.features.tangempay.model.transformers
import com.tangem.core.ui.R
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUMV2
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUM
import com.tangem.core.ui.components.bottomsheets.message.icon
import com.tangem.core.ui.components.bottomsheets.message.infoBlock
import com.tangem.core.ui.components.bottomsheets.message.messageBottomSheetUM
@ -19,7 +19,7 @@ internal class TangemPayViewPinErrorStateTransformer : Transformer<TangemPayView
errorMessage = messageBottomSheetUM {
infoBlock {
icon(R.drawable.img_attention_20) {
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.Attention
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.Attention
}
title = TextReference.Res(R.string.common_error)
body = TextReference.Res(R.string.common_unknown_error)

View file

@ -20,7 +20,7 @@ import androidx.compose.ui.util.fastForEach
import com.tangem.core.ui.components.SpacerH16
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetV2Content
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetContent
import com.tangem.core.ui.components.bottomsheets.modal.TangemModalBottomSheet
import com.tangem.core.ui.components.bottomsheets.modal.TangemModalBottomSheetTitle
import com.tangem.core.ui.extensions.TextReference.Res
@ -52,7 +52,7 @@ internal fun TangemPayAddFundsContent(state: TangemPayAddFundsUM) {
},
) {
if (state.errorMessage != null) {
MessageBottomSheetV2Content(state.errorMessage)
MessageBottomSheetContent(state.errorMessage)
} else {
Surface(
modifier = Modifier

View file

@ -18,7 +18,7 @@ import com.tangem.core.ui.components.SpacerH12
import com.tangem.core.ui.components.SpacerH24
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetV2Content
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetContent
import com.tangem.core.ui.components.bottomsheets.modal.TangemModalBottomSheet
import com.tangem.core.ui.components.bottomsheets.modal.TangemModalBottomSheetTitle
import com.tangem.core.ui.extensions.TextReference
@ -51,7 +51,7 @@ internal fun TangemPayViewPinContent(state: TangemPayViewPinUM) {
PinSuccessContent(state)
}
is TangemPayViewPinUM.Error -> {
MessageBottomSheetV2Content(state.errorMessage)
MessageBottomSheetContent(state.errorMessage)
}
is TangemPayViewPinUM.Loading -> {
PinLoadingContent()

View file

@ -4,18 +4,18 @@ import com.tangem.core.ui.R
import com.tangem.core.ui.components.bottomsheets.message.*
import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.message.BottomSheetMessageV2
import com.tangem.core.ui.message.BottomSheetMessage
import com.tangem.core.ui.message.bottomSheetMessage
import com.tangem.features.tangempay.entity.TangemPayDetailsErrorType
internal object TangemPayMessagesFactory {
fun createErrorMessage(errorType: TangemPayDetailsErrorType): BottomSheetMessageV2 {
fun createErrorMessage(errorType: TangemPayDetailsErrorType): BottomSheetMessage {
return when (errorType) {
TangemPayDetailsErrorType.Receive -> bottomSheetMessage {
infoBlock {
icon(R.drawable.img_attention_20) {
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.Attention
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.Attention
}
title = TextReference.Res(R.string.tangempay_card_details_receive_error_title)
body = TextReference.Res(R.string.tangempay_card_details_receive_error_description)
@ -28,7 +28,7 @@ internal object TangemPayMessagesFactory {
TangemPayDetailsErrorType.Withdraw -> bottomSheetMessage {
infoBlock {
icon(R.drawable.img_attention_20) {
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.Attention
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.Attention
}
title = TextReference.Res(R.string.tangempay_card_details_withdraw_error_title)
body = TextReference.Res(R.string.tangempay_card_details_receive_error_description)
@ -41,8 +41,8 @@ internal object TangemPayMessagesFactory {
TangemPayDetailsErrorType.WithdrawInProgress -> bottomSheetMessage {
infoBlock {
icon(R.drawable.ic_clock_24) {
type = MessageBottomSheetUMV2.Icon.Type.Informative
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.Informative
type = MessageBottomSheetUM.Icon.Type.Informative
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.Informative
}
title = TextReference.Res(R.string.tangempay_card_details_withdraw_in_progress_title)
body = TextReference.Res(R.string.tangempay_card_details_withdraw_in_progress_description)
@ -55,12 +55,12 @@ internal object TangemPayMessagesFactory {
}
}
fun createFreezeCardMessage(onFreezeClicked: () -> Unit): BottomSheetMessageV2 {
fun createFreezeCardMessage(onFreezeClicked: () -> Unit): BottomSheetMessage {
return bottomSheetMessage {
infoBlock {
icon(R.drawable.ic_snow_24) {
type = MessageBottomSheetUMV2.Icon.Type.Accent
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.Accent
type = MessageBottomSheetUM.Icon.Type.Accent
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.Accent
}
title = TextReference.Res(R.string.tangem_pay_freeze_card_alert_title)
body = TextReference.Res(R.string.tangem_pay_freeze_card_alert_body)
@ -75,12 +75,12 @@ internal object TangemPayMessagesFactory {
}
}
fun createUnfreezeCardMessage(onUnfreezeClicked: () -> Unit): BottomSheetMessageV2 {
fun createUnfreezeCardMessage(onUnfreezeClicked: () -> Unit): BottomSheetMessage {
return bottomSheetMessage {
infoBlock {
icon(R.drawable.ic_snow_24) {
type = MessageBottomSheetUMV2.Icon.Type.Accent
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.Accent
type = MessageBottomSheetUM.Icon.Type.Accent
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.Accent
}
title = TextReference.Res(R.string.tangem_pay_unfreeze_card_alert_title)
body = TextReference.Res(R.string.tangem_pay_unfreeze_card_alert_body)
@ -95,11 +95,11 @@ internal object TangemPayMessagesFactory {
}
}
fun createWithdrawWarning(onGotItClick: () -> Unit): BottomSheetMessageV2 {
fun createWithdrawWarning(onGotItClick: () -> Unit): BottomSheetMessage {
return bottomSheetMessage {
infoBlock {
icon(R.drawable.img_attention_20) {
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.Attention
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.Attention
}
title = TextReference.Res(R.string.tangempay_withdrawal_note_title)
body = TextReference.Res(R.string.tangempay_withdrawal_note_description)

View file

@ -408,8 +408,8 @@ internal class WalletSettingsModel @Inject constructor(
val message = bottomSheetMessage {
infoBlock {
icon(R.drawable.ic_passcode_lock_32) {
type = MessageBottomSheetUMV2.Icon.Type.Accent
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
type = MessageBottomSheetUM.Icon.Type.Accent
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.SameAsTint
}
title = resourceReference(R.string.hw_backup_need_finish_first)
body = resourceReference(R.string.hw_backup_to_secure_description)
@ -509,8 +509,8 @@ internal class WalletSettingsModel @Inject constructor(
bottomSheetMessage {
infoBlock {
icon(R.drawable.ic_alert_circle_24) {
type = MessageBottomSheetUMV2.Icon.Type.Warning
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
type = MessageBottomSheetUM.Icon.Type.Warning
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.SameAsTint
}
title = resourceReference(R.string.hw_remove_wallet_notification_title)
body = if (userWallet.backedUp) {

View file

@ -190,8 +190,8 @@ internal class TangemPayClickIntentsImplementor @Inject constructor(
val issuingBottomSheet = bottomSheetMessage {
infoBlock {
icon(com.tangem.core.ui.R.drawable.ic_clock_24) {
type = MessageBottomSheetUMV2.Icon.Type.Informative
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.Informative
type = MessageBottomSheetUM.Icon.Type.Informative
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.Informative
}
title = resourceReference(R.string.tangempay_issuing_your_card)
body = resourceReference(R.string.tangempay_issuing_your_card_description)
@ -209,8 +209,8 @@ internal class TangemPayClickIntentsImplementor @Inject constructor(
val issuingBottomSheet = bottomSheetMessage {
infoBlock {
icon(com.tangem.core.ui.R.drawable.ic_alert_24) {
type = MessageBottomSheetUMV2.Icon.Type.Warning
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.Warning
type = MessageBottomSheetUM.Icon.Type.Warning
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.Warning
}
title = resourceReference(R.string.tangempay_failed_to_issue_card)
body = resourceReference(R.string.tangempay_failed_to_issue_card_support_description)

View file

@ -114,8 +114,8 @@ internal class WalletWarningsSingleEventSender @Inject constructor(
val message = bottomSheetMessage {
infoBlock {
icon(R.drawable.img_knight_shield_32) {
type = MessageBottomSheetUMV2.Icon.Type.Warning
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
type = MessageBottomSheetUM.Icon.Type.Warning
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.SameAsTint
}
title = resourceReference(R.string.hw_activation_need_title)
body = resourceReference(R.string.hw_activation_need_description)

View file

@ -5,7 +5,7 @@ import androidx.compose.runtime.getValue
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.tangem.core.decompose.context.AppComponentContext
import com.tangem.core.decompose.model.getOrCreateModel
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetV2
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheet
import com.tangem.core.ui.decompose.ComposableBottomSheetComponent
import com.tangem.domain.models.wallet.UserWalletId
import dagger.assisted.Assisted
@ -26,7 +26,7 @@ internal class KycRejectedComponent @AssistedInject constructor(
@Composable
override fun BottomSheet() {
val state by model.uiState.collectAsStateWithLifecycle()
MessageBottomSheetV2(state = state, onDismissRequest = ::dismiss)
MessageBottomSheet(state = state, onDismissRequest = ::dismiss)
}
data class Params(

View file

@ -27,15 +27,15 @@ internal class KycRejectedModel @Inject constructor(
private val params = paramsContainer.require<KycRejectedComponent.Params>()
val uiState: StateFlow<MessageBottomSheetUMV2>
val uiState: StateFlow<MessageBottomSheetUM>
field = MutableStateFlow(getInitialState())
private fun getInitialState(): MessageBottomSheetUMV2 {
private fun getInitialState(): MessageBottomSheetUM {
return bottomSheetMessage {
infoBlock {
icon(com.tangem.core.ui.R.drawable.ic_heart_broken_32) {
type = MessageBottomSheetUMV2.Icon.Type.Warning
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.Warning
type = MessageBottomSheetUM.Icon.Type.Warning
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.Warning
}
title = resourceReference(R.string.tangempay_kyc_rejected)
body = combinedReference(
@ -68,7 +68,7 @@ internal class KycRejectedModel @Inject constructor(
onDismiss()
}
}
}.messageBottomSheetUMV2
}.messageBottomSheetUM
}
fun onDismiss() {

View file

@ -2,13 +2,13 @@ package com.tangem.features.walletconnect.connections.components
import androidx.compose.runtime.Composable
import com.tangem.core.decompose.context.AppComponentContext
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUMV2
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetV2
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUM
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheet
import com.tangem.core.ui.decompose.ComposableBottomSheetComponent
internal class AlertsComponentV2(
appComponentContext: AppComponentContext,
private val messageUM: MessageBottomSheetUMV2,
private val messageUM: MessageBottomSheetUM,
) : AppComponentContext by appComponentContext, ComposableBottomSheetComponent {
override fun dismiss() {
@ -18,6 +18,6 @@ internal class AlertsComponentV2(
@Composable
override fun BottomSheet() {
MessageBottomSheetV2(state = messageUM, onDismissRequest = ::dismiss)
MessageBottomSheet(state = messageUM, onDismissRequest = ::dismiss)
}
}

View file

@ -12,7 +12,7 @@ import com.tangem.core.decompose.context.AppComponentContext
import com.tangem.core.decompose.context.childByContext
import com.tangem.core.decompose.model.getOrCreateModel
import com.tangem.core.decompose.navigation.inner.InnerRouter
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUMV2
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUM
import com.tangem.core.ui.decompose.ComposableBottomSheetComponent
import com.tangem.core.ui.decompose.ComposableContentComponent
import com.tangem.domain.models.wallet.UserWalletId
@ -112,7 +112,7 @@ internal class WcPairComponent(
}
}
private fun createBottomSheetMessageUM(alertType: Alert): MessageBottomSheetUMV2 {
private fun createBottomSheetMessageUM(alertType: Alert): MessageBottomSheetUM {
return when (alertType) {
is Alert.Verified -> WcAlertsFactory.createVerifiedDomainAlert(alertType.appName)
is Alert.UnknownDomain -> WcAlertsFactory.createUnknownDomainAlert(model::connectFromAlert)

View file

@ -2,7 +2,7 @@ package com.tangem.features.walletconnect.connections.utils
import com.tangem.core.ui.R
import com.tangem.core.ui.components.bottomsheets.message.*
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUMV2.Icon.Type
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUM.Icon.Type
import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.extensions.wrappedList
@ -23,16 +23,16 @@ internal object WcAlertsFactory {
createUnknownErrorAlert(alertType.errorMessage, alertType.onDismiss, alertType.onRetry)
}
fun createUnknownDomainAlert(activeButtonOnClick: (() -> Unit)? = null): MessageBottomSheetUMV2 {
fun createUnknownDomainAlert(activeButtonOnClick: (() -> Unit)? = null): MessageBottomSheetUM {
return messageBottomSheetUM {
infoBlock {
icon(R.drawable.img_knight_shield_32) {
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.Attention
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.Attention
}
title = resourceReference(R.string.security_alert_title)
body = resourceReference(R.string.wc_alert_domain_issues_description)
chip(resourceReference(R.string.wc_alert_audit_unknown_domain)) {
type = MessageBottomSheetUMV2.Chip.Type.Unspecified
type = MessageBottomSheetUM.Chip.Type.Unspecified
}
}
primaryButton {
@ -48,12 +48,12 @@ internal object WcAlertsFactory {
}
}
fun createInvalidDomainAlert(onDismiss: () -> Unit): MessageBottomSheetUMV2 {
fun createInvalidDomainAlert(onDismiss: () -> Unit): MessageBottomSheetUM {
return messageBottomSheetUM {
infoBlock {
icon(R.drawable.ic_wallet_connect_24) {
type = Type.Informative
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.SameAsTint
}
title = resourceReference(R.string.wc_errors_invalid_domain_title)
body = resourceReference(R.string.wc_errors_invalid_domain_subtitle)
@ -66,17 +66,17 @@ internal object WcAlertsFactory {
}
}
fun createUnsafeDomainAlert(activeButtonOnClick: (() -> Unit)? = null): MessageBottomSheetUMV2 {
fun createUnsafeDomainAlert(activeButtonOnClick: (() -> Unit)? = null): MessageBottomSheetUM {
return messageBottomSheetUM {
infoBlock {
icon(R.drawable.img_knight_shield_32) {
type = Type.Warning
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.Warning
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.Warning
}
title = resourceReference(R.string.security_alert_title)
body = resourceReference(R.string.wc_alert_domain_issues_description)
chip(resourceReference(R.string.wc_alert_audit_malicious_domain)) {
type = MessageBottomSheetUMV2.Chip.Type.Warning
type = MessageBottomSheetUM.Chip.Type.Warning
}
}
primaryButton {
@ -92,12 +92,12 @@ internal object WcAlertsFactory {
}
}
fun createUnsupportedDomainAlert(appName: String, onDismiss: () -> Unit): MessageBottomSheetUMV2 {
fun createUnsupportedDomainAlert(appName: String, onDismiss: () -> Unit): MessageBottomSheetUM {
return messageBottomSheetUM {
infoBlock {
icon(R.drawable.ic_wallet_connect_24) {
type = Type.Informative
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.SameAsTint
}
title = resourceReference(R.string.wc_alert_unsupported_dapps_title)
body = resourceReference(R.string.wc_alert_unsupported_dapps_description, wrappedList(appName))
@ -110,12 +110,12 @@ internal object WcAlertsFactory {
}
}
fun createUriAlreadyUsedAlert(onDismiss: () -> Unit): MessageBottomSheetUMV2 {
fun createUriAlreadyUsedAlert(onDismiss: () -> Unit): MessageBottomSheetUM {
return messageBottomSheetUM {
infoBlock {
icon(R.drawable.ic_wallet_connect_24) {
type = Type.Informative
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.SameAsTint
}
title = resourceReference(R.string.wc_uri_already_used_title)
body = resourceReference(R.string.wc_uri_already_used_description)
@ -128,12 +128,12 @@ internal object WcAlertsFactory {
}
}
fun createTimeoutExceptionAlert(onDismiss: () -> Unit): MessageBottomSheetUMV2 {
fun createTimeoutExceptionAlert(onDismiss: () -> Unit): MessageBottomSheetUM {
return messageBottomSheetUM {
infoBlock {
icon(R.drawable.ic_wallet_connect_24) {
type = Type.Informative
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.SameAsTint
}
title = resourceReference(R.string.wc_alert_request_timeout_title)
body = resourceReference(R.string.wc_alert_request_timeout_description)
@ -145,12 +145,12 @@ internal object WcAlertsFactory {
}
}
fun createUnsupportedChainAlert(appName: String, onDismiss: () -> Unit): MessageBottomSheetUMV2 {
fun createUnsupportedChainAlert(appName: String, onDismiss: () -> Unit): MessageBottomSheetUM {
return messageBottomSheetUM {
infoBlock {
icon(R.drawable.ic_network_new_24) {
type = Type.Informative
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.SameAsTint
}
title = resourceReference(R.string.wc_alert_unsupported_networks_title)
body = resourceReference(R.string.wc_alert_unsupported_networks_description, wrappedList(appName))
@ -167,11 +167,11 @@ internal object WcAlertsFactory {
errorMessage: String?,
onDismiss: () -> Unit,
onRetry: () -> Unit,
): MessageBottomSheetUMV2 {
): MessageBottomSheetUM {
return messageBottomSheetUM {
infoBlock {
icon(R.drawable.img_attention_20) {
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.Attention
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.Attention
}
title = resourceReference(R.string.wc_alert_unknown_error_title)
body = if (errorMessage.isNullOrEmpty()) {
@ -199,8 +199,8 @@ internal object WcAlertsFactory {
description: String?,
activeButtonOnClick: (() -> Unit),
iconType: Type,
iconBgType: MessageBottomSheetUMV2.Icon.BackgroundType,
): MessageBottomSheetUMV2 {
iconBgType: MessageBottomSheetUM.Icon.BackgroundType,
): MessageBottomSheetUM {
return messageBottomSheetUM {
infoBlock {
icon(R.drawable.img_knight_shield_32) {
@ -223,11 +223,11 @@ internal object WcAlertsFactory {
}
}
fun createVerifiedDomainAlert(appName: String): MessageBottomSheetUMV2 {
fun createVerifiedDomainAlert(appName: String): MessageBottomSheetUM {
return messageBottomSheetUM {
infoBlock {
icon(R.drawable.img_approvale2_20) {
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.Accent
backgroundType = MessageBottomSheetUM.Icon.BackgroundType.Accent
}
title = resourceReference(R.string.wc_alert_verified_domain_title)
body = resourceReference(R.string.wc_alert_verified_domain_description, wrappedList(appName))

View file

@ -20,8 +20,8 @@ import com.tangem.core.decompose.navigation.Router
import com.tangem.core.decompose.ui.UiMessageSender
import com.tangem.core.navigation.url.UrlOpener
import com.tangem.core.ui.clipboard.ClipboardManager
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUMV2
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUMV2.Icon.Type
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUM
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUM.Icon.Type
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.extensions.wrappedList
import com.tangem.domain.account.status.supplier.SingleAccountStatusListSupplier
@ -377,7 +377,7 @@ internal class WcSendTransactionModel @Inject constructor(
description = description,
onClick = ::signFromAlert,
iconType = Type.Warning,
iconBgType = MessageBottomSheetUMV2.Icon.BackgroundType.Warning,
iconBgType = MessageBottomSheetUM.Icon.BackgroundType.Warning,
)
stackNavigation.pushNew(WcTransactionRoutes.Alert(type))
}
@ -387,7 +387,7 @@ internal class WcSendTransactionModel @Inject constructor(
description = description,
onClick = ::signFromAlert,
iconType = Type.Attention,
iconBgType = MessageBottomSheetUMV2.Icon.BackgroundType.Attention,
iconBgType = MessageBottomSheetUM.Icon.BackgroundType.Attention,
)
stackNavigation.pushNew(WcTransactionRoutes.Alert(type))
}

View file

@ -3,7 +3,7 @@ package com.tangem.features.walletconnect.transaction.routes
import androidx.compose.runtime.Immutable
import com.tangem.core.decompose.navigation.Route
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUMV2
import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUM
import kotlinx.serialization.Serializable
@Serializable
@ -31,8 +31,8 @@ internal sealed class WcTransactionRoutes : TangemBottomSheetConfigContent, Rout
data class BlockAidErrorInfo(
val description: String?,
val onClick: () -> Unit,
val iconType: MessageBottomSheetUMV2.Icon.Type,
val iconBgType: MessageBottomSheetUMV2.Icon.BackgroundType,
val iconType: MessageBottomSheetUM.Icon.Type,
val iconBgType: MessageBottomSheetUM.Icon.BackgroundType,
) : Type()
data class UnknownError(