Manos Chorianopoulos

add CCMS_CLICK, GFY_CLICK logs

...@@ -109,20 +109,11 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -109,20 +109,11 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
109 var url = "" 109 var url = ""
110 let isCcmsOffer = (campaigns[indexPath.row].ccms_offer != nil) && (campaigns[indexPath.row].ccms_offer != "") && (campaigns[indexPath.row].ccms_offer == "true") 110 let isCcmsOffer = (campaigns[indexPath.row].ccms_offer != nil) && (campaigns[indexPath.row].ccms_offer != "") && (campaigns[indexPath.row].ccms_offer == "true")
111 111
112 - // TODO: DELETE
113 - print("isCcmsOffer: " + (isCcmsOffer ? "true" : "false"))
114 -
115 if (isCcmsOffer) { 112 if (isCcmsOffer) {
116 let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns() 113 let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns()
117 114
118 - // TODO: DELETE
119 - print("ccmsCampaigns count: " + String(ccmsCampaigns.count))
120 -
121 let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid } 115 let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid }
122 116
123 - // TODO: DELETE
124 - print("loyaltyCampaignIdExists: " + (loyaltyCampaignIdExists ? "true" : "false"))
125 -
126 if (loyaltyCampaignIdExists == true) { 117 if (loyaltyCampaignIdExists == true) {
127 var ccmsCampaignFound:swiftApi.LoyaltyContextualOfferModel = swiftApi.LoyaltyContextualOfferModel() 118 var ccmsCampaignFound:swiftApi.LoyaltyContextualOfferModel = swiftApi.LoyaltyContextualOfferModel()
128 for item in ccmsCampaigns { 119 for item in ccmsCampaigns {
...@@ -132,18 +123,25 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -132,18 +123,25 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
132 } 123 }
133 url = swiftApi().constructCcmsUrl(campaigns[indexPath.row], ccmsCampaignFound) 124 url = swiftApi().constructCcmsUrl(campaigns[indexPath.row], ccmsCampaignFound)
134 125
135 - // TODO: DELETE
136 - print("ccmsCampaignFound: " + ccmsCampaignFound._loyaltyCampaignId)
137 -
138 } else { 126 } else {
139 url = swiftApi().constructCampaignUrl(campaigns[indexPath.row]) 127 url = swiftApi().constructCampaignUrl(campaigns[indexPath.row])
140 128
141 - // TODO: DELETE
142 - print("loyaltyCampaignId DOESNT Exist")
143 } 129 }
144 130
131 + let encoder = JSONEncoder()
132 + encoder.outputFormatting = .prettyPrinted
133 + let data = try! encoder.encode(campaigns[indexPath.row])
134 +
135 + print("CCMS_CLICK " + String(data: data, encoding: .utf8)!)
136 +
145 } else { 137 } else {
146 url = swiftApi().constructCampaignUrl(campaigns[indexPath.row]) 138 url = swiftApi().constructCampaignUrl(campaigns[indexPath.row])
139 +
140 + let encoder = JSONEncoder()
141 + encoder.outputFormatting = .prettyPrinted
142 + let data = try! encoder.encode(campaigns[indexPath.row])
143 +
144 + print("GFY_CLICK " + String(data: data, encoding: .utf8)!)
147 } 145 }
148 print("CampaignUrl url onclick: " + url) 146 print("CampaignUrl url onclick: " + url)
149 vc.campaignUrl = url 147 vc.campaignUrl = url
......
...@@ -92,9 +92,52 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -92,9 +92,52 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
92 } 92 }
93 93
94 } else { 94 } else {
95 + // let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
96 + // let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController
97 + // let url = swiftApi().constructCampaignUrl(campaigns[indexPath.row])
98 + // print("CampaignUrl url onclick: " + url)
99 + // vc.campaignUrl = url
100 + // self.navigationController?.pushViewController(vc, animated: true)
101 +
95 let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) 102 let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
96 let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController 103 let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController
97 - let url = swiftApi().constructCampaignUrl(campaigns[indexPath.row]) 104 + var url = ""
105 + let isCcmsOffer = (campaigns[indexPath.row].ccms_offer != nil) && (campaigns[indexPath.row].ccms_offer != "") && (campaigns[indexPath.row].ccms_offer == "true")
106 +
107 + if (isCcmsOffer) {
108 + let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns()
109 +
110 + let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid }
111 +
112 + if (loyaltyCampaignIdExists == true) {
113 + var ccmsCampaignFound:swiftApi.LoyaltyContextualOfferModel = swiftApi.LoyaltyContextualOfferModel()
114 + for item in ccmsCampaigns {
115 + if (item._loyaltyCampaignId == campaigns[indexPath.row].session_uuid) {
116 + ccmsCampaignFound = item
117 + }
118 + }
119 + url = swiftApi().constructCcmsUrl(campaigns[indexPath.row], ccmsCampaignFound)
120 +
121 + } else {
122 + url = swiftApi().constructCampaignUrl(campaigns[indexPath.row])
123 +
124 + }
125 +
126 + let encoder = JSONEncoder()
127 + encoder.outputFormatting = .prettyPrinted
128 + let data = try! encoder.encode(campaigns[indexPath.row])
129 +
130 + print("CCMS_CLICK " + String(data: data, encoding: .utf8)!)
131 +
132 + } else {
133 + url = swiftApi().constructCampaignUrl(campaigns[indexPath.row])
134 +
135 + let encoder = JSONEncoder()
136 + encoder.outputFormatting = .prettyPrinted
137 + let data = try! encoder.encode(campaigns[indexPath.row])
138 +
139 + print("GFY_CLICK " + String(data: data, encoding: .utf8)!)
140 + }
98 print("CampaignUrl url onclick: " + url) 141 print("CampaignUrl url onclick: " + url)
99 vc.campaignUrl = url 142 vc.campaignUrl = url
100 self.navigationController?.pushViewController(vc, animated: true) 143 self.navigationController?.pushViewController(vc, animated: true)
......