Manos Chorianopoulos

Add coupons_fetched event listener to WalletVC

...@@ -116,6 +116,8 @@ import UIKit ...@@ -116,6 +116,8 @@ import UIKit
116 116
117 func configureCell(totalCouponValue: Float, totalCouponDiscount: Float, unifiedCouponsDiscount: Float, forYouExpanded: Bool) { 117 func configureCell(totalCouponValue: Float, totalCouponDiscount: Float, unifiedCouponsDiscount: Float, forYouExpanded: Bool) {
118 118
119 + loyaltyBadge = swiftApi().getLoyaltyBadge()
120 +
119 if (forYouExpanded == false) { 121 if (forYouExpanded == false) {
120 sumBannerArrowImage.image = UIImage(named: "ic_down_dark_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) 122 sumBannerArrowImage.image = UIImage(named: "ic_down_dark_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
121 123
......
...@@ -72,7 +72,7 @@ import SwiftEventBus ...@@ -72,7 +72,7 @@ import SwiftEventBus
72 var seconds: Int = 0 72 var seconds: Int = 0
73 73
74 var totalCouponValue = swiftApi().getDealsCouponsSum() 74 var totalCouponValue = swiftApi().getDealsCouponsSum()
75 - let totalCouponDiscount = Float(round(100 * swiftApi().getLoyaltyBadge()._value) / 100) 75 + var totalCouponDiscount = Float(round(100 * swiftApi().getLoyaltyBadge()._value) / 100)
76 var unifiedCouponsDiscount:Float = 0.0 76 var unifiedCouponsDiscount:Float = 0.0
77 77
78 var forYouExpanded: Bool = false; 78 var forYouExpanded: Bool = false;
...@@ -82,6 +82,16 @@ import SwiftEventBus ...@@ -82,6 +82,16 @@ import SwiftEventBus
82 82
83 self.hidesBottomBarWhenPushed = true 83 self.hidesBottomBarWhenPushed = true
84 84
85 + SwiftEventBus.onBackgroundThread(self, name: "coupons_fetched") { result in
86 +
87 + DispatchQueue.main.async {
88 + self.coupons = swiftApi().getCouponList()
89 + self.totalCouponDiscount = Float(round(100 * swiftApi().getLoyaltyBadge()._value) / 100)
90 + self.loyaltyBadge = swiftApi().getLoyaltyBadge()
91 + self.tableView.reloadData()
92 + }
93 + }
94 +
85 // TODO: DELETE ===> 95 // TODO: DELETE ===>
86 // let coupon = swiftApi.ActiveDFYCouponModel() 96 // let coupon = swiftApi.ActiveDFYCouponModel()
87 // coupon._value = "12" 97 // coupon._value = "12"
......