Manos Chorianopoulos

add native couponset flow at gfyVC, mfyVC

......@@ -84,6 +84,25 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
}
public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if (campaigns[indexPath.row]._campaign_type == "coupon") {
let couponsetUuid = campaigns[indexPath.row]._couponset
if (couponsetUuid != "") {
let couponsetsList = swiftApi().getCouponSetList()
for item in couponsetsList {
if (item.uuid == couponsetUuid) {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as! SwiftWarplyFramework.CouponViewController
vc.couponset = item
self.navigationController?.pushViewController(vc, animated: true)
break;
}
}
}
} else {
if (campaigns[indexPath.row].session_uuid != nil && campaigns[indexPath.row].session_uuid != "") {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController
......@@ -138,5 +157,6 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
SwiftEventBus.post("seasonal", sender: seasonalEvent)
}
}
}
}
......
......@@ -73,7 +73,25 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
}
public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if (campaigns[indexPath.row]._campaign_type == "coupon") {
let couponsetUuid = campaigns[indexPath.row]._couponset
if (couponsetUuid != "") {
let couponsetsList = swiftApi().getCouponSetList()
for item in couponsetsList {
if (item.uuid == couponsetUuid) {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as! SwiftWarplyFramework.CouponViewController
vc.couponset = item
self.navigationController?.pushViewController(vc, animated: true)
break;
}
}
}
} 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])
......@@ -81,5 +99,6 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
vc.campaignUrl = url
self.navigationController?.pushViewController(vc, animated: true)
}
}
}
......