Manos Chorianopoulos

Add coupons_fetched event listener to WalletVC

......@@ -116,6 +116,8 @@ import UIKit
func configureCell(totalCouponValue: Float, totalCouponDiscount: Float, unifiedCouponsDiscount: Float, forYouExpanded: Bool) {
loyaltyBadge = swiftApi().getLoyaltyBadge()
if (forYouExpanded == false) {
sumBannerArrowImage.image = UIImage(named: "ic_down_dark_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
......
......@@ -72,7 +72,7 @@ import SwiftEventBus
var seconds: Int = 0
var totalCouponValue = swiftApi().getDealsCouponsSum()
let totalCouponDiscount = Float(round(100 * swiftApi().getLoyaltyBadge()._value) / 100)
var totalCouponDiscount = Float(round(100 * swiftApi().getLoyaltyBadge()._value) / 100)
var unifiedCouponsDiscount:Float = 0.0
var forYouExpanded: Bool = false;
......@@ -82,6 +82,16 @@ import SwiftEventBus
self.hidesBottomBarWhenPushed = true
SwiftEventBus.onBackgroundThread(self, name: "coupons_fetched") { result in
DispatchQueue.main.async {
self.coupons = swiftApi().getCouponList()
self.totalCouponDiscount = Float(round(100 * swiftApi().getLoyaltyBadge()._value) / 100)
self.loyaltyBadge = swiftApi().getLoyaltyBadge()
self.tableView.reloadData()
}
}
// TODO: DELETE ===>
// let coupon = swiftApi.ActiveDFYCouponModel()
// coupon._value = "12"
......