Manos Chorianopoulos

add ccmsList at MFYViewController

...@@ -14,12 +14,27 @@ import SwiftEventBus ...@@ -14,12 +14,27 @@ import SwiftEventBus
14 @IBOutlet weak var tableView: UITableView! 14 @IBOutlet weak var tableView: UITableView!
15 15
16 public var campaigns:Array<swiftApi.CampaignItemModel> = swiftApi().mergeMFYCCMSLoyaltyCampaigns(campaigns: swiftApi().getCCMSLoyaltyCampaigns()) 16 public var campaigns:Array<swiftApi.CampaignItemModel> = swiftApi().mergeMFYCCMSLoyaltyCampaigns(campaigns: swiftApi().getCCMSLoyaltyCampaigns())
17 + public var ccmsList:Array<swiftApi.LoyaltyContextualOfferModel> = swiftApi().getCCMSLoyaltyCampaigns()
17 18
18 19
19 public override func viewDidLoad() { 20 public override func viewDidLoad() {
20 super.viewDidLoad() 21 super.viewDidLoad()
21 22
22 self.hidesBottomBarWhenPushed = true 23 self.hidesBottomBarWhenPushed = true
24 +
25 + if (ccmsList.count > 0) {
26 + for ccmsItem in ccmsList {
27 + if (((ccmsItem._loyaltyCampaignId == "") || (ccmsItem._loyaltyCampaignId == "NA")) && (ccmsItem._zone == "COSMOTE_APP_MORE4U")) {
28 + let newCampaign = swiftApi.CampaignItemModel()
29 + newCampaign._title = ccmsItem._title
30 + newCampaign._logo_url = ccmsItem._imageUrl
31 + newCampaign._subtitle = ccmsItem._subtitle
32 + newCampaign._message = ccmsItem._message
33 + newCampaign._ccms = ccmsItem
34 + campaigns.append(newCampaign)
35 + }
36 + }
37 + }
23 38
24 setBackButton() 39 setBackButton()
25 setNavigationTitle("MORE for YOU", "bold") 40 setNavigationTitle("MORE for YOU", "bold")
...@@ -94,7 +109,10 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -94,7 +109,10 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
94 } 109 }
95 110
96 public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 111 public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
97 - if (campaigns[indexPath.row]._type != nil && campaigns[indexPath.row]._type == "telco") { 112 + if (campaigns[indexPath.row]._ccms != nil) {
113 + // TODO: open new screen with param campaigns[indexPath.row]._ccms
114 +
115 + } else if (campaigns[indexPath.row]._type != nil && campaigns[indexPath.row]._type == "telco") {
98 let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns() 116 let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns()
99 let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid } 117 let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid }
100 118
......