Updated on 2026-08-14
This commit is contained in:
parent
6d69a5706a
commit
9c1931f7d7
81 changed files with 686 additions and 981 deletions
|
|
@ -63,7 +63,7 @@ private fun AgreementHtmlView(url: String) {
|
|||
|
||||
@Preview
|
||||
@Composable
|
||||
fun Preview_AgreementBottomSheet_InLightTheme() {
|
||||
private fun Preview_AgreementBottomSheet_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
AgreementBottomSheetContent(url = "https://tangem.com/en/")
|
||||
}
|
||||
|
|
@ -71,7 +71,7 @@ fun Preview_AgreementBottomSheet_InLightTheme() {
|
|||
|
||||
@Preview
|
||||
@Composable
|
||||
fun Preview_AgreementBottomSheet_InDarkTheme() {
|
||||
private fun Preview_AgreementBottomSheet_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
AgreementBottomSheetContent(url = "https://tangem.com/en/")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import com.tangem.core.ui.res.TangemTheme
|
|||
import com.tangem.feature.referral.presentation.R
|
||||
|
||||
@Composable
|
||||
internal fun AgreementText(@StringRes firstPartResId: Int, onClicked: () -> Unit) {
|
||||
internal fun AgreementText(@StringRes firstPartResId: Int, onClick: () -> Unit) {
|
||||
val agreementText = annotatedAgreementString(firstPart = stringResource(firstPartResId))
|
||||
ClickableText(
|
||||
text = agreementText,
|
||||
|
|
@ -31,7 +31,7 @@ internal fun AgreementText(@StringRes firstPartResId: Int, onClicked: () -> Unit
|
|||
onClick = {
|
||||
val clickableSpanStyle = requireNotNull(agreementText.spanStyles.getOrNull(1))
|
||||
if (it in clickableSpanStyle.start..clickableSpanStyle.end) {
|
||||
onClicked()
|
||||
onClick()
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
@ -54,20 +54,20 @@ private fun annotatedAgreementString(firstPart: String): AnnotatedString {
|
|||
|
||||
@Preview(widthDp = 360, showBackground = true)
|
||||
@Composable
|
||||
fun Preview_AgreementText_InLightTheme() {
|
||||
private fun Preview_AgreementText_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
Box(modifier = Modifier.background(TangemTheme.colors.background.primary)) {
|
||||
AgreementText(firstPartResId = R.string.referral_tos_not_enroled_prefix, onClicked = {})
|
||||
AgreementText(firstPartResId = R.string.referral_tos_not_enroled_prefix, onClick = {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(widthDp = 360, showBackground = true)
|
||||
@Composable
|
||||
fun Preview_AgreementText_InDarkTheme() {
|
||||
private fun Preview_AgreementText_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
Box(modifier = Modifier.background(TangemTheme.colors.background.primary)) {
|
||||
AgreementText(firstPartResId = R.string.referral_tos_not_enroled_prefix, onClicked = {})
|
||||
AgreementText(firstPartResId = R.string.referral_tos_not_enroled_prefix, onClick = {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12,37 +12,37 @@ import com.tangem.core.ui.res.TangemTheme
|
|||
import com.tangem.feature.referral.presentation.R
|
||||
|
||||
@Composable
|
||||
internal fun NonParticipateBottomBlock(onAgreementClicked: () -> Unit, onParticipateClicked: () -> Unit) {
|
||||
internal fun NonParticipateBottomBlock(onAgreementClick: () -> Unit, onParticipateClick: () -> Unit) {
|
||||
Column {
|
||||
AgreementText(
|
||||
firstPartResId = R.string.referral_tos_not_enroled_prefix,
|
||||
onClicked = onAgreementClicked,
|
||||
onClick = onAgreementClick,
|
||||
)
|
||||
PrimaryEndIconButton(
|
||||
modifier = Modifier.padding(all = TangemTheme.dimens.spacing16),
|
||||
text = stringResource(id = R.string.referral_button_participate),
|
||||
iconResId = R.drawable.ic_tangem_24,
|
||||
onClicked = onParticipateClicked,
|
||||
onClick = onParticipateClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(widthDp = 360, showBackground = true)
|
||||
@Composable
|
||||
fun Preview_NonParticipateBottomBlock_InLightTheme() {
|
||||
private fun Preview_NonParticipateBottomBlock_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
Column(Modifier.background(TangemTheme.colors.background.primary)) {
|
||||
NonParticipateBottomBlock(onAgreementClicked = {}, onParticipateClicked = {})
|
||||
NonParticipateBottomBlock(onAgreementClick = {}, onParticipateClick = {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(widthDp = 360, showBackground = true)
|
||||
@Composable
|
||||
fun Preview_NonParticipateBottomBlock_InDarkTheme() {
|
||||
private fun Preview_NonParticipateBottomBlock_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
Column(Modifier.background(TangemTheme.colors.background.primary)) {
|
||||
NonParticipateBottomBlock(onAgreementClicked = {}, onParticipateClicked = {})
|
||||
NonParticipateBottomBlock(onAgreementClick = {}, onParticipateClick = {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -36,10 +36,10 @@ internal fun ParticipateBottomBlock(
|
|||
purchasedWalletCount: Int,
|
||||
code: String,
|
||||
shareLink: String,
|
||||
onAgreementClicked: () -> Unit,
|
||||
showCopySnackbar: () -> Unit,
|
||||
onCopyClicked: () -> Unit,
|
||||
onShareClicked: () -> Unit,
|
||||
onAgreementClick: () -> Unit,
|
||||
onShowCopySnackbar: () -> Unit,
|
||||
onCopyClick: () -> Unit,
|
||||
onShareClick: () -> Unit,
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
|
|
@ -62,11 +62,11 @@ internal fun ParticipateBottomBlock(
|
|||
AdditionalButtons(
|
||||
code = code,
|
||||
shareLink = shareLink,
|
||||
showCopySnackbar = showCopySnackbar,
|
||||
onCopyClicked = onCopyClicked,
|
||||
onShareClicked = onShareClicked,
|
||||
onShowCopySnackbar = onShowCopySnackbar,
|
||||
onCopyClick = onCopyClick,
|
||||
onShareClick = onShareClick,
|
||||
)
|
||||
AgreementText(firstPartResId = R.string.referral_tos_enroled_prefix, onClicked = onAgreementClicked)
|
||||
AgreementText(firstPartResId = R.string.referral_tos_enroled_prefix, onClick = onAgreementClick)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -106,9 +106,9 @@ private fun PersonalCodeCard(code: String) {
|
|||
private fun AdditionalButtons(
|
||||
code: String,
|
||||
shareLink: String,
|
||||
showCopySnackbar: () -> Unit,
|
||||
onCopyClicked: () -> Unit,
|
||||
onShareClicked: () -> Unit,
|
||||
onShowCopySnackbar: () -> Unit,
|
||||
onCopyClick: () -> Unit,
|
||||
onShareClick: () -> Unit,
|
||||
) {
|
||||
val clipboardManager = LocalClipboardManager.current
|
||||
val hapticFeedback = LocalHapticFeedback.current
|
||||
|
|
@ -121,11 +121,11 @@ private fun AdditionalButtons(
|
|||
modifier = Modifier.weight(1f),
|
||||
text = stringResource(id = R.string.common_copy),
|
||||
iconResId = R.drawable.ic_copy_24,
|
||||
onClicked = {
|
||||
onCopyClicked.invoke()
|
||||
onClick = {
|
||||
onCopyClick.invoke()
|
||||
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
|
||||
clipboardManager.setText(AnnotatedString(code))
|
||||
showCopySnackbar()
|
||||
onShowCopySnackbar()
|
||||
},
|
||||
)
|
||||
|
||||
|
|
@ -134,8 +134,8 @@ private fun AdditionalButtons(
|
|||
modifier = Modifier.weight(1f),
|
||||
text = stringResource(id = R.string.common_share),
|
||||
iconResId = R.drawable.ic_share_24,
|
||||
onClicked = {
|
||||
onShareClicked.invoke()
|
||||
onClick = {
|
||||
onShareClick.invoke()
|
||||
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
|
||||
context.shareText(context.getString(R.string.referral_share_link, shareLink))
|
||||
},
|
||||
|
|
@ -155,17 +155,17 @@ private fun Context.shareText(text: String) {
|
|||
|
||||
@Preview(widthDp = 360, showBackground = true)
|
||||
@Composable
|
||||
fun Preview_ParticipateBottomBlock_InLightTheme() {
|
||||
private fun Preview_ParticipateBottomBlock_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
Column(Modifier.background(TangemTheme.colors.background.primary)) {
|
||||
ParticipateBottomBlock(
|
||||
purchasedWalletCount = 3,
|
||||
code = "x4JdK",
|
||||
shareLink = "",
|
||||
onAgreementClicked = {},
|
||||
showCopySnackbar = {},
|
||||
onCopyClicked = {},
|
||||
onShareClicked = {},
|
||||
onAgreementClick = {},
|
||||
onShowCopySnackbar = {},
|
||||
onCopyClick = {},
|
||||
onShareClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -173,17 +173,17 @@ fun Preview_ParticipateBottomBlock_InLightTheme() {
|
|||
|
||||
@Preview(widthDp = 360, showBackground = true)
|
||||
@Composable
|
||||
fun Preview_ParticipateBottomBlock_InDarkTheme() {
|
||||
private fun Preview_ParticipateBottomBlock_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
Column(Modifier.background(TangemTheme.colors.background.primary)) {
|
||||
ParticipateBottomBlock(
|
||||
purchasedWalletCount = 3,
|
||||
code = "x4JdK",
|
||||
shareLink = "",
|
||||
onAgreementClicked = {},
|
||||
showCopySnackbar = {},
|
||||
onCopyClicked = {},
|
||||
onShareClicked = {},
|
||||
onAgreementClick = {},
|
||||
onShowCopySnackbar = {},
|
||||
onCopyClick = {},
|
||||
onShareClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ internal fun ReferralScreen(stateHolder: ReferralStateHolder) {
|
|||
content = {
|
||||
ReferralContent(
|
||||
stateHolder = stateHolder,
|
||||
onAgreementClicked = {
|
||||
onAgreementClick = {
|
||||
stateHolder.analytics.onAgreementClicked.invoke()
|
||||
coroutineScope.launch {
|
||||
if (bottomSheetScaffoldState.bottomSheetState.isCollapsed) {
|
||||
|
|
@ -119,7 +119,7 @@ internal fun ReferralScreen(stateHolder: ReferralStateHolder) {
|
|||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
private fun ReferralContent(stateHolder: ReferralStateHolder, onAgreementClicked: () -> Unit) {
|
||||
private fun ReferralContent(stateHolder: ReferralStateHolder, onAgreementClick: () -> Unit) {
|
||||
val isCopyButtonPressed = remember { mutableStateOf(false) }
|
||||
|
||||
Box {
|
||||
|
|
@ -140,8 +140,8 @@ private fun ReferralContent(stateHolder: ReferralStateHolder, onAgreementClicked
|
|||
item {
|
||||
ReferralInfo(
|
||||
stateHolder = stateHolder,
|
||||
onAgreementClicked = onAgreementClicked,
|
||||
showCopySnackbar = { isCopyButtonPressed.value = true },
|
||||
onAgreementClick = onAgreementClick,
|
||||
onShowCopySnackbar = { isCopyButtonPressed.value = true },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -179,8 +179,8 @@ private fun Header() {
|
|||
@Composable
|
||||
private fun ReferralInfo(
|
||||
stateHolder: ReferralStateHolder,
|
||||
onAgreementClicked: () -> Unit,
|
||||
showCopySnackbar: () -> Unit,
|
||||
onAgreementClick: () -> Unit,
|
||||
onShowCopySnackbar: () -> Unit,
|
||||
) {
|
||||
when (val state = stateHolder.referralInfoState) {
|
||||
is ReferralInfoState.ParticipantContent -> {
|
||||
|
|
@ -189,18 +189,18 @@ private fun ReferralInfo(
|
|||
purchasedWalletCount = state.purchasedWalletCount,
|
||||
code = state.code,
|
||||
shareLink = state.shareLink,
|
||||
onAgreementClicked = onAgreementClicked,
|
||||
showCopySnackbar = showCopySnackbar,
|
||||
onCopyClicked = stateHolder.analytics.onCopyClicked,
|
||||
onShareClicked = stateHolder.analytics.onShareClicked,
|
||||
onAgreementClick = onAgreementClick,
|
||||
onShowCopySnackbar = onShowCopySnackbar,
|
||||
onCopyClick = stateHolder.analytics.onCopyClicked,
|
||||
onShareClick = stateHolder.analytics.onShareClicked,
|
||||
)
|
||||
}
|
||||
is ReferralInfoState.NonParticipantContent -> {
|
||||
Conditions(state = state)
|
||||
VerticalSpacer(spaceResId = R.dimen.spacing44)
|
||||
NonParticipateBottomBlock(
|
||||
onAgreementClicked = onAgreementClicked,
|
||||
onParticipateClicked = state.onParticipateClicked,
|
||||
onAgreementClick = onAgreementClick,
|
||||
onParticipateClick = state.onParticipateClicked,
|
||||
)
|
||||
}
|
||||
is ReferralInfoState.Loading -> {
|
||||
|
|
@ -465,7 +465,7 @@ private fun BoxScope.CopySnackbarHost(isCopyButtonPressed: MutableState<Boolean>
|
|||
|
||||
@Preview(widthDp = 360, showBackground = true)
|
||||
@Composable
|
||||
fun Preview_ReferralScreen_Participant_InLightTheme() {
|
||||
private fun Preview_ReferralScreen_Participant_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
ReferralScreen(
|
||||
stateHolder = ReferralStateHolder(
|
||||
|
|
@ -493,7 +493,7 @@ fun Preview_ReferralScreen_Participant_InLightTheme() {
|
|||
|
||||
@Preview(widthDp = 360, showBackground = true)
|
||||
@Composable
|
||||
fun Preview_ReferralScreen_Participant_InDarkTheme() {
|
||||
private fun Preview_ReferralScreen_Participant_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
ReferralScreen(
|
||||
stateHolder = ReferralStateHolder(
|
||||
|
|
@ -521,7 +521,7 @@ fun Preview_ReferralScreen_Participant_InDarkTheme() {
|
|||
|
||||
@Preview(widthDp = 360, showBackground = true)
|
||||
@Composable
|
||||
fun Preview_ReferralScreen_NonParticipant_InLightTheme() {
|
||||
private fun Preview_ReferralScreen_NonParticipant_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
ReferralScreen(
|
||||
stateHolder = ReferralStateHolder(
|
||||
|
|
@ -546,7 +546,7 @@ fun Preview_ReferralScreen_NonParticipant_InLightTheme() {
|
|||
|
||||
@Preview(widthDp = 360, showBackground = true)
|
||||
@Composable
|
||||
fun Preview_ReferralScreen_NonParticipant_InDarkTheme() {
|
||||
private fun Preview_ReferralScreen_NonParticipant_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
ReferralScreen(
|
||||
stateHolder = ReferralStateHolder(
|
||||
|
|
@ -571,7 +571,7 @@ fun Preview_ReferralScreen_NonParticipant_InDarkTheme() {
|
|||
|
||||
@Preview(widthDp = 360, showBackground = true)
|
||||
@Composable
|
||||
fun Preview_ReferralScreen_Loading_InLightTheme() {
|
||||
private fun Preview_ReferralScreen_Loading_InLightTheme() {
|
||||
TangemTheme(isDark = false) {
|
||||
ReferralScreen(
|
||||
stateHolder = ReferralStateHolder(
|
||||
|
|
@ -590,7 +590,7 @@ fun Preview_ReferralScreen_Loading_InLightTheme() {
|
|||
|
||||
@Preview(widthDp = 360, showBackground = true)
|
||||
@Composable
|
||||
fun Preview_ReferralScreen_Loading_InDarkTheme() {
|
||||
private fun Preview_ReferralScreen_Loading_InDarkTheme() {
|
||||
TangemTheme(isDark = true) {
|
||||
ReferralScreen(
|
||||
stateHolder = ReferralStateHolder(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue