Updated on 2026-08-14
This commit is contained in:
parent
ee0baa5102
commit
942114d48b
3 changed files with 18 additions and 4 deletions
|
|
@ -90,10 +90,15 @@ internal class TangemPaySelectPlanModel @Inject constructor(
|
|||
|
||||
val tierId = transition.plan.tierId
|
||||
analytics.send(TangemPayAnalyticsEvents.Tiers.PlanSelectedClick(tierId))
|
||||
analytics.send(TangemPayAnalyticsEvents.Tiers.PlanChangeConfirmationScreenShowed(tierId))
|
||||
|
||||
isConfirm = true
|
||||
state.update { buildState() }
|
||||
when (params.source) {
|
||||
TangemPaySelectPlanSource.TIERS_ONBOARDING -> applyTransition(transition)
|
||||
TangemPaySelectPlanSource.CHANGE_PLAN -> {
|
||||
analytics.send(TangemPayAnalyticsEvents.Tiers.PlanChangeConfirmationScreenShowed(tierId))
|
||||
isConfirm = true
|
||||
state.update { buildState() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun onComparePlansClick() {
|
||||
|
|
@ -125,9 +130,13 @@ internal class TangemPaySelectPlanModel @Inject constructor(
|
|||
}
|
||||
|
||||
private fun onConfirmClick() {
|
||||
val transition = allowedTransitions.getOrNull(selectedIndex) ?: return
|
||||
applyTransition(transition)
|
||||
}
|
||||
|
||||
private fun applyTransition(transition: TangemPayTariffPlanTransition) {
|
||||
if (isProcessing) return
|
||||
|
||||
val transition = allowedTransitions.getOrNull(selectedIndex) ?: return
|
||||
if (transition.type == TangemPayTariffPlanTransition.Type.UPGRADE) {
|
||||
analytics.send(TangemPayAnalyticsEvents.Tiers.PlanChangeUpgradeClicked())
|
||||
}
|
||||
|
|
@ -193,6 +202,7 @@ internal class TangemPaySelectPlanModel @Inject constructor(
|
|||
)
|
||||
|
||||
private fun buildSelectContent() = TangemPaySelectPlanUM.Content.Select(
|
||||
isProcessing = isProcessing,
|
||||
onComparePlansClick = ::onComparePlansClick,
|
||||
onSelectClick = ::onSelectClick,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -229,6 +229,7 @@ private fun SelectFooter(content: TangemPaySelectPlanUM.Content.Select, modifier
|
|||
size = TangemButton.Size.X12,
|
||||
text = resourceReference(R.string.tangempay_select_plan_compare),
|
||||
onClick = content.onComparePlansClick,
|
||||
isEnabled = !content.isProcessing,
|
||||
)
|
||||
TangemButton(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
|
|
@ -236,6 +237,7 @@ private fun SelectFooter(content: TangemPaySelectPlanUM.Content.Select, modifier
|
|||
size = TangemButton.Size.X12,
|
||||
text = resourceReference(R.string.tangempay_select_plan_btn_select),
|
||||
onClick = content.onSelectClick,
|
||||
isLoading = content.isProcessing,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -350,6 +352,7 @@ private fun previewState(isConfirm: Boolean) = TangemPaySelectPlanUM(
|
|||
)
|
||||
} else {
|
||||
TangemPaySelectPlanUM.Content.Select(
|
||||
isProcessing = false,
|
||||
onComparePlansClick = {},
|
||||
onSelectClick = {},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ internal data class TangemPaySelectPlanUM(
|
|||
sealed interface Content {
|
||||
|
||||
data class Select(
|
||||
val isProcessing: Boolean,
|
||||
val onComparePlansClick: () -> Unit,
|
||||
val onSelectClick: () -> Unit,
|
||||
) : Content
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue