@@ -12,16 +12,16 @@ public struct PledgeShippingLocationViewData {
1212public protocol PledgeShippingLocationViewModelInputs {
1313 func configureWith( data: PledgeShippingLocationViewData )
1414 func shippingLocationButtonTapped( )
15- func shippingRulesCancelButtonTapped ( )
16- func shippingRuleUpdated ( to rule: ShippingRule )
15+ func shippingLocationCancelButtonTapped ( )
16+ func shippingLocationUpdated ( to rule: Location )
1717 func viewDidLoad( )
1818}
1919
2020public protocol PledgeShippingLocationViewModelOutputs {
2121 var adaptableStackViewIsHidden : Signal < Bool , Never > { get }
2222 var dismissShippingRules : Signal < Void , Never > { get }
23- var presentShippingRules : Signal < ( Project , [ ShippingRule ] , ShippingRule ) , Never > { get }
24- var notifyDelegateOfSelectedShippingRule : Signal < ShippingRule , Never > { get }
23+ var presentShippingRules : Signal < ( Project , [ ShippingRule ] , Location ) , Never > { get }
24+ var notifyDelegateOfSelectedShippingLocation : Signal < Location , Never > { get }
2525 var shimmerLoadingViewIsHidden : Signal < Bool , Never > { get }
2626 var shippingLocationButtonTitle : Signal < String , Never > { get }
2727 var shippingRulesError : Signal < String , Never > { get }
@@ -76,29 +76,30 @@ public final class PledgeShippingLocationViewModel: PledgeShippingLocationViewMo
7676 selectedLocationId
7777 )
7878 . map ( determineShippingRule)
79+ . map { $0? . location }
7980
8081 self . shippingRulesError = shippingRulesEvent. errors ( ) . map { _ in
8182 Strings . We_were_unable_to_load_the_shipping_destinations ( )
8283 }
8384
84- self . notifyDelegateOfSelectedShippingRule = Signal . merge (
85+ self . notifyDelegateOfSelectedShippingLocation = Signal . merge (
8586 initialShippingRule. skipNil ( ) ,
86- self . shippingRuleUpdatedSignal
87+ self . shippingLocationUpdatedSignal
8788 )
8889
8990 self . presentShippingRules = Signal . combineLatest (
9091 project,
9192 shippingRulesEvent. values ( ) ,
92- self . notifyDelegateOfSelectedShippingRule
93+ self . notifyDelegateOfSelectedShippingLocation
9394 )
9495 . takeWhen ( self . shippingLocationButtonTappedSignal)
9596
96- self . shippingLocationButtonTitle = self . notifyDelegateOfSelectedShippingRule
97- . map { $0. location . localizedName }
97+ self . shippingLocationButtonTitle = self . notifyDelegateOfSelectedShippingLocation
98+ . map { $0. localizedName }
9899
99100 self . dismissShippingRules = Signal . merge (
100- self . shippingRulesCancelButtonTappedProperty . signal,
101- self . shippingRuleUpdatedSignal . signal
101+ self . shippingLocationCancelButtonTappedProperty . signal,
102+ self . shippingLocationUpdatedSignal . signal
102103 . ignoreValues ( )
103104 . ksr_debounce ( . milliseconds( 300 ) , on: AppEnvironment . current. scheduler)
104105 )
@@ -115,14 +116,15 @@ public final class PledgeShippingLocationViewModel: PledgeShippingLocationViewMo
115116 self . shippingLocationButtonTappedObserver. send ( value: ( ) )
116117 }
117118
118- private let shippingRulesCancelButtonTappedProperty = MutableProperty ( ( ) )
119- public func shippingRulesCancelButtonTapped ( ) {
120- self . shippingRulesCancelButtonTappedProperty . value = ( )
119+ private let shippingLocationCancelButtonTappedProperty = MutableProperty ( ( ) )
120+ public func shippingLocationCancelButtonTapped ( ) {
121+ self . shippingLocationCancelButtonTappedProperty . value = ( )
121122 }
122123
123- private let ( shippingRuleUpdatedSignal, shippingRuleUpdatedObserver) = Signal < ShippingRule , Never > . pipe ( )
124- public func shippingRuleUpdated( to rule: ShippingRule ) {
125- self . shippingRuleUpdatedObserver. send ( value: rule)
124+ private let ( shippingLocationUpdatedSignal, shippingLocationUpdatedObserver) = Signal < Location , Never >
125+ . pipe ( )
126+ public func shippingLocationUpdated( to location: Location ) {
127+ self . shippingLocationUpdatedObserver. send ( value: location)
126128 }
127129
128130 private let viewDidLoadProperty = MutableProperty ( ( ) )
@@ -132,8 +134,8 @@ public final class PledgeShippingLocationViewModel: PledgeShippingLocationViewMo
132134
133135 public let adaptableStackViewIsHidden : Signal < Bool , Never >
134136 public let dismissShippingRules : Signal < Void , Never >
135- public let presentShippingRules : Signal < ( Project , [ ShippingRule ] , ShippingRule ) , Never >
136- public let notifyDelegateOfSelectedShippingRule : Signal < ShippingRule , Never >
137+ public let presentShippingRules : Signal < ( Project , [ ShippingRule ] , Location ) , Never >
138+ public let notifyDelegateOfSelectedShippingLocation : Signal < Location , Never >
137139 public let shimmerLoadingViewIsHidden : Signal < Bool , Never >
138140 public let shippingLocationButtonTitle : Signal < String , Never >
139141 public let shippingRulesError : Signal < String , Never >
0 commit comments