Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MBL-1899] Checkout screen PLOT Badge #2223

Open
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

jovaniks
Copy link
Contributor

@jovaniks jovaniks commented Dec 16, 2024

📲 What

This PR adds a Pledge Over Time (PLOT) badge under the "Your pledge" section when PLOT is selected in the collection plan. It also updates the payment label and status label copy for PLOT-enabled pledges.

🤔 Why

Some background context on why the change is needed.

🛠 How

  • Added a Pledge Over Time badge to be displayed under the "Your pledge" section.

  • Updated the payments label to show "charged as 4 payments."

  • Updated the status label copy to display dynamic text:

    "If the project reaches its funding goal, the first charge of $20 will be collected on March 15, 2024."

👀 See

Simulator Screen Recording - iPhone SE (3rd generation) - 2024-12-16 at 10 19 42

✅ Acceptance criteria

  • The Pledge Over Time badge is displayed under "Your pledge" when PLOT is selected.
  • The payments label reads: "charged as 4 payments."
  • The status label copy displays the correct amount and scheduled collection date
    • Example: "If the project reaches its funding goal, the first charge of $20 will be collected on March 15, 2024."

⏰ TODO

  • Using real data from API when availble (MBL-1838)

@jovaniks jovaniks marked this pull request as draft December 16, 2024 18:18
@jovaniks jovaniks self-assigned this Dec 16, 2024
@jovaniks jovaniks marked this pull request as ready for review December 16, 2024 18:21
Copy link
Contributor

@ifosli ifosli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, good start! Left a couple comments where it looks like behavior might be broken when the flag is off (please check!) and what we're trying to do with late pledges.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a snapshot test here. It looks like this class doesn't have snapshot test coverage yet (and neither do the main view controllers), so it'd be nice to add both a test where PLOT ui shows and one where it doesn't. We really can't keep pushing off adding test coverage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely! I’ll add snapshot tests for both cases: when the PLOT UI shows and when it doesn’t. I’ll make sure to include those as part of this PR.

additionalPledgeAmount,
shippingSummaryViewData,
rewards,
self.pledgeOverTimeConfigData
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like this signal will only emit if the PLOT ui is visible. (If one signal from combineLatest never emits, the input will never all exist and the signal won't do anything.) You'll want to make sure this emits nil when the UI doesn't show.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed! I ensured that the signal emits even when the input is nil, and I verified it works as expected. Let me know if there’s anything else you’d like me to double-check.

@@ -238,7 +238,8 @@ public class NoShippingPostCampaignCheckoutViewModel: NoShippingPostCampaignChec
project: data.project,
total: pledgeTotal,
confirmationLabelHidden: true,
pledgeHasNoReward: pledgeHasNoRewards(rewards: rewardsData.rewards)
pledgeHasNoReward: pledgeHasNoRewards(rewards: rewardsData.rewards),
pledgeOverTimeData: nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is pledge over time an option for late pledges? If it is, why is this hardcoded to nil? If it's not, why are the PostCampaignPledgeRewardsSummaryTotalViewController changes required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this version (v1), we won’t support late pledges, but we will in V2. For now, it’s hardcoded to nil because we don’t need it here at the moment.

Regarding your last question, the changes in PostCampaignPledgeRewardsSummaryTotalViewController are required because this controller is used on the checkout screen to display the Pledge Amount, just below the Your Pledge table.

Screenshot 2024-12-13 at 11 36 17 a m

image

# Conflicts:
#	Kickstarter-iOS/Features/PledgeOverTime/Controller/PledgePaymentPlansViewController.swift
#	Kickstarter-iOS/Features/PledgeOverTime/Controller/PledgePaymentPlansViewControllerTest.swift
#	Kickstarter-iOS/Features/PledgeOverTime/Views/PledgePaymentPlanOptionView.swift
#	Library/ViewModels/NoShippingPledgeViewModel.swift
#	Library/ViewModels/PledgePaymentPlansOptionViewModel.swift
#	Library/ViewModels/PledgePaymentPlansOptionViewModelTest.swift
#	Library/ViewModels/PledgePaymentPlansViewModel.swift
#	Library/ViewModels/PledgePaymentPlansViewModelTest.swift
…99/checkout-plot-badge

# Conflicts:
#	Library/ViewModels/NoShippingPledgeViewModel.swift
Base automatically changed from jluna/MBL-1816/plot-ineligible-state to main December 18, 2024 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants