Manos Chorianopoulos

fix CcmsOffer banners at gfy, mfy

...@@ -198,6 +198,8 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -198,6 +198,8 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
198 public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 198 public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
199 let cell = tableView.dequeueReusableCell(withIdentifier: "InboxTableViewCellId", for: indexPath) as! InboxTableViewCell 199 let cell = tableView.dequeueReusableCell(withIdentifier: "InboxTableViewCellId", for: indexPath) as! InboxTableViewCell
200 200
201 + let isCcmsOffer = (campaigns[indexPath.row].ccms_offer != nil) && (campaigns[indexPath.row].ccms_offer != "") && (campaigns[indexPath.row].ccms_offer == "true")
202 +
201 if (campaigns[indexPath.row]._type != nil && campaigns[indexPath.row]._type == "telco") { 203 if (campaigns[indexPath.row]._type != nil && campaigns[indexPath.row]._type == "telco") {
202 let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns() 204 let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns()
203 let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid } 205 let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid }
...@@ -211,6 +213,21 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -211,6 +213,21 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
211 } 213 }
212 } 214 }
213 215
216 + } else if (campaigns[indexPath.row].session_uuid != nil && campaigns[indexPath.row].session_uuid != "" && isCcmsOffer) {
217 +
218 + let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns()
219 + let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid }
220 +
221 + if (loyaltyCampaignIdExists == true) {
222 + var ccmsCampaignFound:swiftApi.LoyaltyContextualOfferModel = swiftApi.LoyaltyContextualOfferModel()
223 + for item in ccmsCampaigns {
224 + if (item._loyaltyCampaignId == campaigns[indexPath.row].session_uuid) {
225 + cell.configureCell(ccms: item)
226 + break;
227 + }
228 + }
229 + }
230 +
214 } else { 231 } else {
215 cell.configureCell(campaign: campaigns[indexPath.row]) 232 cell.configureCell(campaign: campaigns[indexPath.row])
216 } 233 }
......
...@@ -236,6 +236,8 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -236,6 +236,8 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
236 236
237 let campaign = categories[indexPath.section].items[indexPath.row] 237 let campaign = categories[indexPath.section].items[indexPath.row]
238 238
239 + let isCcmsOffer = (campaign.ccms_offer != nil) && (campaign.ccms_offer != "") && (campaign.ccms_offer == "true")
240 +
239 if (campaign._type != nil && campaign._type == "telco") { 241 if (campaign._type != nil && campaign._type == "telco") {
240 let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns() 242 let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns()
241 let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaign.session_uuid } 243 let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaign.session_uuid }
...@@ -249,6 +251,21 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -249,6 +251,21 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
249 } 251 }
250 } 252 }
251 253
254 + } else if (campaign.session_uuid != nil && campaign.session_uuid != "" && isCcmsOffer) {
255 +
256 + let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns()
257 + let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaign.session_uuid }
258 +
259 + if (loyaltyCampaignIdExists == true) {
260 + var ccmsCampaignFound:swiftApi.LoyaltyContextualOfferModel = swiftApi.LoyaltyContextualOfferModel()
261 + for item in ccmsCampaigns {
262 + if (item._loyaltyCampaignId == campaign.session_uuid) {
263 + cell.configureCell(ccms: item)
264 + break;
265 + }
266 + }
267 + }
268 +
252 } else { 269 } else {
253 cell.configureCell(campaign: campaign) 270 cell.configureCell(campaign: campaign)
254 } 271 }
......