Skip to content

Commit

Permalink
MLB-1799 (#2169)
Browse files Browse the repository at this point in the history
* Added plot selected badge to PledgeItemizedDetails

- added plotSelected prop, created component, added tests and added previews

* fix

* added 'false' default value for plotSelected

* added plot disclaimer text for checkout screen

* fix

* fix ktlint

* fix
  • Loading branch information
jlplks authored Nov 18, 2024
1 parent 48eb734 commit e62ebf8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ fun CheckoutScreen(
newPaymentMethodClicked: () -> Unit,
onDisclaimerItemClicked: (disclaimerItem: DisclaimerItems) -> Unit,
onAccountabilityLinkClicked: () -> Unit,
onChangedPaymentMethod: (StoredCard?) -> Unit = {}
onChangedPaymentMethod: (StoredCard?) -> Unit = {},
plotSelected: Boolean = false,
) {
val selectedOption = remember {
mutableStateOf(
Expand Down Expand Up @@ -215,7 +216,9 @@ fun CheckoutScreen(
.fillMaxWidth(),
onClickAction = { onPledgeCtaClicked(selectedOption.value) },
isEnabled = project.acceptedCardType(selectedOption.value?.type()) || selectedOption.value?.isFromPaymentSheet() ?: false,
text = if (pledgeReason == PledgeReason.PLEDGE || pledgeReason == PledgeReason.LATE_PLEDGE) stringResource(id = R.string.Pledge) + " $totalAmountString" else stringResource(
text = if (pledgeReason == PledgeReason.PLEDGE || pledgeReason == PledgeReason.LATE_PLEDGE) stringResource(
id = R.string.Pledge
) + " $totalAmountString" else stringResource(
id = R.string.Confirm
)
)
Expand Down Expand Up @@ -469,12 +472,15 @@ fun CheckoutScreen(

Spacer(modifier = Modifier.height(dimensions.paddingMediumSmall))

val resourceString = stringResource(R.string.If_the_project_reaches_its_funding_goal_you_will_be_charged_total_on_project_deadline_and_receive_proof_of_pledge)
val resourceString =
stringResource(R.string.If_the_project_reaches_its_funding_goal_you_will_be_charged_total_on_project_deadline_and_receive_proof_of_pledge)
val disclaimerText = environment.ksString()?.format(
resourceString,
"total", totalAmountString,
"project_deadline", project.deadline()?.let { DateTimeUtils.longDate(it) }
) ?: ""
val plotDisclaimerText =
stringResource(R.string.If_the_project_reaches_its_funding_goal_you_will_be_charged_total_on_project_deadline_and_receive_proof_of_pledge)
val isNoReward = selectedReward?.let { RewardUtils.isNoReward(it) } ?: false
if (!isNoReward) {
ItemizedRewardListContainer(
Expand All @@ -489,7 +495,7 @@ fun CheckoutScreen(
totalBonusSupport = totalBonusSupportString,
deliveryDateString = deliveryDateString,
rewardsHaveShippables = rewardsHaveShippables,
disclaimerText = disclaimerText,
disclaimerText = if (plotSelected) plotDisclaimerText else disclaimerText,
plotSelected = false
)
} else {
Expand All @@ -500,12 +506,14 @@ fun CheckoutScreen(
initialBonusSupport = initialBonusSupportString,
totalBonusSupport = totalAmountString,
shippingAmount = shippingAmount,
disclaimerText = disclaimerText,
disclaimerText = if (plotSelected) plotDisclaimerText else disclaimerText,
plotSelected = false
)
}

if (environment.ksCurrency().isNotNull() && environment.ksString().isNotNull() && currentShippingRule.isNotNull()) {
if (environment.ksCurrency().isNotNull() && environment.ksString()
.isNotNull() && currentShippingRule.isNotNull()
) {
val estimatedShippingRangeString =
RewardViewUtils.getEstimatedShippingCostString(
context = LocalContext.current,
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,5 @@
<string name="fpo_you_will_be_charged_for_your_pledge_over_four_payments_at_no_extra_cost">You will be charged for your pledge over four payments, at no extra cost. </string>
<string name="fpo_the_first_charge_will_be_24_hours_after_the_project_ends_successfully">The first charge will be 24 hours after the project ends successfully, then every 2 weeks until fully paid. When this option is selected no further edits can be made to your pledge.</string>
<string name="fpo_charged_as_4_payments">Charged as 4 payments</string>
<string name="fpo_if_the_project_reaches_its_funding_goal_the_first_charge_of_20_will_be_collected_on_march_15_2024">If the project reaches its funding goal, the first charge of $20 will be collected on March 15, 2024.</string>
</resources>

0 comments on commit e62ebf8

Please sign in to comment.