Showing
1 changed file
with
15 additions
and
3 deletions
... | @@ -69,6 +69,7 @@ import SwiftEventBus | ... | @@ -69,6 +69,7 @@ import SwiftEventBus |
69 | public var loyaltyBadge:swiftApi.LoyaltyBadgeModel = swiftApi().getLoyaltyBadge() | 69 | public var loyaltyBadge:swiftApi.LoyaltyBadgeModel = swiftApi().getLoyaltyBadge() |
70 | public var profile:swiftApi.ProfileModel? = swiftApi().getConsumer() | 70 | public var profile:swiftApi.ProfileModel? = swiftApi().getConsumer() |
71 | public var unifiedCoupons:Array<swiftApi.UnifiedCouponModel> = [] | 71 | public var unifiedCoupons:Array<swiftApi.UnifiedCouponModel> = [] |
72 | + public var smCoupons:Array<swiftApi.CouponItemModel> = [] // swiftApi().getSMCouponList() | ||
72 | public var boxCoupons:Array<swiftApi.ActiveBoxCouponModel> = swiftApi().getActiveBoxCoupons() | 73 | public var boxCoupons:Array<swiftApi.ActiveBoxCouponModel> = swiftApi().getActiveBoxCoupons() |
73 | 74 | ||
74 | var timerWallet: DispatchSourceTimer? | 75 | var timerWallet: DispatchSourceTimer? |
... | @@ -114,6 +115,15 @@ import SwiftEventBus | ... | @@ -114,6 +115,15 @@ import SwiftEventBus |
114 | } | 115 | } |
115 | } | 116 | } |
116 | 117 | ||
118 | + SwiftEventBus.onBackgroundThread(self, name: "sm_coupons_fetched") { result in | ||
119 | + | ||
120 | + DispatchQueue.main.async { | ||
121 | + self.smCoupons = swiftApi().getSMCouponList() | ||
122 | + self.handleSpinnerAndEmptyView() | ||
123 | + self.tableView.reloadData() | ||
124 | + } | ||
125 | + } | ||
126 | + | ||
117 | SwiftEventBus.onBackgroundThread(self, name: "vouchers_fetched") { result in | 127 | SwiftEventBus.onBackgroundThread(self, name: "vouchers_fetched") { result in |
118 | 128 | ||
119 | DispatchQueue.main.async { | 129 | DispatchQueue.main.async { |
... | @@ -559,6 +569,7 @@ import SwiftEventBus | ... | @@ -559,6 +569,7 @@ import SwiftEventBus |
559 | self.coupons = swiftApi().getCouponList() | 569 | self.coupons = swiftApi().getCouponList() |
560 | // TODO: Uncomment when UnifiedCoupons will be shown again | 570 | // TODO: Uncomment when UnifiedCoupons will be shown again |
561 | self.unifiedCoupons = swiftApi().getUnifiedCouponList() | 571 | self.unifiedCoupons = swiftApi().getUnifiedCouponList() |
572 | + self.smCoupons = swiftApi().getSMCouponList() | ||
562 | // TODO: Maybe add this | 573 | // TODO: Maybe add this |
563 | self.matchOldSMCoupons() | 574 | self.matchOldSMCoupons() |
564 | // <=== | 575 | // <=== |
... | @@ -756,7 +767,7 @@ import SwiftEventBus | ... | @@ -756,7 +767,7 @@ import SwiftEventBus |
756 | 767 | ||
757 | self.showSpinner = true | 768 | self.showSpinner = true |
758 | 769 | ||
759 | - if (self.dfyCoupons.count == 0 && self.unifiedCoupons.count == 0 && self.coupons.count == 0) { | 770 | + if (self.dfyCoupons.count == 0 && self.unifiedCoupons.count == 0 && self.smCoupons.count == 0 && self.coupons.count == 0) { |
760 | self.showActiveCouponsBanners = false | 771 | self.showActiveCouponsBanners = false |
761 | 772 | ||
762 | } else { | 773 | } else { |
... | @@ -766,7 +777,7 @@ import SwiftEventBus | ... | @@ -766,7 +777,7 @@ import SwiftEventBus |
766 | } else { | 777 | } else { |
767 | self.showSpinner = false | 778 | self.showSpinner = false |
768 | 779 | ||
769 | - if (self.dfyCoupons.count == 0 && self.unifiedCoupons.count == 0 && self.coupons.count == 0) { | 780 | + if (self.dfyCoupons.count == 0 && self.unifiedCoupons.count == 0 && self.smCoupons.count == 0 && self.coupons.count == 0) { |
770 | self.showActiveCouponsBanners = false | 781 | self.showActiveCouponsBanners = false |
771 | 782 | ||
772 | if (swiftApi().getShowVouchersBanner() == "null") { | 783 | if (swiftApi().getShowVouchersBanner() == "null") { |
... | @@ -1393,7 +1404,8 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -1393,7 +1404,8 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{ |
1393 | if (indexPath.section == 0) { | 1404 | if (indexPath.section == 0) { |
1394 | let cell = tableView.dequeueReusableCell(withIdentifier: "WalletActiveCouponsScrollTableViewCellId", for: indexPath) as! WalletActiveCouponsScrollTableViewCell | 1405 | let cell = tableView.dequeueReusableCell(withIdentifier: "WalletActiveCouponsScrollTableViewCellId", for: indexPath) as! WalletActiveCouponsScrollTableViewCell |
1395 | // cell.configureCell(dfyCount: self.dfyCoupons.count, smCount: self.unifiedCoupons.count, gfyCount: self.coupons.count, boxCount: self.boxCoupons.count) | 1406 | // cell.configureCell(dfyCount: self.dfyCoupons.count, smCount: self.unifiedCoupons.count, gfyCount: self.coupons.count, boxCount: self.boxCoupons.count) |
1396 | - cell.configureCell(dfyCount: self.dfyCoupons.count, smCount: self.unifiedCoupons.count, gfyCount: self.coupons.count, boxCount: 0) | 1407 | + let smCount = self.unifiedCoupons.count + self.smCoupons.count |
1408 | + cell.configureCell(dfyCount: self.dfyCoupons.count, smCount: smCount, gfyCount: self.coupons.count, boxCount: 0) | ||
1397 | cell.parent = self | 1409 | cell.parent = self |
1398 | return cell | 1410 | return cell |
1399 | 1411 | ... | ... |
-
Please register or login to post a comment