-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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-1631] Remove Shipping Dropdown From Add-Ons #2097
Conversation
* No longer using individually passed in Rewards
…edge flow knows about the correct shipping rule * this is temporary since shipping will be removed from checkout during this milestone
52e21c9
to
aeb9a21
Compare
ca55f48
to
299efac
Compare
299efac
to
6e7eac6
Compare
Generated by 🚫 Danger |
@@ -39,6 +39,7 @@ public typealias PKPaymentData = (displayName: String, network: String, transact | |||
public struct PledgeViewData: Equatable { | |||
public let project: Project | |||
public let rewards: [Reward] | |||
public let selectedShippingRule: ShippingRule? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am adding this so that the ShippingRule will be passed along to Confirm Details (late pledge flow) or PledgeViewController (crowdfunding flow) and not break any existing behavior.
This is why you see updates in the other view models and most of the tests. They get configured with this PledgeViewData struct and, therefore, need this new update.
|
||
self.configurePledgeShippingLocationViewControllerWithData = fetchShippingLocations | ||
.map { project, reward, initialLocationId in (project, reward, false, initialLocationId) } | ||
let selectedShippingRule = configData.map(\.selectedShippingRule) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now being passed in, from Rewards screen, via the configuration object
let checkoutPropertiesData = checkoutProperties( | ||
from: project, | ||
baseReward: baseReward, | ||
addOnRewards: selectedRewards, | ||
selectedQuantities: configData.selectedQuantities, | ||
additionalPledgeAmount: additionalPledgeAmount, | ||
pledgeTotal: pledgeTotal, | ||
shippingTotal: shippingTotal, | ||
shippingTotal: 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defaulting the shipping total to 0 so that everything can remain backward compatible. Eventually, the aim is to remove shipping from checkout API calls.
@@ -100,6 +100,7 @@ final class RewardsCollectionViewController: UICollectionViewController { | |||
self.setupConstraints() | |||
|
|||
self.viewModel.inputs.viewDidLoad() | |||
self.viewModel.inputs.shippingRuleSelected(nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a workaround that I'm not sold on. The selected ShippingRule needs to emit a signal for the view model outputs that trigger navigation to the add-ons or pledge screens to complete. However, in the case where there are only rewards without shipping (Digital or Local pickup only), the Shipping Dropdown will not appear on the screen. Therefore, a ShippingRule will not be selected, and the navigation outputs will not complete.
So the solution here is to emit nil
on viewDidLoad so they can. I imagine there is a way to handle this in ReactiveSwift that I'm missing, but for now, I'm moving forward with this approach to keep the development going.
@@ -285,7 +243,7 @@ public final class RewardAddOnSelectionViewModel: RewardAddOnSelectionViewModelT | |||
|
|||
let combinedPledgeTotal = Signal.combineLatest( | |||
additionalPledgeAmount, | |||
allRewardsShippingTotal, | |||
additionalPledgeAmount.mapConst(0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mapping this to a const of 0. explanation in this comment
* WIP: populate shipping countries using the project's rewards * No longer using individually passed in Rewards * remove shipping dropdown from Add-Ons View Controller * select reward with selected ShippingRule, or nil if no shippable rewards * update RewardsCollectionViewModel Tests * update RewardAddOnSelectionViewModel Tests * update PledgeViewModel Tests * update ConfirmDetailsViewModel Tests * use passed in selectedShippingRule, if not nil, so that the manage pledge flow knows about the correct shipping rule * this is temporary since shipping will be removed from checkout during this milestone * update ManagePledgeViewModel Tests * update snapshot tests
This reverts commit b9398aa.
📲 What
Removes the shipping drop-down from our AddOns screen
🤔 Why
The shipping dropdown will only be used on the Rewards screen to filter rewards shown based on location. This is the first step in removing the dropdown from the other places in the app where it's displayed.
🛠 How
RewardAddOnsSelectionViewController
RewardsCollectionViewModel
make sure the selectedShippingRule
is passed to the AddOns VM so that the correct AddOns are still fetched for the chosen reward.ShippingRule
along from the Rewards screen, I've added it as a property in ourPledgeViewData
struct. This is used to configure the AddOns screen and final Pledge screen.RewardAddOnsSelectionViewControllerTests
to use our newew orthogonalCombos approach. This is why so many snapshots have been deleted.👀 See
✅ Acceptance criteria
⏰ TODO