Updated on 2026-08-14

This commit is contained in:
Tangem 2026-03-06 17:11:59 +03:00
parent 47db65fdbe
commit 9f2b2eac71
21 changed files with 658 additions and 72 deletions

View file

@ -33,8 +33,12 @@ import com.tangem.core.ui.components.account.AccountIconSize
import com.tangem.core.ui.components.rows.RoundableCornersRow
import com.tangem.core.ui.extensions.pluralStringResourceSafe
import com.tangem.core.ui.extensions.resolveReference
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.extensions.stringReference
import com.tangem.core.ui.extensions.stringResourceSafe
import com.tangem.core.ui.message.SnackbarMessage
import com.tangem.core.ui.res.LocalRedesignEnabled
import com.tangem.core.ui.res.LocalTopSnackbarHostState
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.feature.referral.domain.models.ExpectedAward
@ -352,6 +356,8 @@ private fun AdditionalButtons(
val coroutineScope = rememberCoroutineScope()
val resources = LocalContext.current.resources
val isRedesignEnabled = LocalRedesignEnabled.current
val tangemTopSnackbarHostState = LocalTopSnackbarHostState.current
Row(
modifier = Modifier.fillMaxWidth(),
@ -366,10 +372,19 @@ private fun AdditionalButtons(
clipboardManager.setText(AnnotatedString(code))
coroutineScope.launch {
snackbarHostState.showSnackbar(
message = resources.getStringSafe(R.string.referral_promo_code_copied),
duration = SnackbarDuration.Short,
)
if (isRedesignEnabled) {
tangemTopSnackbarHostState.showSnackbar(
SnackbarMessage(
startIconId = R.drawable.ic_check_24,
message = resourceReference(R.string.referral_promo_code_copied),
),
)
} else {
snackbarHostState.showSnackbar(
message = resources.getStringSafe(R.string.referral_promo_code_copied),
duration = SnackbarDuration.Short,
)
}
}
},
modifier = Modifier.weight(1f),

View file

@ -45,6 +45,9 @@ import com.tangem.core.ui.components.token.state.TokenItemState
import com.tangem.core.ui.components.token.state.TokenItemState.FiatAmountState
import com.tangem.core.ui.extensions.stringReference
import com.tangem.core.ui.extensions.stringResourceSafe
import com.tangem.core.ui.message.SnackbarMessage
import com.tangem.core.ui.res.LocalRedesignEnabled
import com.tangem.core.ui.res.LocalTopSnackbarHostState
import com.tangem.core.ui.res.TangemColorPalette
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
@ -104,10 +107,24 @@ internal fun ReferralScreen(stateHolder: ReferralStateHolder) {
val errorSnackbar = stateHolder.errorSnackbar
val coroutineScope = rememberCoroutineScope()
val resources = LocalContext.current.resources
val isRedesignEnabled = LocalRedesignEnabled.current
val topSnackbarHostState = LocalTopSnackbarHostState.current
SideEffect {
if (errorSnackbar != null) {
coroutineScope.launch {
if (isRedesignEnabled) {
topSnackbarHostState.showSnackbar(
message = resources.getMessageForErrorSnackbar(errorSnackbar.throwable),
actionLabel = resources.getStringSafe(R.string.warning_button_ok),
duration = SnackbarMessage.Duration.Indefinite,
)
errorSnackbar.onOkClicked()
return@launch
}
val result = snackbarHostState.showSnackbar(
message = resources.getMessageForErrorSnackbar(errorSnackbar.throwable),
actionLabel = resources.getStringSafe(R.string.warning_button_ok),