Showing
3 changed files
with
15 additions
and
0 deletions
| ... | @@ -37,6 +37,12 @@ import SwiftEventBus | ... | @@ -37,6 +37,12 @@ import SwiftEventBus |
| 37 | 37 | ||
| 38 | tableView.delegate = self | 38 | tableView.delegate = self |
| 39 | tableView.dataSource = self | 39 | tableView.dataSource = self |
| 40 | + | ||
| 41 | + SwiftEventBus.onBackgroundThread(self, name: "ccms_retrieved") { result in | ||
| 42 | + print("===== SwiftEventBus ccms_retrieved =====") | ||
| 43 | + campaigns = swiftApi().mergeGFYCCMSLoyaltyCampaigns(campaigns: swiftApi().getCCMSLoyaltyCampaigns()) | ||
| 44 | + tableView.reloadData() | ||
| 45 | + } | ||
| 40 | 46 | ||
| 41 | tableView.clipsToBounds = true | 47 | tableView.clipsToBounds = true |
| 42 | tableView.layer.cornerRadius = 30 | 48 | tableView.layer.cornerRadius = 30 | ... | ... |
| ... | @@ -25,6 +25,12 @@ import UIKit | ... | @@ -25,6 +25,12 @@ import UIKit |
| 25 | 25 | ||
| 26 | tableView.delegate = self | 26 | tableView.delegate = self |
| 27 | tableView.dataSource = self | 27 | tableView.dataSource = self |
| 28 | + | ||
| 29 | + SwiftEventBus.onBackgroundThread(self, name: "ccms_retrieved") { result in | ||
| 30 | + print("===== SwiftEventBus ccms_retrieved =====") | ||
| 31 | + campaigns = swiftApi().mergeGFYCCMSLoyaltyCampaigns(campaigns: swiftApi().getCCMSLoyaltyCampaigns()) | ||
| 32 | + tableView.reloadData() | ||
| 33 | + } | ||
| 28 | 34 | ||
| 29 | tableView.clipsToBounds = true | 35 | tableView.clipsToBounds = true |
| 30 | tableView.layer.cornerRadius = 30 | 36 | tableView.layer.cornerRadius = 30 | ... | ... |
| ... | @@ -7,6 +7,7 @@ | ... | @@ -7,6 +7,7 @@ |
| 7 | 7 | ||
| 8 | import Foundation | 8 | import Foundation |
| 9 | import SwiftUI | 9 | import SwiftUI |
| 10 | +import SwiftEventBus | ||
| 10 | 11 | ||
| 11 | public struct GlobalVariables { | 12 | public struct GlobalVariables { |
| 12 | static var campaigns: Array<swiftApi.CampaignItemModel> = [] | 13 | static var campaigns: Array<swiftApi.CampaignItemModel> = [] |
| ... | @@ -73,6 +74,8 @@ public class swiftApi { | ... | @@ -73,6 +74,8 @@ public class swiftApi { |
| 73 | let ccmsCampaign: Array<LoyaltyContextualOfferModel> = campaigns | 74 | let ccmsCampaign: Array<LoyaltyContextualOfferModel> = campaigns |
| 74 | 75 | ||
| 75 | GlobalVariables.ccmsCampaigns = campaigns | 76 | GlobalVariables.ccmsCampaigns = campaigns |
| 77 | + | ||
| 78 | + SwiftEventBus.post("ccms_retrieved") | ||
| 76 | } | 79 | } |
| 77 | 80 | ||
| 78 | public func mergeGFYCCMSLoyaltyCampaigns(campaigns: Array<LoyaltyContextualOfferModel>) -> Array<CampaignItemModel> { | 81 | public func mergeGFYCCMSLoyaltyCampaigns(campaigns: Array<LoyaltyContextualOfferModel>) -> Array<CampaignItemModel> { | ... | ... |
-
Please register or login to post a comment