Manos Chorianopoulos

add ccmsList at MFYViewController

......@@ -14,6 +14,7 @@ import SwiftEventBus
@IBOutlet weak var tableView: UITableView!
public var campaigns:Array<swiftApi.CampaignItemModel> = swiftApi().mergeMFYCCMSLoyaltyCampaigns(campaigns: swiftApi().getCCMSLoyaltyCampaigns())
public var ccmsList:Array<swiftApi.LoyaltyContextualOfferModel> = swiftApi().getCCMSLoyaltyCampaigns()
public override func viewDidLoad() {
......@@ -21,6 +22,20 @@ import SwiftEventBus
self.hidesBottomBarWhenPushed = true
if (ccmsList.count > 0) {
for ccmsItem in ccmsList {
if (((ccmsItem._loyaltyCampaignId == "") || (ccmsItem._loyaltyCampaignId == "NA")) && (ccmsItem._zone == "COSMOTE_APP_MORE4U")) {
let newCampaign = swiftApi.CampaignItemModel()
newCampaign._title = ccmsItem._title
newCampaign._logo_url = ccmsItem._imageUrl
newCampaign._subtitle = ccmsItem._subtitle
newCampaign._message = ccmsItem._message
newCampaign._ccms = ccmsItem
campaigns.append(newCampaign)
}
}
}
setBackButton()
setNavigationTitle("MORE for YOU", "bold")
......@@ -94,7 +109,10 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
}
public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if (campaigns[indexPath.row]._type != nil && campaigns[indexPath.row]._type == "telco") {
if (campaigns[indexPath.row]._ccms != nil) {
// TODO: open new screen with param campaigns[indexPath.row]._ccms
} else if (campaigns[indexPath.row]._type != nil && campaigns[indexPath.row]._type == "telco") {
let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns()
let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid }
......