@@ -51,12 +51,12 @@ public final class PledgeShippingLocationViewModel: PledgeShippingLocationViewMo
5151 let shippingShouldBeginLoading = project
5252 . mapConst ( true )
5353
54- let shippingLocationsEvent = project
55- . switchMap { project in
56- shippingLocations ( forProject : project )
57- }
54+ let locations : Signal < [ Location ] , Never > = project. switchMap { p -> SignalProducer < [ Location ] , Never > in
55+ shippingLocations ( forProject : p )
56+ . demoteErrors ( replaceErrorWith : [ ] )
57+ }
5858
59- let shippingRulesLoadingCompleted = shippingLocationsEvent
59+ let shippingRulesLoadingCompleted = locations
6060 . mapConst ( false )
6161 . ksr_debounce ( . seconds( 1 ) , on: AppEnvironment . current. scheduler)
6262
@@ -70,20 +70,21 @@ public final class PledgeShippingLocationViewModel: PledgeShippingLocationViewMo
7070
7171 let initialShippingLocation = Signal . combineLatest (
7272 project,
73- shippingLocationsEvent ,
73+ locations ,
7474 selectedLocationId
7575 )
7676 . map ( determineShippingLocation)
7777
78- self . shippingRulesError = Signal . never // TODO:
78+ self . shippingRulesError = locations. map { $0 == [ ] ? " Shoot " : nil }
79+ . skipNil ( )
7980
8081 self . notifyDelegateOfSelectedShippingLocation = Signal . merge (
8182 initialShippingLocation. skipNil ( ) ,
8283 self . shippingLocationUpdatedSignal
8384 )
8485
8586 self . presentShippingLocations = Signal . combineLatest (
86- shippingLocationsEvent ,
87+ locations ,
8788 self . notifyDelegateOfSelectedShippingLocation
8889 )
8990 . takeWhen ( self . shippingLocationButtonTappedSignal)
0 commit comments