Manos Chorianopoulos

fix handleContextualCampaigns

...@@ -4506,30 +4506,41 @@ public class swiftApi { ...@@ -4506,30 +4506,41 @@ public class swiftApi {
4506 4506
4507 public func handleContextualCampaigns(_ ccms: LoyaltyContextualOfferModel, _ controller: UIViewController) -> Void { 4507 public func handleContextualCampaigns(_ ccms: LoyaltyContextualOfferModel, _ controller: UIViewController) -> Void {
4508 4508
4509 - let allCampaigns = swiftApi().getAllCampaignList() 4509 + // if (((ccms._loyaltyCampaignId == "") || (ccms._loyaltyCampaignId == "NA")) && ((ccms._zone == "COSMOTE_APP_GIFTS4U") || (ccms._zone == "COSMOTE_APP_MORE4U"))) {
4510 +
4511 + if ((ccms._loyaltyCampaignId == "") || (ccms._loyaltyCampaignId == "NA")) {
4512 + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
4513 + let vc = storyboard.instantiateViewController(withIdentifier: "ContextualViewController") as! SwiftWarplyFramework.ContextualViewController
4514 + vc.ccms = ccms
4515 + controller.navigationController?.pushViewController(vc, animated: true)
4510 4516
4511 - for loyaltyCampaign in allCampaigns { 4517 + } else {
4512 - let isCcmsOffer = (loyaltyCampaign.ccms_offer != nil) && (loyaltyCampaign.ccms_offer != "") && (loyaltyCampaign.ccms_offer == "true")
4513 - let isTelco = (loyaltyCampaign._type != nil && loyaltyCampaign._type == "telco")
4514 4518
4515 - if (isCcmsOffer && (loyaltyCampaign.session_uuid == ccms._loyaltyCampaignId)) { 4519 + let allCampaigns = swiftApi().getAllCampaignList()
4516 4520
4517 - let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) 4521 + for loyaltyCampaign in allCampaigns {
4518 - let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController 4522 + let isCcmsOffer = (loyaltyCampaign.ccms_offer != nil) && (loyaltyCampaign.ccms_offer != "") && (loyaltyCampaign.ccms_offer == "true")
4519 - vc.campaignUrl = swiftApi().constructCcmsUrl(loyaltyCampaign, ccms) 4523 + let isTelco = (loyaltyCampaign._type != nil && loyaltyCampaign._type == "telco")
4520 - vc.params = swiftApi().constructCcmsParams(loyaltyCampaign, ccms)
4521 - controller.navigationController?.pushViewController(vc, animated: true)
4522 - break;
4523 4524
4524 - } else if (isTelco && (loyaltyCampaign.session_uuid == ccms._loyaltyCampaignId)) { 4525 + if (isCcmsOffer && (loyaltyCampaign.session_uuid == ccms._loyaltyCampaignId)) {
4525 4526
4526 - let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) 4527 + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
4527 - let vc = storyboard.instantiateViewController(withIdentifier: "TelcoViewController") as! SwiftWarplyFramework.TelcoViewController 4528 + let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController
4528 - vc.ccms = ccms 4529 + vc.campaignUrl = swiftApi().constructCcmsUrl(loyaltyCampaign, ccms)
4529 - vc.campaign = loyaltyCampaign 4530 + vc.params = swiftApi().constructCcmsParams(loyaltyCampaign, ccms)
4530 - controller.navigationController?.pushViewController(vc, animated: true) 4531 + controller.navigationController?.pushViewController(vc, animated: true)
4531 - break; 4532 + break;
4532 4533
4534 + } else if (isTelco && (loyaltyCampaign.session_uuid == ccms._loyaltyCampaignId)) {
4535 +
4536 + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
4537 + let vc = storyboard.instantiateViewController(withIdentifier: "TelcoViewController") as! SwiftWarplyFramework.TelcoViewController
4538 + vc.ccms = ccms
4539 + vc.campaign = loyaltyCampaign
4540 + controller.navigationController?.pushViewController(vc, animated: true)
4541 + break;
4542 +
4543 + }
4533 } 4544 }
4534 } 4545 }
4535 } 4546 }
......