Showing
5 changed files
with
71 additions
and
10 deletions
... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ |
7 | <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> | 7 | <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> |
8 | <dict> | 8 | <dict> |
9 | <key>orderHint</key> | 9 | <key>orderHint</key> |
10 | - <integer>0</integer> | 10 | + <integer>1</integer> |
11 | </dict> | 11 | </dict> |
12 | </dict> | 12 | </dict> |
13 | </dict> | 13 | </dict> | ... | ... |
... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ |
7 | <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> | 7 | <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> |
8 | <dict> | 8 | <dict> |
9 | <key>orderHint</key> | 9 | <key>orderHint</key> |
10 | - <integer>1</integer> | 10 | + <integer>0</integer> |
11 | </dict> | 11 | </dict> |
12 | </dict> | 12 | </dict> |
13 | </dict> | 13 | </dict> | ... | ... |
No preview for this file type
This diff is collapsed. Click to expand it.
... | @@ -10,22 +10,83 @@ import UIKit | ... | @@ -10,22 +10,83 @@ import UIKit |
10 | import SwiftEventBus | 10 | import SwiftEventBus |
11 | 11 | ||
12 | @objc public class UnifiedCouponsViewController: UIViewController { | 12 | @objc public class UnifiedCouponsViewController: UIViewController { |
13 | + @IBOutlet weak var backgroundImage: UIImageView! | ||
14 | + @IBOutlet weak var tableView: UITableView! | ||
15 | + | ||
16 | + public var unifiedCoupons:Array<swiftApi.UnifiedCouponModel> = [] | ||
13 | 17 | ||
14 | public override func viewDidLoad() { | 18 | public override func viewDidLoad() { |
15 | super.viewDidLoad() | 19 | super.viewDidLoad() |
16 | 20 | ||
17 | - // Do any additional setup after loading the view. | 21 | + self.hidesBottomBarWhenPushed = true |
22 | + | ||
23 | + SwiftEventBus.onBackgroundThread(self, name: "unified_coupons_fetched") { result in | ||
24 | + | ||
25 | + DispatchQueue.main.async { | ||
26 | + self.unifiedCoupons = swiftApi().getUnifiedCouponList() | ||
27 | + self.tableView.reloadData() | ||
28 | + } | ||
29 | + } | ||
30 | + | ||
31 | + setBackButton() | ||
32 | + setNavigationTitle("SUPERMARKET DEALS") | ||
33 | + | ||
34 | +// backgroundImage.image = UIImage(named: "coupons_scrollview_dark", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
35 | + | ||
36 | + tableView.delegate = self | ||
37 | + tableView.dataSource = self | ||
38 | + | ||
39 | +// tableView.clipsToBounds = true | ||
40 | +// tableView.layer.cornerRadius = 30 | ||
41 | +// tableView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius | ||
42 | + tableView.contentInset.top = 30 | ||
43 | + } | ||
44 | + | ||
45 | + public override func viewWillAppear(_ animated: Bool) { | ||
46 | + super.viewWillAppear(animated) | ||
47 | + | ||
48 | + swiftApi().logTrackersEvent("screen", "ActiveUnifiedCouponsScreen") | ||
49 | + | ||
50 | + self.unifiedCoupons = swiftApi().getUnifiedCouponList() | ||
51 | + self.tableView.reloadData() | ||
52 | + | ||
53 | + self.navigationController?.hideHairline() | ||
54 | + } | ||
55 | + | ||
56 | + // MARK: - Functions | ||
57 | +} | ||
58 | + | ||
59 | +// MARK: - TableView | ||
60 | +extension UnifiedCouponsViewController: UITableViewDelegate, UITableViewDataSource{ | ||
61 | + | ||
62 | + public func numberOfSections(in tableView: UITableView) -> Int { | ||
63 | + return 1 | ||
64 | + } | ||
65 | + | ||
66 | + public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
67 | + return self.unifiedCoupons.count | ||
18 | } | 68 | } |
19 | 69 | ||
70 | + public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
71 | + return 130.0 + 8.0 | ||
72 | +// return UITableViewAutomaticDimension | ||
73 | + } | ||
74 | + | ||
75 | + public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
76 | + let cell = tableView.dequeueReusableCell(withIdentifier: "UnifiedCouponsTableViewCellId", for: indexPath) as! UnifiedCouponsTableViewCell | ||
77 | + cell.configureCell(coupon: unifiedCoupons[indexPath.row]) | ||
78 | + return cell | ||
79 | + } | ||
20 | 80 | ||
21 | - /* | 81 | + public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { |
22 | - // MARK: - Navigation | 82 | + let couponBarcode = unifiedCoupons[indexPath.row]._barcode |
83 | + swiftApi().logTrackersEvent("click", ("UnifiedCoupon:" + couponBarcode)) | ||
23 | 84 | ||
24 | - // In a storyboard-based application, you will often want to do a little preparation before navigation | 85 | + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) |
25 | - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { | 86 | + let vc = storyboard.instantiateViewController(withIdentifier: "UnifiedCouponBarcodeViewController") as! SwiftWarplyFramework.UnifiedCouponBarcodeViewController |
26 | - // Get the new view controller using segue.destination. | 87 | + vc.coupon = unifiedCoupons[indexPath.row] |
27 | - // Pass the selected object to the new view controller. | 88 | + vc.isFromWallet = true |
89 | + self.navigationController?.pushViewController(vc, animated: true) | ||
28 | } | 90 | } |
29 | - */ | ||
30 | 91 | ||
31 | } | 92 | } | ... | ... |
-
Please register or login to post a comment