Manos Chorianopoulos

add native couponset flow at gfyVC, mfyVC

...@@ -84,6 +84,25 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -84,6 +84,25 @@ 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") {
88 + let couponsetUuid = campaigns[indexPath.row]._couponset
89 +
90 + if (couponsetUuid != "") {
91 + let couponsetsList = swiftApi().getCouponSetList()
92 +
93 + for item in couponsetsList {
94 + if (item.uuid == couponsetUuid) {
95 + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
96 + let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as! SwiftWarplyFramework.CouponViewController
97 + vc.couponset = item
98 + self.navigationController?.pushViewController(vc, animated: true)
99 +
100 + break;
101 + }
102 + }
103 + }
104 +
105 + } else {
87 if (campaigns[indexPath.row].session_uuid != nil && campaigns[indexPath.row].session_uuid != "") { 106 if (campaigns[indexPath.row].session_uuid != nil && campaigns[indexPath.row].session_uuid != "") {
88 let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) 107 let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
89 let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController 108 let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController
...@@ -138,5 +157,6 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -138,5 +157,6 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
138 SwiftEventBus.post("seasonal", sender: seasonalEvent) 157 SwiftEventBus.post("seasonal", sender: seasonalEvent)
139 } 158 }
140 } 159 }
160 + }
141 161
142 } 162 }
......
...@@ -73,7 +73,25 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -73,7 +73,25 @@ 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") {
77 + let couponsetUuid = campaigns[indexPath.row]._couponset
76 78
79 + if (couponsetUuid != "") {
80 + let couponsetsList = swiftApi().getCouponSetList()
81 +
82 + for item in couponsetsList {
83 + if (item.uuid == couponsetUuid) {
84 + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
85 + let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as! SwiftWarplyFramework.CouponViewController
86 + vc.couponset = item
87 + self.navigationController?.pushViewController(vc, animated: true)
88 +
89 + break;
90 + }
91 + }
92 + }
93 +
94 + } else {
77 let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) 95 let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
78 let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController 96 let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController
79 let url = swiftApi().constructCampaignUrl(campaigns[indexPath.row]) 97 let url = swiftApi().constructCampaignUrl(campaigns[indexPath.row])
...@@ -81,5 +99,6 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -81,5 +99,6 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
81 vc.campaignUrl = url 99 vc.campaignUrl = url
82 self.navigationController?.pushViewController(vc, animated: true) 100 self.navigationController?.pushViewController(vc, animated: true)
83 } 101 }
102 + }
84 103
85 } 104 }
......