Manos Chorianopoulos

fix TelcoVC and open telco from gfy, mfy

......@@ -84,7 +84,23 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
}
public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if (campaigns[indexPath.row]._campaign_type == "coupon") {
if (campaigns[indexPath.row]._type != nil && campaigns[indexPath.row]._type == "telco") {
let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns()
let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid }
if (loyaltyCampaignIdExists == true) {
for item in ccmsCampaigns {
if (item._loyaltyCampaignId == campaigns[indexPath.row].session_uuid) {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "TelcoViewController") as! SwiftWarplyFramework.TelcoViewController
vc.ccms = item
vc.campaign = campaigns[indexPath.row]
self.navigationController?.pushViewController(vc, animated: true)
}
}
}
} else if (campaigns[indexPath.row]._campaign_type == "coupon") {
let couponsetUuid = campaigns[indexPath.row]._couponset
if (couponsetUuid != "") {
......
......@@ -73,7 +73,23 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
}
public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if (campaigns[indexPath.row]._campaign_type == "coupon") {
if (campaigns[indexPath.row]._type != nil && campaigns[indexPath.row]._type == "telco") {
let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns()
let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid }
if (loyaltyCampaignIdExists == true) {
for item in ccmsCampaigns {
if (item._loyaltyCampaignId == campaigns[indexPath.row].session_uuid) {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "TelcoViewController") as! SwiftWarplyFramework.TelcoViewController
vc.ccms = item
vc.campaign = campaigns[indexPath.row]
self.navigationController?.pushViewController(vc, animated: true)
}
}
}
} else if (campaigns[indexPath.row]._campaign_type == "coupon") {
let couponsetUuid = campaigns[indexPath.row]._couponset
if (couponsetUuid != "") {
......
......@@ -19,8 +19,8 @@ import UIKit
let uiscreen: CGRect = UIScreen.main.bounds
// TODO: modify this
public var couponset: swiftApi.CouponSetItemModel?
public var ccms: swiftApi.LoyaltyContextualOfferModel?
public var campaign: swiftApi.CampaignItemModel?
public override func viewDidLoad() {
......@@ -36,12 +36,11 @@ import UIKit
scrollView.layer.cornerRadius = 30
scrollView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius
heroImage.load(link: couponset?.img_preview ?? "", placeholder: UIImage(), cache: URLCache())
heroImage.load(link: ccms?._imageUrl ?? "", placeholder: UIImage(), cache: URLCache())
heroImage.contentMode = .scaleAspectFill
heroImageHeight.constant = self.uiscreen.height * 0.25
nameLabel.text = couponset?.name ?? ""
descriptionLabel.text = couponset?.short_description ?? ""
nameLabel.text = ccms?._title ?? ""
descriptionLabel.text = ccms?._subtitle ?? ""
activateButton.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .semibold)
activateButton.setTitle("Ενεργοποίηση", for: .normal)
......@@ -58,10 +57,9 @@ import UIKit
func activateSetCallback (_ response: swiftApi.GenericResponseModel?) -> Void {
assertionFailure("to be implemented")
}
// MARK: - Actions
@IBAction func activateButtomAction(_ sender: Any) {
activateSetRequest(uuid: couponset?.uuid ?? "")
// activateSetRequest(uuid: couponset?.uuid ?? "")
}
}
......