Manos Chorianopoulos

add CCMS_CLICK, GFY_CLICK logs

......@@ -109,20 +109,11 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
var url = ""
let isCcmsOffer = (campaigns[indexPath.row].ccms_offer != nil) && (campaigns[indexPath.row].ccms_offer != "") && (campaigns[indexPath.row].ccms_offer == "true")
// TODO: DELETE
print("isCcmsOffer: " + (isCcmsOffer ? "true" : "false"))
if (isCcmsOffer) {
let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns()
// TODO: DELETE
print("ccmsCampaigns count: " + String(ccmsCampaigns.count))
let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid }
// TODO: DELETE
print("loyaltyCampaignIdExists: " + (loyaltyCampaignIdExists ? "true" : "false"))
if (loyaltyCampaignIdExists == true) {
var ccmsCampaignFound:swiftApi.LoyaltyContextualOfferModel = swiftApi.LoyaltyContextualOfferModel()
for item in ccmsCampaigns {
......@@ -132,18 +123,25 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
}
url = swiftApi().constructCcmsUrl(campaigns[indexPath.row], ccmsCampaignFound)
// TODO: DELETE
print("ccmsCampaignFound: " + ccmsCampaignFound._loyaltyCampaignId)
} else {
url = swiftApi().constructCampaignUrl(campaigns[indexPath.row])
// TODO: DELETE
print("loyaltyCampaignId DOESNT Exist")
}
let encoder = JSONEncoder()
encoder.outputFormatting = .prettyPrinted
let data = try! encoder.encode(campaigns[indexPath.row])
print("CCMS_CLICK " + String(data: data, encoding: .utf8)!)
} else {
url = swiftApi().constructCampaignUrl(campaigns[indexPath.row])
let encoder = JSONEncoder()
encoder.outputFormatting = .prettyPrinted
let data = try! encoder.encode(campaigns[indexPath.row])
print("GFY_CLICK " + String(data: data, encoding: .utf8)!)
}
print("CampaignUrl url onclick: " + url)
vc.campaignUrl = url
......
......@@ -92,9 +92,52 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
}
} else {
// let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
// let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController
// let url = swiftApi().constructCampaignUrl(campaigns[indexPath.row])
// print("CampaignUrl url onclick: " + url)
// vc.campaignUrl = url
// self.navigationController?.pushViewController(vc, animated: true)
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController
let url = swiftApi().constructCampaignUrl(campaigns[indexPath.row])
var url = ""
let isCcmsOffer = (campaigns[indexPath.row].ccms_offer != nil) && (campaigns[indexPath.row].ccms_offer != "") && (campaigns[indexPath.row].ccms_offer == "true")
if (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) {
ccmsCampaignFound = item
}
}
url = swiftApi().constructCcmsUrl(campaigns[indexPath.row], ccmsCampaignFound)
} else {
url = swiftApi().constructCampaignUrl(campaigns[indexPath.row])
}
let encoder = JSONEncoder()
encoder.outputFormatting = .prettyPrinted
let data = try! encoder.encode(campaigns[indexPath.row])
print("CCMS_CLICK " + String(data: data, encoding: .utf8)!)
} else {
url = swiftApi().constructCampaignUrl(campaigns[indexPath.row])
let encoder = JSONEncoder()
encoder.outputFormatting = .prettyPrinted
let data = try! encoder.encode(campaigns[indexPath.row])
print("GFY_CLICK " + String(data: data, encoding: .utf8)!)
}
print("CampaignUrl url onclick: " + url)
vc.campaignUrl = url
self.navigationController?.pushViewController(vc, animated: true)
......