Manos Chorianopoulos

fix handleContextualCampaigns

......@@ -4506,30 +4506,41 @@ public class swiftApi {
public func handleContextualCampaigns(_ ccms: LoyaltyContextualOfferModel, _ controller: UIViewController) -> Void {
let allCampaigns = swiftApi().getAllCampaignList()
// if (((ccms._loyaltyCampaignId == "") || (ccms._loyaltyCampaignId == "NA")) && ((ccms._zone == "COSMOTE_APP_GIFTS4U") || (ccms._zone == "COSMOTE_APP_MORE4U"))) {
if ((ccms._loyaltyCampaignId == "") || (ccms._loyaltyCampaignId == "NA")) {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "ContextualViewController") as! SwiftWarplyFramework.ContextualViewController
vc.ccms = ccms
controller.navigationController?.pushViewController(vc, animated: true)
for loyaltyCampaign in allCampaigns {
let isCcmsOffer = (loyaltyCampaign.ccms_offer != nil) && (loyaltyCampaign.ccms_offer != "") && (loyaltyCampaign.ccms_offer == "true")
let isTelco = (loyaltyCampaign._type != nil && loyaltyCampaign._type == "telco")
} else {
if (isCcmsOffer && (loyaltyCampaign.session_uuid == ccms._loyaltyCampaignId)) {
let allCampaigns = swiftApi().getAllCampaignList()
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController
vc.campaignUrl = swiftApi().constructCcmsUrl(loyaltyCampaign, ccms)
vc.params = swiftApi().constructCcmsParams(loyaltyCampaign, ccms)
controller.navigationController?.pushViewController(vc, animated: true)
break;
for loyaltyCampaign in allCampaigns {
let isCcmsOffer = (loyaltyCampaign.ccms_offer != nil) && (loyaltyCampaign.ccms_offer != "") && (loyaltyCampaign.ccms_offer == "true")
let isTelco = (loyaltyCampaign._type != nil && loyaltyCampaign._type == "telco")
} else if (isTelco && (loyaltyCampaign.session_uuid == ccms._loyaltyCampaignId)) {
if (isCcmsOffer && (loyaltyCampaign.session_uuid == ccms._loyaltyCampaignId)) {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "TelcoViewController") as! SwiftWarplyFramework.TelcoViewController
vc.ccms = ccms
vc.campaign = loyaltyCampaign
controller.navigationController?.pushViewController(vc, animated: true)
break;
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController
vc.campaignUrl = swiftApi().constructCcmsUrl(loyaltyCampaign, ccms)
vc.params = swiftApi().constructCcmsParams(loyaltyCampaign, ccms)
controller.navigationController?.pushViewController(vc, animated: true)
break;
} else if (isTelco && (loyaltyCampaign.session_uuid == ccms._loyaltyCampaignId)) {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "TelcoViewController") as! SwiftWarplyFramework.TelcoViewController
vc.ccms = ccms
vc.campaign = loyaltyCampaign
controller.navigationController?.pushViewController(vc, animated: true)
break;
}
}
}
}
......