Manos Chorianopoulos

add ccmsList at GiftsViewController

...@@ -15,6 +15,7 @@ import SwiftEventBus ...@@ -15,6 +15,7 @@ import SwiftEventBus
15 15
16 public var campaigns:Array<swiftApi.CampaignItemModel> = swiftApi().mergeGFYCCMSLoyaltyCampaigns(campaigns: swiftApi().getCCMSLoyaltyCampaigns()) 16 public var campaigns:Array<swiftApi.CampaignItemModel> = swiftApi().mergeGFYCCMSLoyaltyCampaigns(campaigns: swiftApi().getCCMSLoyaltyCampaigns())
17 public var seasonalList:Array<swiftApi.LoyaltyGiftsForYouPackage> = swiftApi().getSeasonalList() 17 public var seasonalList:Array<swiftApi.LoyaltyGiftsForYouPackage> = swiftApi().getSeasonalList()
18 + public var ccmsList:Array<swiftApi.LoyaltyContextualOfferModel> = swiftApi().getCCMSLoyaltyCampaigns()
18 19
19 20
20 public override func viewDidLoad() { 21 public override func viewDidLoad() {
...@@ -31,6 +32,18 @@ import SwiftEventBus ...@@ -31,6 +32,18 @@ import SwiftEventBus
31 campaigns.append(newCampaign) 32 campaigns.append(newCampaign)
32 } 33 }
33 } 34 }
35 +
36 + if (ccmsList.count > 0) {
37 + for ccmsItem in ccmsList {
38 + if (((ccmsItem._loyaltyCampaignId == "") || (ccmsItem._loyaltyCampaignId == "NA")) && (ccmsItem._zone == "COSMOTE_APP_GIFTS4U")) {
39 + let newCampaign = swiftApi.CampaignItemModel()
40 + newCampaign._title = ccmsItem._title
41 + newCampaign._logo_url = ccmsItem._imageUrl
42 + newCampaign._ccms = ccmsItem
43 + campaigns.append(newCampaign)
44 + }
45 + }
46 + }
34 47
35 setBackButton() 48 setBackButton()
36 setNavigationTitle("GIFTS for YOU", "bold") 49 setNavigationTitle("GIFTS for YOU", "bold")
...@@ -146,7 +159,10 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -146,7 +159,10 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
146 } 159 }
147 160
148 public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 161 public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
149 - if (campaigns[indexPath.row]._type != nil && campaigns[indexPath.row]._type == "telco") { 162 + if (campaigns[indexPath.row]._ccms != nil) {
163 + // TODO: open new screen with param campaigns[indexPath.row]._ccms
164 +
165 + } else if (campaigns[indexPath.row]._type != nil && campaigns[indexPath.row]._type == "telco") {
150 let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns() 166 let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns()
151 let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid } 167 let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid }
152 168
......