Manos Chorianopoulos

fix TelcoVC and open telco from gfy, mfy

...@@ -84,7 +84,23 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -84,7 +84,23 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
84 } 84 }
85 85
86 public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 86 public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
87 - if (campaigns[indexPath.row]._campaign_type == "coupon") { 87 + if (campaigns[indexPath.row]._type != nil && campaigns[indexPath.row]._type == "telco") {
88 + let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns()
89 + let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid }
90 +
91 + if (loyaltyCampaignIdExists == true) {
92 + for item in ccmsCampaigns {
93 + if (item._loyaltyCampaignId == campaigns[indexPath.row].session_uuid) {
94 + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
95 + let vc = storyboard.instantiateViewController(withIdentifier: "TelcoViewController") as! SwiftWarplyFramework.TelcoViewController
96 + vc.ccms = item
97 + vc.campaign = campaigns[indexPath.row]
98 + self.navigationController?.pushViewController(vc, animated: true)
99 + }
100 + }
101 + }
102 +
103 + } else if (campaigns[indexPath.row]._campaign_type == "coupon") {
88 let couponsetUuid = campaigns[indexPath.row]._couponset 104 let couponsetUuid = campaigns[indexPath.row]._couponset
89 105
90 if (couponsetUuid != "") { 106 if (couponsetUuid != "") {
......
...@@ -73,7 +73,23 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -73,7 +73,23 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
73 } 73 }
74 74
75 public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 75 public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
76 - if (campaigns[indexPath.row]._campaign_type == "coupon") { 76 + if (campaigns[indexPath.row]._type != nil && campaigns[indexPath.row]._type == "telco") {
77 + let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns()
78 + let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid }
79 +
80 + if (loyaltyCampaignIdExists == true) {
81 + for item in ccmsCampaigns {
82 + if (item._loyaltyCampaignId == campaigns[indexPath.row].session_uuid) {
83 + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
84 + let vc = storyboard.instantiateViewController(withIdentifier: "TelcoViewController") as! SwiftWarplyFramework.TelcoViewController
85 + vc.ccms = item
86 + vc.campaign = campaigns[indexPath.row]
87 + self.navigationController?.pushViewController(vc, animated: true)
88 + }
89 + }
90 + }
91 +
92 + } else if (campaigns[indexPath.row]._campaign_type == "coupon") {
77 let couponsetUuid = campaigns[indexPath.row]._couponset 93 let couponsetUuid = campaigns[indexPath.row]._couponset
78 94
79 if (couponsetUuid != "") { 95 if (couponsetUuid != "") {
......
...@@ -19,8 +19,8 @@ import UIKit ...@@ -19,8 +19,8 @@ import UIKit
19 19
20 let uiscreen: CGRect = UIScreen.main.bounds 20 let uiscreen: CGRect = UIScreen.main.bounds
21 21
22 - // TODO: modify this 22 + public var ccms: swiftApi.LoyaltyContextualOfferModel?
23 - public var couponset: swiftApi.CouponSetItemModel? 23 + public var campaign: swiftApi.CampaignItemModel?
24 24
25 public override func viewDidLoad() { 25 public override func viewDidLoad() {
26 26
...@@ -36,12 +36,11 @@ import UIKit ...@@ -36,12 +36,11 @@ import UIKit
36 scrollView.layer.cornerRadius = 30 36 scrollView.layer.cornerRadius = 30
37 scrollView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius 37 scrollView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius
38 38
39 - heroImage.load(link: couponset?.img_preview ?? "", placeholder: UIImage(), cache: URLCache()) 39 + heroImage.load(link: ccms?._imageUrl ?? "", placeholder: UIImage(), cache: URLCache())
40 heroImage.contentMode = .scaleAspectFill 40 heroImage.contentMode = .scaleAspectFill
41 heroImageHeight.constant = self.uiscreen.height * 0.25 41 heroImageHeight.constant = self.uiscreen.height * 0.25
42 - 42 + nameLabel.text = ccms?._title ?? ""
43 - nameLabel.text = couponset?.name ?? "" 43 + descriptionLabel.text = ccms?._subtitle ?? ""
44 - descriptionLabel.text = couponset?.short_description ?? ""
45 44
46 activateButton.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .semibold) 45 activateButton.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .semibold)
47 activateButton.setTitle("Ενεργοποίηση", for: .normal) 46 activateButton.setTitle("Ενεργοποίηση", for: .normal)
...@@ -58,10 +57,9 @@ import UIKit ...@@ -58,10 +57,9 @@ import UIKit
58 func activateSetCallback (_ response: swiftApi.GenericResponseModel?) -> Void { 57 func activateSetCallback (_ response: swiftApi.GenericResponseModel?) -> Void {
59 assertionFailure("to be implemented") 58 assertionFailure("to be implemented")
60 } 59 }
61 -
62 // MARK: - Actions 60 // MARK: - Actions
63 @IBAction func activateButtomAction(_ sender: Any) { 61 @IBAction func activateButtomAction(_ sender: Any) {
64 - activateSetRequest(uuid: couponset?.uuid ?? "") 62 +// activateSetRequest(uuid: couponset?.uuid ?? "")
65 } 63 }
66 } 64 }
67 65
......