Manos Chorianopoulos

add ccmsList at GiftsViewController

......@@ -15,6 +15,7 @@ import SwiftEventBus
public var campaigns:Array<swiftApi.CampaignItemModel> = swiftApi().mergeGFYCCMSLoyaltyCampaigns(campaigns: swiftApi().getCCMSLoyaltyCampaigns())
public var seasonalList:Array<swiftApi.LoyaltyGiftsForYouPackage> = swiftApi().getSeasonalList()
public var ccmsList:Array<swiftApi.LoyaltyContextualOfferModel> = swiftApi().getCCMSLoyaltyCampaigns()
public override func viewDidLoad() {
......@@ -31,6 +32,18 @@ import SwiftEventBus
campaigns.append(newCampaign)
}
}
if (ccmsList.count > 0) {
for ccmsItem in ccmsList {
if (((ccmsItem._loyaltyCampaignId == "") || (ccmsItem._loyaltyCampaignId == "NA")) && (ccmsItem._zone == "COSMOTE_APP_GIFTS4U")) {
let newCampaign = swiftApi.CampaignItemModel()
newCampaign._title = ccmsItem._title
newCampaign._logo_url = ccmsItem._imageUrl
newCampaign._ccms = ccmsItem
campaigns.append(newCampaign)
}
}
}
setBackButton()
setNavigationTitle("GIFTS for YOU", "bold")
......@@ -146,7 +159,10 @@ extension GiftsViewController: 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 }
......