Showing
2 changed files
with
43 additions
and
0 deletions
... | @@ -41,12 +41,53 @@ import SwiftEventBus | ... | @@ -41,12 +41,53 @@ import SwiftEventBus |
41 | SwiftEventBus.onMainThread(self, name: "ccms_retrieved") { result in | 41 | SwiftEventBus.onMainThread(self, name: "ccms_retrieved") { result in |
42 | print("===== SwiftEventBus ccms_retrieved =====") | 42 | print("===== SwiftEventBus ccms_retrieved =====") |
43 | self.campaigns = swiftApi().mergeGFYCCMSLoyaltyCampaigns(campaigns: swiftApi().getCCMSLoyaltyCampaigns()) | 43 | self.campaigns = swiftApi().mergeGFYCCMSLoyaltyCampaigns(campaigns: swiftApi().getCCMSLoyaltyCampaigns()) |
44 | + | ||
45 | + self.seasonalList = swiftApi().getSeasonalList() | ||
46 | + | ||
47 | + if (seasonalList.count > 0) { | ||
48 | + for seasonalItem in self.seasonalList { | ||
49 | + let newCampaign = swiftApi.CampaignItemModel() | ||
50 | + newCampaign._title = seasonalItem._title | ||
51 | + newCampaign._logo_url = seasonalItem._imageUrl | ||
52 | + newCampaign._loyaltyPackageId = seasonalItem._loyaltyPackageId | ||
53 | + self.campaigns.append(newCampaign) | ||
54 | + } | ||
55 | + } | ||
44 | self.tableView.reloadData() | 56 | self.tableView.reloadData() |
45 | } | 57 | } |
46 | 58 | ||
47 | SwiftEventBus.onMainThread(self, name: "campaigns_retrieved") { result in | 59 | SwiftEventBus.onMainThread(self, name: "campaigns_retrieved") { result in |
48 | print("===== SwiftEventBus campaigns_retrieved =====") | 60 | print("===== SwiftEventBus campaigns_retrieved =====") |
49 | self.campaigns = swiftApi().mergeGFYCCMSLoyaltyCampaigns(campaigns: swiftApi().getCCMSLoyaltyCampaigns()) | 61 | self.campaigns = swiftApi().mergeGFYCCMSLoyaltyCampaigns(campaigns: swiftApi().getCCMSLoyaltyCampaigns()) |
62 | + | ||
63 | + self.seasonalList = swiftApi().getSeasonalList() | ||
64 | + | ||
65 | + if (seasonalList.count > 0) { | ||
66 | + for seasonalItem in self.seasonalList { | ||
67 | + let newCampaign = swiftApi.CampaignItemModel() | ||
68 | + newCampaign._title = seasonalItem._title | ||
69 | + newCampaign._logo_url = seasonalItem._imageUrl | ||
70 | + newCampaign._loyaltyPackageId = seasonalItem._loyaltyPackageId | ||
71 | + self.campaigns.append(newCampaign) | ||
72 | + } | ||
73 | + } | ||
74 | + self.tableView.reloadData() | ||
75 | + } | ||
76 | + | ||
77 | + SwiftEventBus.onMainThread(self, name: "seasonals_retrieved") { result in | ||
78 | + print("===== SwiftEventBus seasonals_retrieved =====") | ||
79 | + | ||
80 | + self.seasonalList = swiftApi().getSeasonalList() | ||
81 | + | ||
82 | + if (seasonalList.count > 0) { | ||
83 | + for seasonalItem in self.seasonalList { | ||
84 | + let newCampaign = swiftApi.CampaignItemModel() | ||
85 | + newCampaign._title = seasonalItem._title | ||
86 | + newCampaign._logo_url = seasonalItem._imageUrl | ||
87 | + newCampaign._loyaltyPackageId = seasonalItem._loyaltyPackageId | ||
88 | + self.campaigns.append(newCampaign) | ||
89 | + } | ||
90 | + } | ||
50 | self.tableView.reloadData() | 91 | self.tableView.reloadData() |
51 | } | 92 | } |
52 | 93 | ... | ... |
... | @@ -2977,6 +2977,8 @@ public class swiftApi { | ... | @@ -2977,6 +2977,8 @@ public class swiftApi { |
2977 | 2977 | ||
2978 | public func setSeasonalList(_ seasonalCoupons: Array<LoyaltyGiftsForYouPackage>) { | 2978 | public func setSeasonalList(_ seasonalCoupons: Array<LoyaltyGiftsForYouPackage>) { |
2979 | GlobalVariables.seasonalList = seasonalCoupons | 2979 | GlobalVariables.seasonalList = seasonalCoupons |
2980 | + | ||
2981 | + SwiftEventBus.post("seasonals_retrieved") | ||
2980 | } | 2982 | } |
2981 | 2983 | ||
2982 | 2984 | ... | ... |
-
Please register or login to post a comment