Showing
4 changed files
with
66 additions
and
2 deletions
No preview for this file type
... | @@ -329,6 +329,70 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -329,6 +329,70 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ |
329 | break; | 329 | break; |
330 | } | 330 | } |
331 | } | 331 | } |
332 | + } else if (campaigns[indexPath.row].session_uuid != nil && campaigns[indexPath.row].session_uuid != "") { | ||
333 | + | ||
334 | + let status = swiftApi().getNetworkStatus() | ||
335 | + if (status == -1 || status == 0) { | ||
336 | + self.showDialog("Δεν υπάρχει σύνδεση","Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.") | ||
337 | + } else { | ||
338 | + | ||
339 | + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | ||
340 | + let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController | ||
341 | + var url = "" | ||
342 | + var params = "" | ||
343 | + let isCcmsOffer = (campaigns[indexPath.row].ccms_offer != nil) && (campaigns[indexPath.row].ccms_offer != "") && (campaigns[indexPath.row].ccms_offer == "true") | ||
344 | + | ||
345 | + if (isCcmsOffer) { | ||
346 | + let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns() | ||
347 | + | ||
348 | + let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid } | ||
349 | + | ||
350 | + if (loyaltyCampaignIdExists == true) { | ||
351 | + var ccmsCampaignFound:swiftApi.LoyaltyContextualOfferModel = swiftApi.LoyaltyContextualOfferModel() | ||
352 | + for item in ccmsCampaigns { | ||
353 | + if (item._loyaltyCampaignId == campaigns[indexPath.row].session_uuid) { | ||
354 | + ccmsCampaignFound = item | ||
355 | + } | ||
356 | + } | ||
357 | + swiftApi().logTrackersEvent("click", ("Contextual:" + (ccmsCampaignFound._sessionId))) | ||
358 | + | ||
359 | + url = swiftApi().constructCcmsUrl(campaigns[indexPath.row], ccmsCampaignFound) | ||
360 | + params = swiftApi().constructCcmsParams(campaigns[indexPath.row], ccmsCampaignFound) | ||
361 | + | ||
362 | + } else { | ||
363 | + url = swiftApi().constructCampaignUrl(campaigns[indexPath.row]) | ||
364 | + params = swiftApi().constructCampaignParams(campaigns[indexPath.row]) | ||
365 | + | ||
366 | + } | ||
367 | + | ||
368 | + let encoder = JSONEncoder() | ||
369 | + encoder.outputFormatting = .prettyPrinted | ||
370 | + let data = try! encoder.encode(campaigns[indexPath.row]) | ||
371 | + | ||
372 | + print("CCMS_CLICK " + String(data: data, encoding: .utf8)!) | ||
373 | + | ||
374 | + } else { | ||
375 | + swiftApi().logTrackersEvent("click", ("Loyalty:" + (campaigns[indexPath.row].session_uuid ?? ""))) | ||
376 | + | ||
377 | + url = swiftApi().constructCampaignUrl(campaigns[indexPath.row]) | ||
378 | + params = swiftApi().constructCampaignParams(campaigns[indexPath.row]) | ||
379 | + | ||
380 | + let encoder = JSONEncoder() | ||
381 | + encoder.outputFormatting = .prettyPrinted | ||
382 | + let data = try! encoder.encode(campaigns[indexPath.row]) | ||
383 | + | ||
384 | + print("GFY_CLICK " + String(data: data, encoding: .utf8)!) | ||
385 | + } | ||
386 | + print("CampaignUrl url onclick: " + url) | ||
387 | + vc.campaignUrl = url | ||
388 | + vc.params = params | ||
389 | + self.navigationController?.pushViewController(vc, animated: true) | ||
390 | + | ||
391 | + if let sessionUuid = campaigns[indexPath.row].session_uuid { | ||
392 | + getSingleCampaignAsyncRequest(sessionUuid: sessionUuid) | ||
393 | + } | ||
394 | + } | ||
395 | + | ||
332 | } | 396 | } |
333 | 397 | ||
334 | } else { | 398 | } else { | ... | ... |
... | @@ -325,7 +325,7 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -325,7 +325,7 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ |
325 | } | 325 | } |
326 | } | 326 | } |
327 | 327 | ||
328 | - } else if (campaign._campaign_type == "coupon") { | 328 | + } else if (campaign._campaign_type == "coupon" && campaign._couponset != "") { |
329 | let couponsetUuid = campaign._couponset | 329 | let couponsetUuid = campaign._couponset |
330 | 330 | ||
331 | if (couponsetUuid != "") { | 331 | if (couponsetUuid != "") { | ... | ... |
... | @@ -6863,7 +6863,7 @@ public class swiftApi { | ... | @@ -6863,7 +6863,7 @@ public class swiftApi { |
6863 | 6863 | ||
6864 | 6864 | ||
6865 | public func handleLoyaltyCampaigns(_ campaign: CampaignItemModel, _ controller: UIViewController) -> Void { | 6865 | public func handleLoyaltyCampaigns(_ campaign: CampaignItemModel, _ controller: UIViewController) -> Void { |
6866 | - if (campaign._campaign_type == "coupon") { | 6866 | + if (campaign._campaign_type == "coupon" && campaign._couponset != "") { |
6867 | let couponsetUuid = campaign._couponset | 6867 | let couponsetUuid = campaign._couponset |
6868 | 6868 | ||
6869 | if (couponsetUuid != "") { | 6869 | if (couponsetUuid != "") { | ... | ... |
-
Please register or login to post a comment