diff --git a/core/res/src/main/res/values-ru/strings.xml b/core/res/src/main/res/values-ru/strings.xml index e3715ed204..567496ce4d 100644 --- a/core/res/src/main/res/values-ru/strings.xml +++ b/core/res/src/main/res/values-ru/strings.xml @@ -297,6 +297,7 @@ Безлимитно Купить Сканировать + Информация сгенерирована ИИ Чтобы изменить код доступа, приложите карту как показано выше и не убирайте до окончания операции Чтобы изменить пароль, приложите карту как показано выше и не убирайте до окончания операции Чтобы создать кошелек, приложите карту как показано выше и не убирайте до окончания операции diff --git a/core/res/src/main/res/values/strings.xml b/core/res/src/main/res/values/strings.xml index ccbd670078..5fc80e50c7 100644 --- a/core/res/src/main/res/values/strings.xml +++ b/core/res/src/main/res/values/strings.xml @@ -297,6 +297,7 @@ Unlimited Order card Scan card + This information was generated with AI To change the access code tap the card as shown above and do not remove until the end of the operation To change the passcode tap the card as shown above and do not remove until the end of the operation To create the wallet tap the card as shown above and do not remove until the end of the operation diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/notifications/Notification.kt b/core/ui/src/main/java/com/tangem/core/ui/components/notifications/Notification.kt index f25c4014cf..7a77b4cb67 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/notifications/Notification.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/notifications/Notification.kt @@ -30,6 +30,7 @@ import com.tangem.core.ui.components.* import com.tangem.core.ui.components.buttons.common.TangemButtonSize import com.tangem.core.ui.extensions.TextReference 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 com.tangem.core.ui.components.notifications.NotificationConfig.ButtonsState as NotificationButtonsState @@ -51,6 +52,7 @@ import com.tangem.core.ui.components.notifications.NotificationConfig.ButtonsSta fun Notification( config: NotificationConfig, modifier: Modifier = Modifier, + subtitleColor: Color = TangemTheme.colors.text.tertiary, containerColor: Color? = null, iconTint: Color? = null, isEnabled: Boolean = true, @@ -68,6 +70,7 @@ fun Notification( iconTint = iconTint, title = config.title, subtitle = config.subtitle, + subtitleColor = subtitleColor, isClickableComponent = isEnabled && config.onClick != null, ) } @@ -94,7 +97,7 @@ internal fun NotificationBaseContainer( Surface( onClick = onClick ?: {}, modifier = modifier - .defaultMinSize(minHeight = TangemTheme.dimens.size62) + .defaultMinSize(minHeight = TangemTheme.dimens.size44) .fillMaxWidth(), enabled = onClick != null && isEnabled, shape = TangemTheme.shapes.roundedCornersXMedium, @@ -119,15 +122,17 @@ internal fun NotificationBaseContainer( } } +@Suppress("LongParameterList") @Composable private fun MainContent( iconResId: Int, iconTint: Color?, - title: TextReference, + title: TextReference?, subtitle: TextReference, + subtitleColor: Color, isClickableComponent: Boolean, ) { - Row { + Row(verticalAlignment = Alignment.CenterVertically) { Icon( iconResId = iconResId, tint = iconTint, @@ -138,7 +143,7 @@ private fun MainContent( SpacerW(width = TangemTheme.dimens.spacing10) - TextsBlock(title = title, subtitle = subtitle) + TextsBlock(title = title, subtitle = subtitle, subtitleColor = subtitleColor) if (isClickableComponent) { SpacerWMax() @@ -174,17 +179,23 @@ private fun Icon(@DrawableRes iconResId: Int, tint: Color?, modifier: Modifier = } @Composable -private fun TextsBlock(title: TextReference, subtitle: TextReference) { - Column(verticalArrangement = Arrangement.spacedBy(space = TangemTheme.dimens.spacing2)) { - Text( - text = title.resolveReference(), - color = TangemTheme.colors.text.primary1, - style = TangemTheme.typography.button, - ) +private fun TextsBlock(title: TextReference?, subtitle: TextReference, subtitleColor: Color) { + Column { + val titleText = title?.resolveReference() + + if (titleText != null) { + Text( + text = titleText, + color = TangemTheme.colors.text.primary1, + style = TangemTheme.typography.button, + ) + + SpacerH(height = TangemTheme.dimens.spacing2) + } Text( text = subtitle.resolveReference(), - color = TangemTheme.colors.text.tertiary, + color = subtitleColor, style = TangemTheme.typography.caption2, ) } @@ -363,5 +374,9 @@ private class NotificationConfigProvider : CollectionPreviewParameterProvider Unit)? = null, diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/notifications/NotificationWithBackground.kt b/core/ui/src/main/java/com/tangem/core/ui/components/notifications/NotificationWithBackground.kt index 34ae262e6d..13a8aac488 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/notifications/NotificationWithBackground.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/notifications/NotificationWithBackground.kt @@ -7,9 +7,9 @@ import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.defaultMinSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.size -import androidx.compose.material.Icon -import androidx.compose.material.Text import androidx.compose.material.ripple.rememberRipple +import androidx.compose.material3.Icon +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier @@ -33,8 +33,8 @@ import com.tangem.core.ui.extensions.wrappedList import com.tangem.core.ui.res.LocalIsInDarkTheme import com.tangem.core.ui.res.TangemColorPalette.Dark6 import com.tangem.core.ui.res.TangemColorPalette.Light4 -import com.tangem.core.ui.res.TangemThemePreview import com.tangem.core.ui.res.TangemTheme +import com.tangem.core.ui.res.TangemThemePreview /** * Custom notification with image background @@ -85,17 +85,22 @@ fun NotificationWithBackground(config: NotificationConfig, modifier: Modifier = linkTo(titleRef.top, subtitleRef.bottom, bias = 0.1f) }, ) - Text( - text = config.title.resolveReference(), - style = TangemTheme.typography.button, - color = TangemTheme.colors.text.constantWhite, - modifier = Modifier.constrainAs(titleRef) { - top.linkTo(parent.top, spacing12) - start.linkTo(iconRef.end, spacing12) - end.linkTo(closeIconRef.start, spacing2) - width = Dimension.fillToConstraints - }, - ) + + val titleText = config.title?.resolveReference() + if (titleText != null) { + Text( + text = titleText, + style = TangemTheme.typography.button, + color = TangemTheme.colors.text.constantWhite, + modifier = Modifier.constrainAs(titleRef) { + top.linkTo(parent.top, spacing12) + start.linkTo(iconRef.end, spacing12) + end.linkTo(closeIconRef.start, spacing2) + width = Dimension.fillToConstraints + }, + ) + } + Text( text = config.subtitle.resolveReference(), style = TangemTheme.typography.caption2, diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/notifications/OkxPromoNotification.kt b/core/ui/src/main/java/com/tangem/core/ui/components/notifications/OkxPromoNotification.kt index eacaa9567e..19d96e409b 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/notifications/OkxPromoNotification.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/notifications/OkxPromoNotification.kt @@ -63,11 +63,16 @@ private fun Content(config: NotificationConfig) { .weight(1f) .padding(TangemTheme.dimens.spacing12), ) { - Text( - text = config.title.resolveReference(), - style = TangemTheme.typography.button, - color = OxkPromoColor, - ) + val titleText = config.title?.resolveReference() + + if (titleText != null) { + Text( + text = titleText, + style = TangemTheme.typography.button, + color = OxkPromoColor, + ) + } + Text( text = config.subtitle.resolveReference(), style = TangemTheme.typography.caption2, diff --git a/core/ui/src/main/res/drawable/ic_magic_28.xml b/core/ui/src/main/res/drawable/ic_magic_28.xml new file mode 100644 index 0000000000..c6f4bf1724 --- /dev/null +++ b/core/ui/src/main/res/drawable/ic_magic_28.xml @@ -0,0 +1,9 @@ + + + diff --git a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/ui/components/InfoBottomSheet.kt b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/ui/components/InfoBottomSheet.kt index d78f6b2d99..180c7eefa9 100644 --- a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/ui/components/InfoBottomSheet.kt +++ b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/ui/components/InfoBottomSheet.kt @@ -1,9 +1,6 @@ package com.tangem.features.markets.details.impl.ui.components -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.WindowInsets -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.systemBars +import androidx.compose.foundation.layout.* import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.runtime.Composable @@ -13,9 +10,13 @@ import com.tangem.core.ui.components.SpacerH import com.tangem.core.ui.components.bottomsheets.TangemBottomSheet import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetTitle +import com.tangem.core.ui.components.notifications.Notification +import com.tangem.core.ui.components.notifications.NotificationConfig +import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.resolveReference import com.tangem.core.ui.res.TangemTheme import com.tangem.features.markets.details.impl.ui.state.InfoBottomSheetContent +import com.tangem.features.markets.impl.R import dev.jeziellago.compose.markdowntext.MarkdownText @Composable @@ -26,14 +27,12 @@ internal fun InfoBottomSheet(config: TangemBottomSheetConfig) { config = config, skipPartiallyExpanded = false, addBottomInsets = false, - title = { - TangemBottomSheetTitle(title = it.title) - }, + title = { TangemBottomSheetTitle(title = it.title) }, content = { Column( modifier = Modifier .verticalScroll(rememberScrollState()) - .padding(horizontal = TangemTheme.dimens.spacing28), + .padding(horizontal = TangemTheme.dimens.spacing16), ) { MarkdownText( markdown = it.body.resolveReference(), @@ -44,8 +43,29 @@ internal fun InfoBottomSheet(config: TangemBottomSheetConfig) { color = TangemTheme.colors.text.secondary, ), ) + + AdditionalInfoNotification( + modifier = Modifier + .padding(top = TangemTheme.dimens.spacing12, bottom = TangemTheme.dimens.spacing16) + .fillMaxWidth(), + ) + SpacerH(bottomBarHeight) } }, ) +} + +@Composable +private fun AdditionalInfoNotification(modifier: Modifier = Modifier) { + Notification( + config = NotificationConfig( + subtitle = TextReference.Res(id = R.string.information_generated_with_ai), + iconResId = R.drawable.ic_magic_28, + ), + modifier = modifier, + subtitleColor = TangemTheme.colors.text.primary1, + containerColor = TangemTheme.colors.button.disabled, + iconTint = TangemTheme.colors.icon.accent, + ) } \ No newline at end of file