Manos Chorianopoulos

fix CcmsOffer banners at gfy, mfy

......@@ -197,6 +197,8 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "InboxTableViewCellId", for: indexPath) as! InboxTableViewCell
let isCcmsOffer = (campaigns[indexPath.row].ccms_offer != nil) && (campaigns[indexPath.row].ccms_offer != "") && (campaigns[indexPath.row].ccms_offer == "true")
if (campaigns[indexPath.row]._type != nil && campaigns[indexPath.row]._type == "telco") {
let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns()
......@@ -211,6 +213,21 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
}
}
} else if (campaigns[indexPath.row].session_uuid != nil && campaigns[indexPath.row].session_uuid != "" && isCcmsOffer) {
let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns()
let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid }
if (loyaltyCampaignIdExists == true) {
var ccmsCampaignFound:swiftApi.LoyaltyContextualOfferModel = swiftApi.LoyaltyContextualOfferModel()
for item in ccmsCampaigns {
if (item._loyaltyCampaignId == campaigns[indexPath.row].session_uuid) {
cell.configureCell(ccms: item)
break;
}
}
}
} else {
cell.configureCell(campaign: campaigns[indexPath.row])
}
......
......@@ -235,6 +235,8 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
let cell = tableView.dequeueReusableCell(withIdentifier: "MFYInboxTableViewCellId", for: indexPath) as! MFYInboxTableViewCell
let campaign = categories[indexPath.section].items[indexPath.row]
let isCcmsOffer = (campaign.ccms_offer != nil) && (campaign.ccms_offer != "") && (campaign.ccms_offer == "true")
if (campaign._type != nil && campaign._type == "telco") {
let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns()
......@@ -249,6 +251,21 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
}
}
} else if (campaign.session_uuid != nil && campaign.session_uuid != "" && isCcmsOffer) {
let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns()
let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaign.session_uuid }
if (loyaltyCampaignIdExists == true) {
var ccmsCampaignFound:swiftApi.LoyaltyContextualOfferModel = swiftApi.LoyaltyContextualOfferModel()
for item in ccmsCampaigns {
if (item._loyaltyCampaignId == campaign.session_uuid) {
cell.configureCell(ccms: item)
break;
}
}
}
} else {
cell.configureCell(campaign: campaign)
}
......