Updated on 2026-08-14
This commit is contained in:
commit
288b966313
3 changed files with 51 additions and 5 deletions
|
|
@ -216,6 +216,10 @@ private fun Buttons(state: NotificationButtonsState?, isEnabled: Boolean = true)
|
|||
)
|
||||
is NotificationButtonsState.PrimaryButtonConfig -> SinglePrimaryButton(config = state, isEnabled = isEnabled)
|
||||
is NotificationButtonsState.PairButtonsConfig -> PairButtons(config = state, isEnabled = isEnabled)
|
||||
is NotificationConfig.ButtonsState.SecondaryPairButtonsConfig -> SecondaryPairButtons(
|
||||
config = state,
|
||||
isEnabled = isEnabled,
|
||||
)
|
||||
null -> Unit
|
||||
}
|
||||
}
|
||||
|
|
@ -284,6 +288,30 @@ private fun PairButtons(config: NotificationButtonsState.PairButtonsConfig, isEn
|
|||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SecondaryPairButtons(
|
||||
config: NotificationButtonsState.SecondaryPairButtonsConfig,
|
||||
isEnabled: Boolean = true,
|
||||
) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(space = TangemTheme.dimens.spacing8)) {
|
||||
SecondaryButton(
|
||||
text = config.leftText.resolveReference(),
|
||||
onClick = config.onLeftClick,
|
||||
modifier = Modifier.weight(weight = 1f),
|
||||
size = TangemButtonSize.WideAction,
|
||||
enabled = isEnabled,
|
||||
)
|
||||
|
||||
SecondaryButton(
|
||||
text = config.rightText.resolveReference(),
|
||||
onClick = config.onRightClick,
|
||||
modifier = Modifier.weight(weight = 1f),
|
||||
size = TangemButtonSize.WideAction,
|
||||
enabled = isEnabled,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun CloseableIconButton(
|
||||
onClick: (() -> Unit)?,
|
||||
|
|
@ -385,6 +413,17 @@ private class NotificationConfigProvider : CollectionPreviewParameterProvider<No
|
|||
onSecondaryClick = {},
|
||||
),
|
||||
),
|
||||
NotificationConfig(
|
||||
title = TextReference.Str(value = "Rate the app"),
|
||||
subtitle = TextReference.Str(value = "How do you like Tangem?"),
|
||||
iconResId = R.drawable.img_attention_20,
|
||||
buttonsState = NotificationButtonsState.SecondaryPairButtonsConfig(
|
||||
leftText = TextReference.Str(value = "Love it!"),
|
||||
onLeftClick = {},
|
||||
rightText = TextReference.Str(value = "Can be better"),
|
||||
onRightClick = {},
|
||||
),
|
||||
),
|
||||
NotificationConfig(
|
||||
title = TextReference.Str(value = "Note top up"),
|
||||
subtitle = TextReference.Str(value = "To activate card top up it with at least 1 XLM"),
|
||||
|
|
|
|||
|
|
@ -48,5 +48,12 @@ data class NotificationConfig(
|
|||
val secondaryText: TextReference,
|
||||
val onSecondaryClick: () -> Unit,
|
||||
) : ButtonsState()
|
||||
|
||||
data class SecondaryPairButtonsConfig(
|
||||
val leftText: TextReference,
|
||||
val onLeftClick: () -> Unit,
|
||||
val rightText: TextReference,
|
||||
val onRightClick: () -> Unit,
|
||||
) : ButtonsState()
|
||||
}
|
||||
}
|
||||
|
|
@ -54,11 +54,11 @@ sealed class WalletNotification(val config: NotificationConfig) {
|
|||
data class SeedPhraseNotification(val onDeclineClick: () -> Unit, val onConfirmClick: () -> Unit) : Critical(
|
||||
title = resourceReference(R.string.warning_seedphrase_issue_title),
|
||||
subtitle = resourceReference(R.string.warning_seedphrase_issue_message),
|
||||
buttonsState = NotificationConfig.ButtonsState.PairButtonsConfig(
|
||||
primaryText = resourceReference(R.string.common_yes),
|
||||
onPrimaryClick = onConfirmClick,
|
||||
secondaryText = resourceReference(R.string.common_no),
|
||||
onSecondaryClick = onDeclineClick,
|
||||
buttonsState = NotificationConfig.ButtonsState.SecondaryPairButtonsConfig(
|
||||
leftText = resourceReference(R.string.common_no),
|
||||
onLeftClick = onDeclineClick,
|
||||
rightText = resourceReference(R.string.common_yes),
|
||||
onRightClick = onConfirmClick,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue