Showing
1 changed file
with
21 additions
and
0 deletions
| ... | @@ -7,12 +7,14 @@ | ... | @@ -7,12 +7,14 @@ |
| 7 | 7 | ||
| 8 | import Foundation | 8 | import Foundation |
| 9 | import UIKit | 9 | import UIKit |
| 10 | +import SwiftEventBus | ||
| 10 | 11 | ||
| 11 | @objc public class GiftsViewController: UIViewController { | 12 | @objc public class GiftsViewController: UIViewController { |
| 12 | @IBOutlet weak var mainView: UIView! | 13 | @IBOutlet weak var mainView: UIView! |
| 13 | @IBOutlet weak var tableView: UITableView! | 14 | @IBOutlet weak var tableView: UITableView! |
| 14 | 15 | ||
| 15 | public var campaigns:Array<swiftApi.CampaignItemModel> = swiftApi().getCampaignList().filter { $0.offer_category == "gifts_for_you" } | 16 | public var campaigns:Array<swiftApi.CampaignItemModel> = swiftApi().getCampaignList().filter { $0.offer_category == "gifts_for_you" } |
| 17 | + public var seasonalList:Array<swiftApi.LoyaltyGiftsForYouPackage> = swiftApi().getSeasonalList() | ||
| 16 | 18 | ||
| 17 | 19 | ||
| 18 | public override func viewDidLoad() { | 20 | public override func viewDidLoad() { |
| ... | @@ -20,6 +22,16 @@ import UIKit | ... | @@ -20,6 +22,16 @@ import UIKit |
| 20 | 22 | ||
| 21 | self.hidesBottomBarWhenPushed = true | 23 | self.hidesBottomBarWhenPushed = true |
| 22 | 24 | ||
| 25 | + if (seasonalList.count > 0) { | ||
| 26 | + for seasonalItem in seasonalList { | ||
| 27 | + let newCampaign = swiftApi.CampaignItemModel() | ||
| 28 | + newCampaign._title = seasonalItem._title | ||
| 29 | + newCampaign._logo_url = seasonalItem._imageUrl | ||
| 30 | + newCampaign._loyaltyPackageId = seasonalItem._loyaltyPackageId | ||
| 31 | + campaigns.append(newCampaign) | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | + | ||
| 23 | setBackButton() | 35 | setBackButton() |
| 24 | setNavigationTitle("GIFTS for YOU") | 36 | setNavigationTitle("GIFTS for YOU") |
| 25 | 37 | ||
| ... | @@ -66,6 +78,7 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -66,6 +78,7 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ |
| 66 | } | 78 | } |
| 67 | 79 | ||
| 68 | public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | 80 | public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { |
| 81 | + if (campaigns[indexPath.row].session_uuid != nil && campaigns[indexPath.row].session_uuid != "") { | ||
| 69 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | 82 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) |
| 70 | let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController | 83 | let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController |
| 71 | var url = "" | 84 | var url = "" |
| ... | @@ -92,6 +105,14 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -92,6 +105,14 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ |
| 92 | } | 105 | } |
| 93 | vc.campaignUrl = url | 106 | vc.campaignUrl = url |
| 94 | self.navigationController?.pushViewController(vc, animated: true) | 107 | self.navigationController?.pushViewController(vc, animated: true) |
| 108 | + | ||
| 109 | + } else { | ||
| 110 | + let seasonalEvent = swiftApi.LoyaltyGiftsForYouOfferClickEvent() | ||
| 111 | + seasonalEvent._title = campaigns[indexPath.row]._title ?? "" | ||
| 112 | + seasonalEvent._imageUrl = campaigns[indexPath.row]._logo_url ?? "" | ||
| 113 | + seasonalEvent._loyaltyPackageId = campaigns[indexPath.row]._loyaltyPackageId ?? "" | ||
| 114 | + SwiftEventBus.post("seasonal", sender: seasonalEvent) | ||
| 115 | + } | ||
| 95 | } | 116 | } |
| 96 | 117 | ||
| 97 | } | 118 | } | ... | ... |
-
Please register or login to post a comment