delete unnecessary files and code, add openSuperMarketsFlow function
1 | { | 1 | { |
2 | + "originHash" : "a973e37718e3a158b792c38b1b8ebf4fb41961343f7a99be3fa56123caed92c7", | ||
2 | "pins" : [ | 3 | "pins" : [ |
3 | { | 4 | { |
4 | - "identity" : "rsbarcodes_swift", | ||
5 | - "kind" : "remoteSourceControl", | ||
6 | - "location" : "https://github.com/yeahdongcn/RSBarcodes_Swift", | ||
7 | - "state" : { | ||
8 | - "revision" : "86d8b1a1439e7edb19793d17732b15fd784a0a15", | ||
9 | - "version" : "5.1.1" | ||
10 | - } | ||
11 | - }, | ||
12 | - { | ||
13 | "identity" : "swifteventbus", | 5 | "identity" : "swifteventbus", |
14 | "kind" : "remoteSourceControl", | 6 | "kind" : "remoteSourceControl", |
15 | "location" : "https://github.com/cesarferreira/SwiftEventBus", | 7 | "location" : "https://github.com/cesarferreira/SwiftEventBus", |
... | @@ -19,5 +11,5 @@ | ... | @@ -19,5 +11,5 @@ |
19 | } | 11 | } |
20 | } | 12 | } |
21 | ], | 13 | ], |
22 | - "version" : 2 | 14 | + "version" : 3 |
23 | } | 15 | } | ... | ... |
1 | -// | ||
2 | -// ActiveCodeTableViewCell.swift | ||
3 | -// SwiftWarplyFramework | ||
4 | -// | ||
5 | -// Created by Manos Chorianopoulos on 3/4/23. | ||
6 | -// | ||
7 | - | ||
8 | -import UIKit | ||
9 | - | ||
10 | -@objc public class ActiveCodeTableViewCell: UITableViewCell { | ||
11 | - @IBOutlet weak var activeCodeView: UIView! | ||
12 | - @IBOutlet weak var activeCodeViewHeight: NSLayoutConstraint! | ||
13 | - @IBOutlet weak var activeCodesCountLabel: UILabel! | ||
14 | - @IBOutlet weak var activeCodeLabel: UILabel! | ||
15 | - @IBOutlet weak var activeCodeExpirationLabel: UILabel! | ||
16 | - @IBOutlet weak var activeCodeImage: UIImageView! | ||
17 | - @IBOutlet weak var activeCodeScrollView: UIScrollView! | ||
18 | - @IBOutlet weak var activeCodeScrollViewHeight: NSLayoutConstraint! | ||
19 | - @IBOutlet weak var activeCodeContentView: UIView! | ||
20 | - @IBOutlet weak var activeCodeContentViewHeight: NSLayoutConstraint! | ||
21 | - | ||
22 | - public var dfyCoupons:Array<swiftApi.ActiveDFYCouponModel> = swiftApi().getActiveDFYCoupons() | ||
23 | - | ||
24 | - public override func awakeFromNib() { | ||
25 | - super.awakeFromNib() | ||
26 | - | ||
27 | - // TODO: DELETE ===> | ||
28 | - // let coupon = swiftApi.ActiveDFYCouponModel() | ||
29 | - // coupon._value = "12" | ||
30 | - // // coupon._date = "2022-12-05 01:55:01" | ||
31 | - // coupon._date = "2022-10-26 23:59:01" | ||
32 | - // coupon._code = "123456789" | ||
33 | - | ||
34 | - // let coupon2 = swiftApi.ActiveDFYCouponModel() | ||
35 | - // coupon2._value = "23" | ||
36 | - // coupon2._date = "2022-11-05 01:55" | ||
37 | - // coupon2._code = "234567891" | ||
38 | - | ||
39 | - // let coupon3 = swiftApi.ActiveDFYCouponModel() | ||
40 | - // coupon3._value = "34" | ||
41 | - // coupon3._date = "2022-07-01 01:55" | ||
42 | - // coupon3._code = "345678912" | ||
43 | - | ||
44 | - // let couponsArray: Array<swiftApi.ActiveDFYCouponModel> = [coupon, coupon2, coupon3, coupon3, coupon3] | ||
45 | - | ||
46 | - // swiftApi().setActiveDFYCoupons(dfyCoupons: couponsArray) | ||
47 | - | ||
48 | - // dfyCoupons = swiftApi().getActiveDFYCoupons() | ||
49 | - // TODO: DELETE <=== | ||
50 | - | ||
51 | - // Add shadow | ||
52 | - self.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.2).cgColor | ||
53 | - self.layer.shadowOffset = CGSize(width: 0.0, height: 1.0) | ||
54 | - self.layer.shadowOpacity = 1.0 | ||
55 | - self.layer.shadowRadius = 1.0 | ||
56 | - | ||
57 | - activeCodeView.layer.cornerRadius = 16.5 | ||
58 | - // activeCodeView.layer.borderWidth = 1 | ||
59 | - // activeCodeView.layer.borderColor = UIColor(red: 0.90, green: 0.90, blue: 0.90, alpha: 1.00).cgColor | ||
60 | - | ||
61 | - activeCodeImage.image = UIImage(named: "active_code_logo_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
62 | - | ||
63 | - if (dfyCoupons.count > 0) { | ||
64 | - if (dfyCoupons.count == 1) { | ||
65 | - let dateFormatter = DateFormatter() | ||
66 | - dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" | ||
67 | - // dateFormatter.dateFormat = "yyyy-MM-dd HH:mm" | ||
68 | - | ||
69 | - // sort dfyCoupons by date | ||
70 | - dfyCoupons.sort(by: { | ||
71 | - let date1 = dateFormatter.date(from: $0._date) | ||
72 | - let date2 = dateFormatter.date(from: $1._date) | ||
73 | - | ||
74 | - if ((date1 != nil) && (date2 != nil)) { | ||
75 | - return date1!.compare(date2!) == .orderedAscending | ||
76 | - } else { | ||
77 | - return false | ||
78 | - } | ||
79 | - | ||
80 | - }) | ||
81 | - | ||
82 | - // Get days from now of the most recet coupon | ||
83 | - var daysFromNow = "" | ||
84 | - let calendar = Calendar.current | ||
85 | - | ||
86 | - // Replace the hour (time) of both dates with 00:00 | ||
87 | - let date1 = calendar.startOfDay(for: Date()) | ||
88 | - if let date2 = dateFormatter.date(from: dfyCoupons[0]._date) { | ||
89 | - let components = calendar.dateComponents([.day], from: date1, to: date2) | ||
90 | - daysFromNow = (components.day) != nil ? String((components.day ?? 0) + 1) : "" | ||
91 | - } | ||
92 | - | ||
93 | - activeCodesCountLabel.text = "Ενεργός κωδικός:" | ||
94 | - // activeCodeLabel.text = dfyCoupons[0]._code | ||
95 | - let newLabel = CopyableLabel() | ||
96 | - newLabel.text = String(dfyCoupons[0]._code) | ||
97 | - newLabel.font = UIFont(name: "PeridotPE-Bold", size: 18) | ||
98 | - newLabel.textColor = UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00) | ||
99 | - newLabel.frame.size.width = newLabel.intrinsicContentSize.width | ||
100 | - newLabel.frame.size.height = newLabel.intrinsicContentSize.height // tagHeight | ||
101 | - activeCodeContentView.addSubview(newLabel) | ||
102 | - // set the btn frame origin | ||
103 | - newLabel.frame.origin.x = 0 | ||
104 | - newLabel.frame.origin.y = 0 | ||
105 | - let scrollHeight = newLabel.intrinsicContentSize.height | ||
106 | - activeCodeContentViewHeight.constant = scrollHeight | ||
107 | - activeCodeScrollViewHeight.constant = scrollHeight | ||
108 | - | ||
109 | - activeCodeExpirationLabel.isHidden = false | ||
110 | - if (daysFromNow == "1") { | ||
111 | - activeCodeExpirationLabel.text = "Λήγει σε " + daysFromNow + " ημέρα" | ||
112 | - } else { | ||
113 | - activeCodeExpirationLabel.text = "Λήγει σε " + daysFromNow + " ημέρες" | ||
114 | - } | ||
115 | - | ||
116 | - } else { | ||
117 | - var tagHeight:CGFloat = 30 | ||
118 | - let tagPadding: CGFloat = 0 | ||
119 | - let tagSpacingX: CGFloat = 0 | ||
120 | - let tagSpacingY: CGFloat = 2 | ||
121 | - | ||
122 | - let containerWidth = activeCodeContentView.frame.size.width | ||
123 | - | ||
124 | - var currentOriginX: CGFloat = 0 | ||
125 | - var currentOriginY: CGFloat = 0 | ||
126 | - | ||
127 | - // var couponCodesString = "" | ||
128 | - for (index, item) in dfyCoupons.enumerated() { | ||
129 | - let newLabel = CopyableLabel() | ||
130 | - newLabel.font = UIFont(name: "PeridotPE-Bold", size: 18) | ||
131 | - newLabel.textColor = UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00) | ||
132 | - | ||
133 | - if (index == (dfyCoupons.endIndex - 1)) { | ||
134 | - // couponCodesString += String(item._code) | ||
135 | - newLabel.text = String(item._code) | ||
136 | - } else { | ||
137 | - // couponCodesString += String(item._code) + ", " | ||
138 | - newLabel.text = String(item._code) + ", " | ||
139 | - } | ||
140 | - | ||
141 | - newLabel.frame.size.width = newLabel.intrinsicContentSize.width + tagPadding | ||
142 | - newLabel.frame.size.height = newLabel.intrinsicContentSize.height // tagHeight | ||
143 | - tagHeight = newLabel.intrinsicContentSize.height | ||
144 | - activeCodeContentView.addSubview(newLabel) | ||
145 | - | ||
146 | - // if current X + label width will be greater than container view width | ||
147 | - // "move to next row" | ||
148 | - if currentOriginX + newLabel.frame.width > containerWidth { | ||
149 | - currentOriginX = 0 | ||
150 | - currentOriginY += tagHeight + tagSpacingY | ||
151 | - } | ||
152 | - | ||
153 | - // set the btn frame origin | ||
154 | - newLabel.frame.origin.x = currentOriginX | ||
155 | - newLabel.frame.origin.y = currentOriginY | ||
156 | - | ||
157 | - // increment current X by btn width + spacing | ||
158 | - currentOriginX += newLabel.frame.width + tagSpacingX | ||
159 | - } | ||
160 | - | ||
161 | - activeCodesCountLabel.text = String(dfyCoupons.count) + " Ενεργοί κωδικοί:" | ||
162 | - // activeCodeLabel.text = couponCodesString | ||
163 | - activeCodeExpirationLabel.isHidden = true | ||
164 | - | ||
165 | - // update container view height | ||
166 | - activeCodeContentViewHeight.constant = currentOriginY + tagHeight | ||
167 | - if ((currentOriginY + tagHeight) <= (2 * tagHeight + tagSpacingY)) { | ||
168 | - activeCodeScrollViewHeight.constant = currentOriginY + tagHeight | ||
169 | - } else { | ||
170 | - activeCodeScrollViewHeight.constant = 2 * tagHeight + tagSpacingY | ||
171 | - } | ||
172 | - } | ||
173 | - } else { | ||
174 | - activeCodeLabel.text = "-" | ||
175 | - activeCodeExpirationLabel.text = "" | ||
176 | - | ||
177 | - activeCodeView.isHidden = true | ||
178 | - | ||
179 | - activeCodeViewHeight.constant = 0 | ||
180 | - } | ||
181 | - } | ||
182 | - | ||
183 | - public override func setSelected(_ selected: Bool, animated: Bool) { | ||
184 | - super.setSelected(selected, animated: animated) | ||
185 | - | ||
186 | - // Configure the view for the selected state | ||
187 | - } | ||
188 | - | ||
189 | - public override func layoutSubviews() { | ||
190 | - super.layoutSubviews() | ||
191 | - //set the values for top,left,bottom,right margins | ||
192 | - let margins = UIEdgeInsets(top: 2, left: 0, bottom: 4, right: 0) | ||
193 | - contentView.frame = contentView.frame.inset(by: margins) | ||
194 | - } | ||
195 | - | ||
196 | -} |
1 | -// | ||
2 | -// ActiveGiftsViewController.swift | ||
3 | -// SwiftWarplyFramework | ||
4 | -// | ||
5 | -// Created by Βασιλης Σκουρας on 11/5/22. | ||
6 | -// | ||
7 | - | ||
8 | -import Foundation | ||
9 | -import UIKit | ||
10 | - | ||
11 | -@objc public class ActiveGiftsViewController: UIViewController { | ||
12 | - | ||
13 | - @IBOutlet weak var couponButton: UIButton! | ||
14 | - | ||
15 | - public override func viewWillAppear(_ animated: Bool) { | ||
16 | - super.viewWillAppear(animated) | ||
17 | - | ||
18 | - self.hidesBottomBarWhenPushed = true | ||
19 | - setBackButton() | ||
20 | - setNavigationTitle("Ενεργά δώρα") | ||
21 | - } | ||
22 | - | ||
23 | - @IBAction func navigateToCoupon(_ sender: Any) { | ||
24 | - let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | ||
25 | - let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as! SwiftWarplyFramework.CouponViewController | ||
26 | - self.navigationController?.pushViewController(vc, animated: true) | ||
27 | - } | ||
28 | - | ||
29 | -} |
1 | -// | ||
2 | -// AnalysisHeaderMessageViewCell.swift | ||
3 | -// SwiftWarplyFramework | ||
4 | -// | ||
5 | -// Created by Manos Chorianopoulos on 18/7/22. | ||
6 | -// | ||
7 | - | ||
8 | -import UIKit | ||
9 | - | ||
10 | -class AnalysisHeaderMessageViewCell: UITableViewCell { | ||
11 | - | ||
12 | - // attributes | ||
13 | - @IBOutlet weak var itemImage: UIImageView! | ||
14 | - @IBOutlet weak var messageLabelView: UIView! | ||
15 | - @IBOutlet weak var messageLabel: UILabel! | ||
16 | - @IBOutlet weak var titleLabel: UILabel! | ||
17 | - @IBOutlet weak var emptyLabel: UILabel! | ||
18 | - @IBOutlet weak var emptyLabelHeight: NSLayoutConstraint! | ||
19 | - @IBOutlet weak var emptyLabelTopSpace: NSLayoutConstraint! | ||
20 | - @IBOutlet weak var emptyLabelBottomSpace: NSLayoutConstraint! | ||
21 | - | ||
22 | - public var loyaltyBadge:swiftApi.LoyaltyBadgeModel = swiftApi().getLoyaltyBadge() | ||
23 | - | ||
24 | - // lifecycle | ||
25 | - override func awakeFromNib() { | ||
26 | - super.awakeFromNib() | ||
27 | - | ||
28 | - // image | ||
29 | -// itemImage.image = UIImage(named: "ic_gift_circle_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
30 | - | ||
31 | - // title | ||
32 | - titleLabel.textColor = UIColor(rgb: 0x212121) | ||
33 | - titleLabel.text = "Αναλυτικά:" | ||
34 | - | ||
35 | - // message | ||
36 | - messageLabel.textColor = UIColor(rgb: 0x212121) | ||
37 | - // messageLabelView.layer.borderWidth = 1.0 | ||
38 | - // messageLabelView.layer.borderColor = UIColor(rgb: 0xE6E6E6).cgColor | ||
39 | - messageLabelView.layer.cornerRadius = 16.5 | ||
40 | - messageLabelView.backgroundColor = .white | ||
41 | - | ||
42 | -// messageLabel.text = "Μέχρι τώρα έχεις κερδίσει " + totalCouponDiscountString + "€ σε προσφορές από " + String(loyaltyBadge._couponCount) + " κουπόνια!" | ||
43 | - | ||
44 | - } | ||
45 | -} | ||
46 | - | ||
47 | -extension AnalysisHeaderMessageViewCell { | ||
48 | - func configureCell(isEmpty: Bool, isMarket: Bool) { | ||
49 | - | ||
50 | - if (isEmpty == true) { | ||
51 | - emptyLabel.isHidden = false | ||
52 | - emptyLabelHeight.constant = 18.5 | ||
53 | - emptyLabelTopSpace.constant = 30.0 | ||
54 | - emptyLabelBottomSpace.constant = 10.0 | ||
55 | - } else { | ||
56 | - emptyLabel.isHidden = true | ||
57 | - emptyLabelHeight.constant = 0.0 | ||
58 | - emptyLabelTopSpace.constant = 0.0 | ||
59 | - emptyLabelBottomSpace.constant = 0.0 | ||
60 | - } | ||
61 | - | ||
62 | - if (isMarket == true) { | ||
63 | - itemImage.image = UIImage(named: "ic_history_market_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
64 | - | ||
65 | - let oldUnifiedCouponList: Array<swiftApi.CouponItemModel> = swiftApi().getOldUnifiedCouponList() | ||
66 | - let oldUnifiedCouponListLength = oldUnifiedCouponList.count | ||
67 | - var unifiedCouponsDiscount: Float = 0.0 | ||
68 | - | ||
69 | - for coupon in oldUnifiedCouponList { | ||
70 | - if let discountFloat = Float(coupon.discount ?? "0.0") { | ||
71 | - unifiedCouponsDiscount += discountFloat | ||
72 | - } | ||
73 | - } | ||
74 | - | ||
75 | - let totalCouponDiscount = Float(round(100 * unifiedCouponsDiscount) / 100) | ||
76 | - var totalCouponDiscountString = "0" | ||
77 | - totalCouponDiscountString = String(format: "%.2f", totalCouponDiscount).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil) | ||
78 | - | ||
79 | - let coupNormalText1 = "Μέχρι τώρα έχεις κερδίσει " | ||
80 | - let coupBoldText = totalCouponDiscountString + "€" | ||
81 | - let coupNormalText2 = " σε προσφορές από " | ||
82 | - let coupBoldText2 = String(oldUnifiedCouponListLength) | ||
83 | - let coupNormalText3 = " κουπόνια!" | ||
84 | - | ||
85 | - let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Regular", size: 17) ?? UIFont.systemFont(ofSize: 16)] | ||
86 | - let attrBold = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Bold", size: 17) ?? UIFont.boldSystemFont(ofSize: 16)] | ||
87 | - | ||
88 | - let coupAttributedString = NSMutableAttributedString(string:coupNormalText1, attributes:attrRegular) | ||
89 | - let coupBoldString = NSMutableAttributedString(string: coupBoldText, attributes:attrBold) | ||
90 | - let coupNormalString2 = NSMutableAttributedString(string:coupNormalText2, attributes:attrRegular) | ||
91 | - let coupBoldString2 = NSMutableAttributedString(string: coupBoldText2, attributes:attrBold) | ||
92 | - let coupNormalString3 = NSMutableAttributedString(string:coupNormalText3, attributes:attrRegular) | ||
93 | - | ||
94 | - coupAttributedString.append(coupBoldString) | ||
95 | - coupAttributedString.append(coupNormalString2) | ||
96 | - coupAttributedString.append(coupBoldString2) | ||
97 | - coupAttributedString.append(coupNormalString3) | ||
98 | - messageLabel.attributedText = coupAttributedString | ||
99 | - | ||
100 | - } else { | ||
101 | - itemImage.image = UIImage(named: "ic_gift_history", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
102 | - | ||
103 | - let totalCouponDiscount = Float(round(100 * loyaltyBadge._value) / 100) | ||
104 | - var totalCouponDiscountString = "0" | ||
105 | - totalCouponDiscountString = String(format: "%.2f", totalCouponDiscount).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil) | ||
106 | - | ||
107 | - let coupNormalText1 = "Μέχρι τώρα έχεις κερδίσει " | ||
108 | - let coupBoldText = totalCouponDiscountString + "€" | ||
109 | - let coupNormalText2 = " σε προσφορές από " | ||
110 | - let coupBoldText2 = String(loyaltyBadge._couponCount) | ||
111 | - let coupNormalText3 = " κουπόνια!" | ||
112 | - | ||
113 | - let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Regular", size: 17) ?? UIFont.systemFont(ofSize: 16)] | ||
114 | - let attrBold = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Bold", size: 17) ?? UIFont.boldSystemFont(ofSize: 16)] | ||
115 | - | ||
116 | - let coupAttributedString = NSMutableAttributedString(string:coupNormalText1, attributes:attrRegular) | ||
117 | - let coupBoldString = NSMutableAttributedString(string: coupBoldText, attributes:attrBold) | ||
118 | - let coupNormalString2 = NSMutableAttributedString(string:coupNormalText2, attributes:attrRegular) | ||
119 | - let coupBoldString2 = NSMutableAttributedString(string: coupBoldText2, attributes:attrBold) | ||
120 | - let coupNormalString3 = NSMutableAttributedString(string:coupNormalText3, attributes:attrRegular) | ||
121 | - | ||
122 | - coupAttributedString.append(coupBoldString) | ||
123 | - coupAttributedString.append(coupNormalString2) | ||
124 | - coupAttributedString.append(coupBoldString2) | ||
125 | - coupAttributedString.append(coupNormalString3) | ||
126 | - messageLabel.attributedText = coupAttributedString | ||
127 | - } | ||
128 | - | ||
129 | - } | ||
130 | -} |
1 | -// | ||
2 | -// AnalysisHeaderViewCell.swift | ||
3 | -// SwiftWarplyFramework | ||
4 | -// | ||
5 | -// Created by Manos Chorianopoulos on 18/7/22. | ||
6 | -// | ||
7 | - | ||
8 | -import UIKit | ||
9 | - | ||
10 | -class AnalysisHeaderViewCell: UITableViewCell { | ||
11 | - | ||
12 | - // attributes | ||
13 | - @IBOutlet weak var itemImage: UIImageView! | ||
14 | - @IBOutlet weak var titleLabel: UILabel! | ||
15 | - @IBOutlet weak var emptyLabel: UILabel! | ||
16 | - @IBOutlet weak var emptyLabelHeight: NSLayoutConstraint! | ||
17 | - @IBOutlet weak var emptyLabelTopSpace: NSLayoutConstraint! | ||
18 | - @IBOutlet weak var emptyLabelBottomSpace: NSLayoutConstraint! | ||
19 | - | ||
20 | - // lifecycle | ||
21 | - override func awakeFromNib() { | ||
22 | - super.awakeFromNib() | ||
23 | - | ||
24 | - // image | ||
25 | -// itemImage.image = UIImage(named: "ic_gift_circle_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
26 | - | ||
27 | - // title | ||
28 | -// titleLabel.textColor = UIColor(rgb: 0x435563) | ||
29 | -// titleLabel.text = "Αναλυτικά:" | ||
30 | - } | ||
31 | -} | ||
32 | - | ||
33 | -extension AnalysisHeaderViewCell { | ||
34 | - func configureCell(isEmpty: Bool, isMarket: Bool) { | ||
35 | - | ||
36 | - if (isEmpty == true) { | ||
37 | - emptyLabel.isHidden = false | ||
38 | - emptyLabelHeight.constant = 18.5 | ||
39 | -// emptyLabelTopSpace.constant = 30.0 | ||
40 | - emptyLabelBottomSpace.constant = 10.0 | ||
41 | - } else { | ||
42 | - emptyLabel.isHidden = true | ||
43 | - emptyLabelHeight.constant = 0.0 | ||
44 | -// emptyLabelTopSpace.constant = 0.0 | ||
45 | - emptyLabelBottomSpace.constant = 0.0 | ||
46 | - } | ||
47 | - | ||
48 | - if (isMarket == true) { | ||
49 | - itemImage.image = UIImage(named: "ic_history_market_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
50 | - } else { | ||
51 | - itemImage.image = UIImage(named: "ic_gift_history", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
52 | - } | ||
53 | - | ||
54 | - } | ||
55 | -} |
1 | -// | ||
2 | -// AnalysisItem.swift | ||
3 | -// SwiftWarplyFramework | ||
4 | -// | ||
5 | -// Created by Manos Chorianopoulos on 18/7/22. | ||
6 | -// | ||
7 | - | ||
8 | -import UIKit | ||
9 | - | ||
10 | -public class AnalysisItem: Codable { | ||
11 | - | ||
12 | - // attributes | ||
13 | - public var date: Date | ||
14 | - public var image_url: String? | ||
15 | - public var title: String? | ||
16 | - public let subtitle: String? | ||
17 | - public var price: Float | ||
18 | - | ||
19 | - // initialization | ||
20 | - public init() { | ||
21 | - self.date = Date() | ||
22 | - self.image_url = "" | ||
23 | - self.title = "" | ||
24 | - self.subtitle = "" | ||
25 | - self.price = 4.0 | ||
26 | - } | ||
27 | -} |
1 | -// | ||
2 | -// AnalysisItemViewCell.swift | ||
3 | -// SwiftWarplyFramework | ||
4 | -// | ||
5 | -// Created by Manos Chorianopoulos on 18/7/22. | ||
6 | -// | ||
7 | - | ||
8 | -import UIKit | ||
9 | - | ||
10 | -class AnalysisItemViewCell: UITableViewCell { | ||
11 | - | ||
12 | - @IBOutlet weak var dateLabel: UILabel! | ||
13 | - @IBOutlet weak var itemImage: UIImageView! | ||
14 | - @IBOutlet weak var titleLabel: UILabel! | ||
15 | - @IBOutlet weak var priceLabel: UILabel! | ||
16 | - @IBOutlet weak var subtitleLabel: UILabel! | ||
17 | - | ||
18 | - var postImageURL: String? { | ||
19 | - didSet { | ||
20 | - if let url = postImageURL { | ||
21 | - self.itemImage.image = UIImage() // UIImage(named: "loading") | ||
22 | - | ||
23 | - UIImage.loadImageUsingCacheWithUrlString(url) { image in | ||
24 | - // set the image only when we are still displaying the content for the image we finished downloading | ||
25 | - if url == self.postImageURL { | ||
26 | - self.itemImage.image = image | ||
27 | - } | ||
28 | - } | ||
29 | - } | ||
30 | - else { | ||
31 | - self.itemImage.image = nil | ||
32 | - } | ||
33 | - } | ||
34 | - } | ||
35 | - | ||
36 | - // lifecycle | ||
37 | - override func awakeFromNib() { | ||
38 | - super.awakeFromNib() | ||
39 | - | ||
40 | - // date | ||
41 | - dateLabel.textColor = UIColor(rgb: 0x212121) | ||
42 | - dateLabel.font = UIFont(name: "PeridotPE-Bold", size: 12.0) | ||
43 | - | ||
44 | - // title | ||
45 | - titleLabel.textColor = UIColor(rgb: 0x212121) | ||
46 | - titleLabel.font = UIFont(name: "PeridotPE-Regular", size: 17.0) | ||
47 | - | ||
48 | - // price | ||
49 | - priceLabel.textColor = UIColor(rgb: 0x212121) | ||
50 | - priceLabel.font = UIFont(name: "PeridotPE-Bold", size: 17.0) | ||
51 | - | ||
52 | - // subtitle | ||
53 | -// subtitleLabel.textColor = UIColor(rgb: 0x9D9D9C) | ||
54 | - subtitleLabel.textColor = UIColor(rgb: 0x212121) | ||
55 | - subtitleLabel.font = UIFont(name: "PeridotPE-Regular", size: 14.0) | ||
56 | - } | ||
57 | -} | ||
58 | - | ||
59 | -extension AnalysisItemViewCell { | ||
60 | - func configureCell(item: swiftApi.SharingCouponModel) { | ||
61 | - | ||
62 | - let merchantList:Array<swiftApi.MerchantModel> = swiftApi().getMerchantList() | ||
63 | - | ||
64 | - titleLabel.text = "" | ||
65 | - | ||
66 | - for merchant in merchantList { | ||
67 | - if (merchant._uuid == item._merchant_uuid) { | ||
68 | - // itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache()) | ||
69 | - self.postImageURL = merchant._img_preview | ||
70 | - titleLabel.text = merchant._admin_name | ||
71 | - break; | ||
72 | - } | ||
73 | - } | ||
74 | - | ||
75 | - dateLabel.text = item._date | ||
76 | - // titleLabel.text = item._name | ||
77 | - | ||
78 | - let priceFloat = Float(round(100 * (Float(item._final_price) )) / 100) | ||
79 | - var priceString = "0" | ||
80 | - priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil) | ||
81 | - priceLabel.text = priceString + "€" | ||
82 | - | ||
83 | - if ("sent" == item._sharing_type) { | ||
84 | - subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι προς " + item._receiver_msisdn) | ||
85 | - } else if ("received" == item._sharing_type) { | ||
86 | - subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι από " + item._sender_msisdn) | ||
87 | - } | ||
88 | - } | ||
89 | - | ||
90 | - func configureCell(item: swiftApi.SharingCouponModel, isMarket: Bool) { | ||
91 | - | ||
92 | - let merchantList:Array<swiftApi.MerchantModel> = swiftApi().getMerchantList() | ||
93 | - let couponSetData: swiftApi.CouponSetItemModel? = item._sm_couponset_data | ||
94 | - | ||
95 | - titleLabel.text = "" | ||
96 | - | ||
97 | - for merchant in merchantList { | ||
98 | - if (merchant._uuid == item._merchant_uuid) { | ||
99 | - // itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache()) | ||
100 | - self.postImageURL = merchant._img_preview | ||
101 | - titleLabel.text = merchant._admin_name | ||
102 | - break; | ||
103 | - } | ||
104 | - } | ||
105 | - | ||
106 | - dateLabel.text = item._date | ||
107 | - // titleLabel.text = item._name | ||
108 | -// titleLabel.text = couponSetData?.name ?? "" | ||
109 | - | ||
110 | -// let priceFloat = Float(round(100 * (Float(item._final_price) )) / 100) | ||
111 | - let priceFloat = Float(round(100 * (Float(couponSetData?.final_price ?? 0.0) )) / 100) | ||
112 | - var priceString = "0" | ||
113 | - priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil) | ||
114 | - priceLabel.text = priceString + "€" | ||
115 | - | ||
116 | - if ("sent" == item._sharing_type) { | ||
117 | - subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι προς " + item._receiver_msisdn) | ||
118 | - } else if ("received" == item._sharing_type) { | ||
119 | - subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι από " + item._sender_msisdn) | ||
120 | - } | ||
121 | - } | ||
122 | - | ||
123 | - func configureCell(item: swiftApi.CouponItemModel) { | ||
124 | - | ||
125 | -// COUPONSET: desc, img_preview, name, terms, merchant_uuid | ||
126 | -// COUPON: coupon, expiration, discount, status | ||
127 | -// MERCHANT: _img_preview,_admin_name | ||
128 | - | ||
129 | - let merchantList:Array<swiftApi.MerchantModel> = swiftApi().getMerchantList() | ||
130 | - let couponSetData: swiftApi.CouponSetItemModel? = item.couponset_data | ||
131 | - | ||
132 | - titleLabel.text = "" | ||
133 | - | ||
134 | - // for merchant in merchantList { | ||
135 | - // // if (merchant._uuid == couponSetData?.merchant_uuid) { | ||
136 | - // if (merchant._uuid == item.merchant_uuid) { | ||
137 | - // // itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache()) | ||
138 | - // self.postImageURL = merchant._img_preview | ||
139 | - // titleLabel.text = merchant._admin_name | ||
140 | - // break; | ||
141 | - // } | ||
142 | - // } | ||
143 | - | ||
144 | - let merchantDetails: swiftApi.MerchantModel? = item.merchant_details | ||
145 | - self.postImageURL = merchantDetails?._img_preview | ||
146 | - titleLabel.text = merchantDetails?._admin_name | ||
147 | - | ||
148 | - dateLabel.text = item.redeemed ?? "" // expiration | ||
149 | -// itemImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache()) | ||
150 | -// titleLabel.text = couponSetData?.name ?? "" | ||
151 | - | ||
152 | - let priceFloat = Float(round(100 * (Float(couponSetData?.final_price ?? 0.0) )) / 100) | ||
153 | - var priceString = "0" | ||
154 | - priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil) | ||
155 | - priceLabel.text = priceString + "€" | ||
156 | - | ||
157 | - subtitleLabel.text = "Έκπτωτικό κουπόνι" | ||
158 | -// subtitleLabel.text = couponSetData?.short_description ?? "" | ||
159 | - // OR | ||
160 | -// let htmlText = couponSetData?.inner_text ?? "" | ||
161 | -// subtitleLabel.text = htmlText.htmlToString | ||
162 | - | ||
163 | - } | ||
164 | - | ||
165 | - func configureCell(item: swiftApi.CouponItemModel, isMarket: Bool) { | ||
166 | - | ||
167 | -// COUPONSET: desc, img_preview, name, terms, merchant_uuid | ||
168 | -// COUPON: coupon, expiration, discount, status | ||
169 | -// MERCHANT: _img_preview,_admin_name | ||
170 | - | ||
171 | - let merchantList:Array<swiftApi.MerchantModel> = swiftApi().getMerchantList() | ||
172 | -// let couponSetData: swiftApi.CouponSetItemModel? = item.couponset_data | ||
173 | - | ||
174 | - titleLabel.text = "" | ||
175 | - | ||
176 | - // for merchant in merchantList { | ||
177 | - // if (merchant._uuid == item.merchant_uuid) { | ||
178 | - // // itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache()) | ||
179 | - // self.postImageURL = merchant._img_preview | ||
180 | - // titleLabel.text = merchant._admin_name | ||
181 | - // break; | ||
182 | - // } | ||
183 | - // } | ||
184 | - | ||
185 | - let merchantDetails: swiftApi.MerchantModel? = item.merchant_details | ||
186 | - self.postImageURL = merchantDetails?._img_preview | ||
187 | - titleLabel.text = merchantDetails?._admin_name | ||
188 | - | ||
189 | -// titleLabel.text = item.name | ||
190 | -// self.postImageURL = item.image | ||
191 | - | ||
192 | - dateLabel.text = item.redeemed ?? "" | ||
193 | - | ||
194 | - let priceFloat = Float(round(100 * (Float(item.discount ?? "0.0") ?? 0.0 )) / 100) | ||
195 | - var priceString = "0" | ||
196 | - priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil) | ||
197 | - priceLabel.text = priceString + "€" | ||
198 | - | ||
199 | - subtitleLabel.text = "Έκπτωτικό κουπόνι" | ||
200 | -// subtitleLabel.text = couponSetData?.short_description ?? "" | ||
201 | - // OR | ||
202 | -// let htmlText = couponSetData?.inner_text ?? "" | ||
203 | -// subtitleLabel.text = htmlText.htmlToString | ||
204 | - | ||
205 | - } | ||
206 | -} |
1 | -// | ||
2 | -// AnalysisMoreViewCell.swift | ||
3 | -// SwiftWarplyFramework | ||
4 | -// | ||
5 | -// Created by Manos Chorianopoulos on 21/9/22. | ||
6 | -// | ||
7 | - | ||
8 | -import UIKit | ||
9 | - | ||
10 | -@objc public class AnalysisMoreViewCell: UITableViewCell { | ||
11 | - @IBOutlet weak var titleLabel: UILabel! | ||
12 | - @IBOutlet weak var arrowImage: UIImageView! | ||
13 | - | ||
14 | - // lifecycle | ||
15 | - public override func awakeFromNib() { | ||
16 | - super.awakeFromNib() | ||
17 | - | ||
18 | - // title | ||
19 | - titleLabel.font = UIFont(name: "PeridotPE-Bold", size: 15) | ||
20 | - titleLabel.textColor = UIColor(rgb: 0x212121) | ||
21 | - titleLabel.text = "Δες Περισσότερα" | ||
22 | - | ||
23 | - arrowImage.image = UIImage(named: "ic_down_dark_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
24 | - } | ||
25 | -} |
1 | -// | ||
2 | -// CSMButton.swift | ||
3 | -// SwiftWarplyFramework | ||
4 | -// | ||
5 | -// Created by Manos Chorianopoulos on 20/9/22. | ||
6 | -// | ||
7 | - | ||
8 | -import UIKit | ||
9 | - | ||
10 | -// @IBDesignable | ||
11 | -@objc public class CSMButton: UIButton { | ||
12 | - required init?(coder aDecoder: NSCoder) { | ||
13 | - super.init(coder: aDecoder) | ||
14 | - configure() | ||
15 | - } | ||
16 | - override init(frame: CGRect = .zero) { | ||
17 | - super.init(frame: frame) | ||
18 | - configure() | ||
19 | - } | ||
20 | - | ||
21 | - public override func prepareForInterfaceBuilder() { | ||
22 | - super.prepareForInterfaceBuilder() | ||
23 | - configure() | ||
24 | - } | ||
25 | -} | ||
26 | - | ||
27 | -private extension CSMButton { | ||
28 | - func configure() { | ||
29 | - setImage(UIImage(named: "ic_directions", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal) | ||
30 | - titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 18) | ||
31 | - setTitleColor(.white, for: .normal) | ||
32 | -// backgroundColor = UIColor(rgb: 0x79BF14) | ||
33 | - backgroundColor = UIColor(red: 0.05, green: 0.65, blue: 0.00, alpha: 1.00) | ||
34 | - layer.cornerRadius = 12.0 | ||
35 | - | ||
36 | - imageEdgeInsets = UIEdgeInsets(top:0.0, left:0.0, bottom:0.0, right:5.0); | ||
37 | - titleEdgeInsets = UIEdgeInsets(top:0.0, left:5.0, bottom:0.0, right:0.0); | ||
38 | - } | ||
39 | -} |
1 | -// | ||
2 | -// CampaignCategory.swift | ||
3 | -// SwiftWarplyFramework | ||
4 | -// | ||
5 | -// Created by Manos Chorianopoulos on 11/10/22. | ||
6 | -// | ||
7 | - | ||
8 | -import Foundation | ||
9 | - | ||
10 | -public class CampaignCategory: Codable { | ||
11 | - | ||
12 | - // attributes | ||
13 | - public var name: String? | ||
14 | - public var index: Int | ||
15 | - public var items: Array<swiftApi.CampaignItemModel> | ||
16 | - | ||
17 | - // initialization | ||
18 | - public init(_ name: String) { | ||
19 | - self.name = name == "ΑΛΛΕΣ" ? name : String(name.dropFirst()) | ||
20 | - self.index = Int(name.prefix(1)) ?? 0 | ||
21 | - self.items = [swiftApi.CampaignItemModel]() | ||
22 | - } | ||
23 | - | ||
24 | - public init(_ name: String, index: Int) { | ||
25 | - self.name = name == "ΑΛΛΕΣ" ? name : String(name.dropFirst()) | ||
26 | - self.index = index | ||
27 | - self.items = [swiftApi.CampaignItemModel]() | ||
28 | - } | ||
29 | -} | ||
30 | - | ||
31 | -enum CampaignCategoryFactory { | ||
32 | - static func create(withTitle title: String) -> CampaignCategory { | ||
33 | - | ||
34 | - var index = 100 | ||
35 | - let indexChr:Character = title[title.index(title.startIndex, offsetBy: 1)] | ||
36 | - if indexChr.isNumber { | ||
37 | - index = indexChr.wholeNumberValue! | ||
38 | - } | ||
39 | - | ||
40 | - return CampaignCategory(title, index: index) | ||
41 | - } | ||
42 | -} | ||
43 | - |
1 | -// | ||
2 | -// CopyableLabel.swift | ||
3 | -// SwiftWarplyFramework | ||
4 | -// | ||
5 | -// Created by Manos Chorianopoulos on 26/10/22. | ||
6 | -// | ||
7 | - | ||
8 | -import Foundation | ||
9 | -import UIKit | ||
10 | - | ||
11 | -class CopyableLabel: UILabel { | ||
12 | - | ||
13 | - override init(frame: CGRect) { | ||
14 | - super.init(frame: frame) | ||
15 | - sharedInit() | ||
16 | - } | ||
17 | - | ||
18 | - required init(coder aDecoder: NSCoder) { | ||
19 | - super.init(coder: aDecoder)! | ||
20 | - sharedInit() | ||
21 | - } | ||
22 | - | ||
23 | - func sharedInit() { | ||
24 | - isUserInteractionEnabled = true | ||
25 | - addGestureRecognizer(UILongPressGestureRecognizer(target: self, action: #selector(showMenu(sender:)))) | ||
26 | - } | ||
27 | - | ||
28 | - @objc | ||
29 | - func showMenu(sender: AnyObject?) { | ||
30 | - becomeFirstResponder() | ||
31 | - let menu = UIMenuController.shared | ||
32 | - if !menu.isMenuVisible { | ||
33 | - menu.setTargetRect(bounds, in: self) | ||
34 | - menu.setMenuVisible(true, animated: true) | ||
35 | - } | ||
36 | - } | ||
37 | - | ||
38 | - override var canBecomeFirstResponder: Bool { | ||
39 | - return true | ||
40 | - } | ||
41 | - | ||
42 | - override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool { | ||
43 | - if action == #selector(UIResponderStandardEditActions.copy(_:)) { | ||
44 | - return true | ||
45 | - } | ||
46 | - return false | ||
47 | - } | ||
48 | - | ||
49 | - override func copy(_ sender: Any?) { | ||
50 | - let board = UIPasteboard.general | ||
51 | - if var textToCopy = text { | ||
52 | - if (textToCopy.contains(", ")) { | ||
53 | - textToCopy = textToCopy.replacingOccurrences(of: ", ", with: "") | ||
54 | - } | ||
55 | - print(textToCopy) | ||
56 | - board.string = textToCopy | ||
57 | - } | ||
58 | - | ||
59 | -// board.string = text | ||
60 | - let menu = UIMenuController.shared | ||
61 | - menu.setMenuVisible(false, animated: true) | ||
62 | - } | ||
63 | - | ||
64 | -} |
1 | -// | ||
2 | -// CouponsViewController.swift | ||
3 | -// WarplySDKFrameworkIOS | ||
4 | -// | ||
5 | -// Created by Βασιλης Σκουρας on 4/5/22. | ||
6 | -// | ||
7 | - | ||
8 | -import Foundation | ||
9 | -import UIKit | ||
10 | -import SwiftEventBus | ||
11 | - | ||
12 | -@objc public class CouponsViewController: UIViewController { | ||
13 | - @IBOutlet weak var backgroundImage: UIImageView! | ||
14 | - @IBOutlet weak var tableView: UITableView! | ||
15 | - @IBOutlet weak var emptyView: UIView! | ||
16 | - @IBOutlet weak var emptyViewHeight: NSLayoutConstraint! | ||
17 | - @IBOutlet weak var emptyLabel: UILabel! | ||
18 | - | ||
19 | - public var coupons:Array<swiftApi.CouponItemModel> = [] | ||
20 | - | ||
21 | - public override func viewDidLoad() { | ||
22 | - super.viewDidLoad() | ||
23 | - | ||
24 | - self.hidesBottomBarWhenPushed = true | ||
25 | - | ||
26 | - SwiftEventBus.onBackgroundThread(self, name: "coupons_fetched") { result in | ||
27 | - | ||
28 | - DispatchQueue.main.async { | ||
29 | - self.coupons = swiftApi().getCouponList() | ||
30 | - self.tableView.reloadData() | ||
31 | - | ||
32 | - self.handleEmptyView() | ||
33 | - } | ||
34 | - } | ||
35 | - | ||
36 | - getCouponsRequest() | ||
37 | - | ||
38 | - setBackButton() | ||
39 | -// setNavigationTitle("GIFTS FOR YOU") | ||
40 | - setNavigationTitle("FREE COUPONS") | ||
41 | - | ||
42 | -// backgroundImage.image = UIImage(named: "coupons_scrollview_dark", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
43 | - | ||
44 | - tableView.delegate = self | ||
45 | - tableView.dataSource = self | ||
46 | - | ||
47 | -// tableView.clipsToBounds = true | ||
48 | -// tableView.layer.cornerRadius = 30 | ||
49 | -// tableView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius | ||
50 | - tableView.contentInset.top = 30 | ||
51 | - | ||
52 | - emptyLabel.text = "Αυτήν τη στιγμή δεν έχεις κάποιο ενεργό κουπόνι. Στην ενότητα FOR YOU μπορείς να βρεις κουπόνια αποκλειστικά για σένα!" | ||
53 | - } | ||
54 | - | ||
55 | - public override func viewWillAppear(_ animated: Bool) { | ||
56 | - super.viewWillAppear(animated) | ||
57 | - | ||
58 | - swiftApi().logTrackersEvent("screen", "ActiveCouponsScreen") | ||
59 | - | ||
60 | - self.coupons = swiftApi().getCouponList() | ||
61 | - self.tableView.reloadData() | ||
62 | - | ||
63 | - self.handleEmptyView() | ||
64 | - | ||
65 | - self.navigationController?.hideHairline() | ||
66 | - } | ||
67 | - | ||
68 | - // MARK: - Functions | ||
69 | - func handleEmptyView() { | ||
70 | - if (self.coupons.count == 0) { | ||
71 | - self.emptyView.isHidden = false | ||
72 | - self.emptyViewHeight.constant = self.emptyView.intrinsicContentSize.height | ||
73 | - } else { | ||
74 | - self.emptyView.isHidden = true | ||
75 | - self.emptyViewHeight.constant = 0 | ||
76 | - } | ||
77 | - } | ||
78 | - | ||
79 | - // MARK: - API Functions | ||
80 | - func getCouponsRequest() { | ||
81 | - swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in | ||
82 | - self.coupons = [] | ||
83 | - }) | ||
84 | - } | ||
85 | - | ||
86 | - func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { | ||
87 | - if (couponsData != nil) { | ||
88 | - let activeCouponData = swiftApi().filterActiveCoupons(couponsData ?? []) | ||
89 | - | ||
90 | - self.coupons = activeCouponData | ||
91 | - | ||
92 | - DispatchQueue.main.async { | ||
93 | - SwiftEventBus.post("coupons_fetched") | ||
94 | - // self.tableView.reloadData() | ||
95 | - | ||
96 | - // self.handleEmptyView() | ||
97 | - } | ||
98 | - } else { | ||
99 | - self.coupons = [] | ||
100 | - } | ||
101 | - } | ||
102 | - | ||
103 | -} | ||
104 | - | ||
105 | -// MARK: - TableView | ||
106 | -extension CouponsViewController: UITableViewDelegate, UITableViewDataSource{ | ||
107 | - | ||
108 | - public func numberOfSections(in tableView: UITableView) -> Int { | ||
109 | - return 1 | ||
110 | - } | ||
111 | - | ||
112 | - public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
113 | - return self.coupons.count | ||
114 | - } | ||
115 | - | ||
116 | - public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
117 | - return 130.0 + 8.0 | ||
118 | -// return UITableViewAutomaticDimension | ||
119 | - } | ||
120 | - | ||
121 | - public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
122 | - let cell = tableView.dequeueReusableCell(withIdentifier: "CouponsTableViewCellId", for: indexPath) as! CouponsTableViewCell | ||
123 | - | ||
124 | - cell.configureCell(coupon: coupons[indexPath.row]) | ||
125 | - | ||
126 | - return cell | ||
127 | - } | ||
128 | - | ||
129 | - public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
130 | - | ||
131 | - // SwiftEventBus.post("couponBarcodePressed", sender: coupons[indexPath.row]) | ||
132 | - | ||
133 | - // Logs | ||
134 | - let couponSetData: swiftApi.CouponSetItemModel? = coupons[indexPath.row].couponset_data | ||
135 | - print("Coupon clicked: " + (coupons[indexPath.row].coupon ?? "")) | ||
136 | - print("Coupon Name clicked: " + (couponSetData?.name ?? "")) | ||
137 | - print("Coupon Description clicked: " + (couponSetData?.short_description ?? "")) | ||
138 | - print("Coupon Expiration clicked: " + (coupons[indexPath.row].expiration ?? "")) | ||
139 | - | ||
140 | - swiftApi().logTrackersEvent("click", ("Coupon:" + (couponSetData?.name ?? ""))) | ||
141 | - | ||
142 | - let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | ||
143 | - let vc = storyboard.instantiateViewController(withIdentifier: "CouponBarcodeViewController") as! SwiftWarplyFramework.CouponBarcodeViewController | ||
144 | - vc.coupon = coupons[indexPath.row] | ||
145 | - self.navigationController?.pushViewController(vc, animated: true) | ||
146 | - } | ||
147 | - | ||
148 | -} |
1 | -// | ||
2 | -// DetailsViewController.swift | ||
3 | -// WarplySDKFrameworkIOS | ||
4 | -// | ||
5 | -// Created by Βασιλης Σκουρας on 5/5/22. | ||
6 | -// | ||
7 | - | ||
8 | -import Foundation | ||
9 | -import UIKit | ||
10 | - | ||
11 | -@objc public class DetailsViewController: UIViewController { | ||
12 | - public override func viewWillAppear(_ animated: Bool) { | ||
13 | - super.viewWillAppear(animated) | ||
14 | - | ||
15 | - self.hidesBottomBarWhenPushed = true | ||
16 | - setBackButton() | ||
17 | - setNavigationTitle("Ανάλυση") | ||
18 | - } | ||
19 | -} |
1 | -// | ||
2 | -// HistoryViewController.swift | ||
3 | -// SwiftWarplyFramework | ||
4 | -// | ||
5 | -// Created by Manos Chorianopoulos on 18/7/22. | ||
6 | -// | ||
7 | - | ||
8 | -import UIKit | ||
9 | - | ||
10 | -class HistoryViewController: AnalysisChildViewController { | ||
11 | - var loading: Bool = false | ||
12 | - var items: Array<swiftApi.CouponItemModel> = swiftApi().getOldCouponList() | ||
13 | - var showMore = false | ||
14 | - | ||
15 | - // TODO: remove this when configuring model | ||
16 | - let hasMessage = true | ||
17 | - | ||
18 | - // lifecycle | ||
19 | - override func viewDidLoad() { | ||
20 | - | ||
21 | - super.viewDidLoad() | ||
22 | - | ||
23 | - self.tableView.delegate = self | ||
24 | - self.tableView.dataSource = self | ||
25 | - | ||
26 | - // Add shadow | ||
27 | - self.tableView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.2).cgColor | ||
28 | - self.tableView.layer.shadowOffset = CGSize(width: 0.0, height: 1.0) | ||
29 | - self.tableView.layer.shadowOpacity = 1.0 | ||
30 | - self.tableView.layer.shadowRadius = 1.0 | ||
31 | - | ||
32 | - self.refreshControl = UIRefreshControl() | ||
33 | - self.refreshControl?.addTarget(self, action: #selector(handleRefresh(_:)), for: .valueChanged) | ||
34 | - | ||
35 | - handleRefresh(self.refreshControl!) | ||
36 | - } | ||
37 | - | ||
38 | - // mvp | ||
39 | - @objc func load() { | ||
40 | - | ||
41 | - if (loading) { | ||
42 | - return; | ||
43 | - } | ||
44 | - | ||
45 | - showLoading() | ||
46 | - | ||
47 | - items = swiftApi().getOldCouponList() | ||
48 | - | ||
49 | - self.showMore = (self.items.count > 3) | ||
50 | - | ||
51 | - if (self.showMore == true) { | ||
52 | - self.items = Array(self.items[0...2]) | ||
53 | - } | ||
54 | - | ||
55 | - showContent() | ||
56 | - self.tableView.reloadData() | ||
57 | - } | ||
58 | - | ||
59 | - private func showLoading() { | ||
60 | - | ||
61 | - loading = true | ||
62 | - if (self.refreshControl!.isRefreshing) { | ||
63 | - return; | ||
64 | - } | ||
65 | - | ||
66 | - self.refreshControl!.beginRefreshing() | ||
67 | - } | ||
68 | - | ||
69 | - private func showError() { | ||
70 | - } | ||
71 | - | ||
72 | - private func showContent() { | ||
73 | - | ||
74 | - loading = false | ||
75 | - self.refreshControl!.endRefreshing() | ||
76 | - } | ||
77 | - | ||
78 | - // private | ||
79 | - func responseCallback (_ data: Array<swiftApi.CouponItemModel>?) -> Void { | ||
80 | - | ||
81 | - self.items = data! | ||
82 | - self.showMore = (self.items.count > 3) | ||
83 | - | ||
84 | - if (self.showMore == true) { | ||
85 | - self.items = Array(self.items[0...2]) | ||
86 | - } | ||
87 | - showContent() | ||
88 | - DispatchQueue.main.async { | ||
89 | - self.tableView.reloadData() | ||
90 | - } | ||
91 | - } | ||
92 | - | ||
93 | - @objc func handleRefresh(_ refreshControl: UIRefreshControl) { | ||
94 | - | ||
95 | - self.perform(_: #selector(load), with: nil, afterDelay: 0.5) | ||
96 | - } | ||
97 | - | ||
98 | - // MARK: - Table view data source | ||
99 | - override func numberOfSections(in tableView: UITableView) -> Int { | ||
100 | - return 2 | ||
101 | - } | ||
102 | - | ||
103 | - override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
104 | - if (section == 0) { | ||
105 | - return 1 | ||
106 | - } | ||
107 | - | ||
108 | - if (self.showMore == true) { | ||
109 | - return 4 | ||
110 | - } | ||
111 | - return items.count | ||
112 | - } | ||
113 | - | ||
114 | - override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
115 | -// if (indexPath.section == 0) { | ||
116 | -//// return hasMessage ? (items.count > 0 ? 380.0 : 480.0) : 280 | ||
117 | -// return hasMessage ? UITableView.automaticDimension : 280 | ||
118 | -// } | ||
119 | -// | ||
120 | -//// return 140.0 | ||
121 | - return UITableView.automaticDimension | ||
122 | - } | ||
123 | - override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
124 | - | ||
125 | - // header | ||
126 | - if (indexPath.section == 0) { | ||
127 | - if (hasMessage) { | ||
128 | - let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisHeaderMessageViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisHeaderMessageViewCell | ||
129 | - cell.configureCell(isEmpty: items.count == 0, isMarket: false) | ||
130 | - return cell | ||
131 | - } | ||
132 | - | ||
133 | - return tableView.dequeueReusableCell(withIdentifier: "AnalysisHeaderViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisHeaderViewCell | ||
134 | - } | ||
135 | - | ||
136 | - if (self.showMore && indexPath.row == 3) { | ||
137 | - let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisMoreViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisMoreViewCell | ||
138 | - return cell | ||
139 | - } | ||
140 | - | ||
141 | - let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisItemViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisItemViewCell | ||
142 | - cell.configureCell(item: items[indexPath.row]) | ||
143 | - | ||
144 | - return cell | ||
145 | - } | ||
146 | - | ||
147 | - override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
148 | - if (indexPath.section == 0) { | ||
149 | - return | ||
150 | - } | ||
151 | - | ||
152 | - if (self.showMore && indexPath.row == 3) { | ||
153 | - self.items = swiftApi().getOldCouponList() | ||
154 | - self.showMore = false | ||
155 | - self.tableView.reloadData() | ||
156 | - } | ||
157 | - } | ||
158 | - | ||
159 | - override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { | ||
160 | - if (section == 0){ | ||
161 | - return nil | ||
162 | - | ||
163 | - } else if (section == 1) { | ||
164 | - if (self.items.count > 0) { | ||
165 | - let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 50)) | ||
166 | - | ||
167 | - let viewBorder = UIView(frame: CGRect(x: 10, y: 0, width: view.frame.width-20, height: view.frame.height)) | ||
168 | - viewBorder.backgroundColor = .white | ||
169 | - // viewBorder.backgroundColor = UIColor(red: 0.90, green: 0.90, blue: 0.90, alpha: 1.00) | ||
170 | - | ||
171 | - viewBorder.layer.cornerRadius = 16.5 | ||
172 | - viewBorder.layer.maskedCorners = [ .layerMinXMinYCorner, .layerMaxXMinYCorner] // Top left, bottom right corner radius | ||
173 | - | ||
174 | - let viewInner = UIView(frame: CGRect(x: 1, y: 1, width: viewBorder.frame.width-2, height: viewBorder.frame.height-1)) | ||
175 | - viewInner.backgroundColor = .white | ||
176 | - | ||
177 | - viewInner.layer.cornerRadius = 16.5 | ||
178 | - viewInner.layer.maskedCorners = [ .layerMinXMinYCorner, .layerMaxXMinYCorner] // Top left, bottom right corner radius | ||
179 | - | ||
180 | - let titleLabel = UILabel(frame: CGRect(x: 20, y: 20, width: viewInner.frame.width - 40, height: 20)) | ||
181 | - titleLabel.font = UIFont(name: "BTCosmo-Bold", size: 20) | ||
182 | - titleLabel.textColor = UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00) | ||
183 | - titleLabel.text = "Αναλυτικά" | ||
184 | - | ||
185 | - view.addSubview(viewBorder) | ||
186 | - viewBorder.addSubview(viewInner) | ||
187 | - viewInner.addSubview(titleLabel) | ||
188 | - return view | ||
189 | - } else { | ||
190 | - return nil | ||
191 | - } | ||
192 | - | ||
193 | - | ||
194 | - } else { | ||
195 | - return nil | ||
196 | - } | ||
197 | - } | ||
198 | - | ||
199 | - override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { | ||
200 | - if (section == 0) { | ||
201 | - return 0.0 | ||
202 | - | ||
203 | - } else if (section == 1) { | ||
204 | - if (self.items.count > 0) { | ||
205 | - return 50.0 | ||
206 | - } else { | ||
207 | - return 0.0 | ||
208 | - } | ||
209 | - | ||
210 | - } else { | ||
211 | - return 0.0 | ||
212 | - } | ||
213 | - } | ||
214 | - | ||
215 | - override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { | ||
216 | -// return CGFloat.leastNormalMagnitude | ||
217 | - if (section == 1 && self.items.count > 0) { | ||
218 | - return 20.0 | ||
219 | - } else { | ||
220 | - return 0.0 | ||
221 | - } | ||
222 | - } | ||
223 | - | ||
224 | - override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { | ||
225 | - if (section == 1) { | ||
226 | - if (self.items.count > 0) { | ||
227 | - let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 30)) | ||
228 | - | ||
229 | - let viewBorder = UIView(frame: CGRect(x: 10, y: 0, width: view.frame.width-20, height: view.frame.height)) | ||
230 | - viewBorder.backgroundColor = .white | ||
231 | - // viewBorder.backgroundColor = UIColor(red: 0.90, green: 0.90, blue: 0.90, alpha: 1.00) | ||
232 | - | ||
233 | - viewBorder.layer.cornerRadius = 16.5 | ||
234 | - viewBorder.layer.maskedCorners = [ .layerMinXMaxYCorner, .layerMaxXMaxYCorner] // bottom left, bottom right corner radius | ||
235 | - | ||
236 | - let viewInner = UIView(frame: CGRect(x: 1, y: 0, width: viewBorder.frame.width-2, height: viewBorder.frame.height-1)) | ||
237 | - viewInner.backgroundColor = .white | ||
238 | - | ||
239 | - viewInner.layer.cornerRadius = 16.5 | ||
240 | - viewInner.layer.maskedCorners = [ .layerMinXMaxYCorner, .layerMaxXMaxYCorner] // bottom left, bottom right corner radius | ||
241 | - | ||
242 | - view.addSubview(viewBorder) | ||
243 | - viewBorder.addSubview(viewInner) | ||
244 | - return view | ||
245 | - } else { | ||
246 | - return nil | ||
247 | - } | ||
248 | - | ||
249 | - } else { | ||
250 | - return nil | ||
251 | - } | ||
252 | - } | ||
253 | -} |
1 | -// | ||
2 | -// InboxTableViewCell.swift | ||
3 | -// SwiftWarplyFramework | ||
4 | -// | ||
5 | -// Created by Manos Chorianopoulos on 24/6/22. | ||
6 | -// | ||
7 | - | ||
8 | -import UIKit | ||
9 | - | ||
10 | -@objc public class InboxTableViewCell: UITableViewCell { | ||
11 | - @IBOutlet weak var inboxView: UIView! | ||
12 | - @IBOutlet weak var campaignImage: UIImageView! | ||
13 | - @IBOutlet weak var newBadgeImage: UIImageView! | ||
14 | - @IBOutlet weak var campaignTitleLabel: UILabel! | ||
15 | - | ||
16 | - var postImageURL: String? { | ||
17 | - didSet { | ||
18 | - if let url = postImageURL { | ||
19 | - self.campaignImage.image = UIImage() // UIImage(named: "loading") | ||
20 | - | ||
21 | - UIImage.loadImageUsingCacheWithUrlString(url) { image in | ||
22 | - // set the image only when we are still displaying the content for the image we finished downloading | ||
23 | - if url == self.postImageURL { | ||
24 | - self.campaignImage.image = image | ||
25 | - } | ||
26 | - } | ||
27 | - } | ||
28 | - else { | ||
29 | - self.campaignImage.image = nil | ||
30 | - } | ||
31 | - } | ||
32 | - } | ||
33 | - | ||
34 | - public override func awakeFromNib() { | ||
35 | - super.awakeFromNib() | ||
36 | - | ||
37 | - // Add shadow | ||
38 | - self.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.2).cgColor | ||
39 | - self.layer.shadowOffset = CGSize(width: 0.0, height: 1.0) | ||
40 | - self.layer.shadowOpacity = 1.0 | ||
41 | - self.layer.shadowRadius = 1.0 | ||
42 | - | ||
43 | - inboxView.layer.cornerRadius = 16.0 | ||
44 | - inboxView.clipsToBounds = true | ||
45 | - | ||
46 | - newBadgeImage.image = UIImage(named: "new_icon_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
47 | - | ||
48 | - newBadgeImage.isHidden = true | ||
49 | - } | ||
50 | - | ||
51 | - public override func setSelected(_ selected: Bool, animated: Bool) { | ||
52 | - super.setSelected(selected, animated: animated) | ||
53 | - | ||
54 | - // Configure the view for the selected state | ||
55 | - } | ||
56 | - | ||
57 | - public override func layoutSubviews() { | ||
58 | - super.layoutSubviews() | ||
59 | - //set the values for top,left,bottom,right margins | ||
60 | - let margins = UIEdgeInsets(top: 0, left: 0, bottom: 10, right: 0) | ||
61 | - contentView.frame = contentView.frame.inset(by: margins) | ||
62 | - } | ||
63 | - | ||
64 | - | ||
65 | - func configureCell(campaign: swiftApi.CampaignItemModel) { | ||
66 | - // campaignImage.load(link: campaign.logo_url ?? "", placeholder: UIImage(), cache: URLCache()) | ||
67 | - self.postImageURL = campaign.logo_url ?? "" | ||
68 | - | ||
69 | - campaignTitleLabel.text = campaign.title ?? "" | ||
70 | - | ||
71 | - if (campaign.is_new == true) { | ||
72 | - newBadgeImage.isHidden = false | ||
73 | - } else{ | ||
74 | - newBadgeImage.isHidden = true | ||
75 | - } | ||
76 | - } | ||
77 | - | ||
78 | - func configureCell(ccms: swiftApi.LoyaltyContextualOfferModel) { | ||
79 | - // campaignImage.load(link: ccms._imageUrl , placeholder: UIImage(), cache: URLCache()) | ||
80 | - self.postImageURL = ccms._imageUrl | ||
81 | - | ||
82 | - campaignTitleLabel.text = ccms._title | ||
83 | - | ||
84 | - newBadgeImage.isHidden = true | ||
85 | - } | ||
86 | - | ||
87 | -} |
1 | -// | ||
2 | -// LoyaltyAnalysisViewController.swift | ||
3 | -// SwiftWarplyFramework | ||
4 | -// | ||
5 | -// Created by Manos Chorianopoulos on 18/7/22. | ||
6 | -// | ||
7 | - | ||
8 | -import UIKit | ||
9 | -import SwiftEventBus | ||
10 | - | ||
11 | -@objc public class LoyaltyAnalysisViewController: UIViewController { | ||
12 | - | ||
13 | - @IBOutlet weak var leftButton: UIButton! | ||
14 | - @IBOutlet weak var rightButton: UIButton! | ||
15 | - @IBOutlet weak var leftLineView: UIView! | ||
16 | - @IBOutlet weak var rightLineView: UIView! | ||
17 | - @IBOutlet weak var contentView: UIView! | ||
18 | - var pageController: UIPageViewController! | ||
19 | - var tabSelected = 0 | ||
20 | - | ||
21 | - var timerHistory: DispatchSourceTimer? | ||
22 | - var seconds: Int = 0 | ||
23 | - | ||
24 | - public override func viewDidLoad() { | ||
25 | - super.viewDidLoad() | ||
26 | - | ||
27 | - self.hidesBottomBarWhenPushed = true | ||
28 | - | ||
29 | - // setup view | ||
30 | - setBackButton() | ||
31 | - setNavigationTitle("Ανάλυση") | ||
32 | - | ||
33 | - // tab | ||
34 | - leftButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15) | ||
35 | - leftButton.setTitle("Εξαργυρωμένα", for:.normal) | ||
36 | - leftButton.backgroundColor = . clear | ||
37 | - leftButton.setTitleColor(UIColor(rgb: 0x212121), for:.normal) | ||
38 | - | ||
39 | - rightButton.titleLabel?.font = UIFont(name: "PeridotPE-SBold", size: 15) | ||
40 | - rightButton.setTitle("Μοιρασμένα δώρα", for:.normal) | ||
41 | - rightButton.backgroundColor = . clear | ||
42 | - rightButton.setTitleColor(UIColor(rgb: 0x848484), for:.normal) | ||
43 | - | ||
44 | -// leftLineView.applyGradient(colours: [UIColor(rgb: 0x1DA6B9), UIColor(rgb: 0xB2CE69)], gradient: GradientOrientation.horizontal, cornerRadius: 0.0) | ||
45 | -// rightLineView.applyGradient(colours: [UIColor(rgb: 0x1DA6B9), UIColor(rgb: 0xB2CE69)], gradient: GradientOrientation.horizontal, cornerRadius: 0.0) | ||
46 | - | ||
47 | - leftLineView.isHidden = false | ||
48 | - rightLineView.isHidden = true | ||
49 | - | ||
50 | - // pages | ||
51 | - pageController = UIPageViewController(transitionStyle:.scroll, navigationOrientation:.horizontal) | ||
52 | - pageController.dataSource = self; | ||
53 | - pageController.delegate = self; | ||
54 | - | ||
55 | - pageController.view.frame = contentView.bounds; | ||
56 | - addChild(pageController) | ||
57 | - contentView.addSubview(pageController.view) | ||
58 | - pageController .didMove(toParent: self) | ||
59 | - | ||
60 | - let analysisVC = self.viewControllerAt(0) | ||
61 | - pageController.setViewControllers([analysisVC!], direction:.forward, animated:false) | ||
62 | - } | ||
63 | - | ||
64 | - public override func viewWillAppear(_ animated: Bool) { | ||
65 | - super.viewWillAppear(animated) | ||
66 | - | ||
67 | - swiftApi().logTrackersEvent("screen", "LoyaltyHistoryScreen") | ||
68 | - | ||
69 | - self.startTimer() | ||
70 | - | ||
71 | - self.navigationController?.hideHairline() | ||
72 | - } | ||
73 | - | ||
74 | - public override func viewWillDisappear(_ animated: Bool) { | ||
75 | - super.viewWillDisappear(animated) | ||
76 | - | ||
77 | - self.stopTimer() | ||
78 | - } | ||
79 | - | ||
80 | - // MARK: - Functions | ||
81 | - func startTimer() { | ||
82 | - print("========= GiftsCalculator Timer Started! =========") | ||
83 | - | ||
84 | - let queue = DispatchQueue(label: Bundle.main.bundleIdentifier! + ".history.timer") | ||
85 | - timerHistory = DispatchSource.makeTimerSource(queue: queue) | ||
86 | - timerHistory!.schedule(deadline: .now(), repeating: .seconds(1)) | ||
87 | - timerHistory!.setEventHandler { [weak self] in | ||
88 | - // do whatever stuff you want on the background queue here here | ||
89 | - print("========= GiftsCalculator interval! =========") | ||
90 | - | ||
91 | - DispatchQueue.main.async { | ||
92 | - // update your model objects and/or UI here | ||
93 | - self?.seconds = (self?.seconds ?? 0) + 1 | ||
94 | - | ||
95 | - } | ||
96 | - } | ||
97 | - timerHistory!.resume() | ||
98 | - } | ||
99 | - | ||
100 | - func stopTimer() { | ||
101 | - print("========= GiftsCalculator Timer Stopped! =========") | ||
102 | - timerHistory?.cancel() | ||
103 | - timerHistory = nil | ||
104 | - | ||
105 | - let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel() | ||
106 | - firebaseEvent._eventName = "time_spent_on_loyalty_sdk" | ||
107 | - firebaseEvent.setParameter = ("name", "GiftsCalculator") | ||
108 | - firebaseEvent.setParameter = ("seconds", String(seconds)) | ||
109 | - SwiftEventBus.post("firebase", sender: firebaseEvent) | ||
110 | - | ||
111 | - seconds = 0 | ||
112 | - } | ||
113 | - | ||
114 | - //////////////////////////////////////////////////////////////////////////////// | ||
115 | - private func viewControllerAt(_ index:Int) -> AnalysisChildViewController? | ||
116 | - { | ||
117 | - let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | ||
118 | - | ||
119 | - if (index == 1) { | ||
120 | - swiftApi().logTrackersEvent("click", ("LoyaltyHistoryScreen:" + "TabShared")) | ||
121 | - | ||
122 | - let analysisVC = storyboard.instantiateViewController(withIdentifier:"SharingHistoryViewController") as! SwiftWarplyFramework.SharingHistoryViewController | ||
123 | - analysisVC.index = index; | ||
124 | - | ||
125 | - return analysisVC; | ||
126 | - } | ||
127 | - | ||
128 | - swiftApi().logTrackersEvent("click", ("LoyaltyHistoryScreen:" + "TabExpired")) | ||
129 | - | ||
130 | - let analysisVC = storyboard.instantiateViewController(withIdentifier:"HistoryViewController") as! SwiftWarplyFramework.HistoryViewController | ||
131 | - analysisVC.index = index; | ||
132 | - | ||
133 | - return analysisVC; | ||
134 | - } | ||
135 | - | ||
136 | - // MARK: - Handlers | ||
137 | - @IBAction func handleLeft() { | ||
138 | - if (tabSelected != 0) { | ||
139 | - self.tabSelected = 0 | ||
140 | - | ||
141 | - UIView.animate(withDuration: 2.0, delay: 0.0) { | ||
142 | - | ||
143 | - self.leftLineView.isHidden = false | ||
144 | - self.rightLineView.isHidden = true | ||
145 | - | ||
146 | - self.leftButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15) | ||
147 | - self.rightButton.titleLabel?.font = UIFont(name: "PeridotPE-SBold", size: 15) | ||
148 | - | ||
149 | - self.leftButton.setTitleColor(UIColor(rgb: 0x212121), for:.normal) | ||
150 | - self.rightButton.setTitleColor(UIColor(rgb: 0x848484), for:.normal) | ||
151 | - } | ||
152 | - let analysisVC = self.viewControllerAt(0) | ||
153 | - pageController.setViewControllers([analysisVC!], direction:.reverse, animated:true) | ||
154 | - } | ||
155 | - } | ||
156 | - | ||
157 | - @IBAction func handleRight() { | ||
158 | - if (tabSelected != 1) { | ||
159 | - self.tabSelected = 1 | ||
160 | - | ||
161 | - UIView.animate(withDuration: 2.0, delay: 0.0) { | ||
162 | - | ||
163 | - self.leftLineView.isHidden = true | ||
164 | - self.rightLineView.isHidden = false | ||
165 | - | ||
166 | - self.leftButton.titleLabel?.font = UIFont(name: "PeridotPE-SBold", size: 15) | ||
167 | - self.rightButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15) | ||
168 | - | ||
169 | - self.rightButton.setTitleColor(UIColor(rgb: 0x212121), for:.normal) | ||
170 | - self.leftButton.setTitleColor(UIColor(rgb: 0x848484), for:.normal) | ||
171 | - } | ||
172 | - let analysisVC = self.viewControllerAt(1) | ||
173 | - pageController.setViewControllers([analysisVC!], direction:.forward, animated:true) | ||
174 | - } | ||
175 | - } | ||
176 | -} | ||
177 | - | ||
178 | -// MARK: - PageViewController | ||
179 | -extension LoyaltyAnalysisViewController: UIPageViewControllerDataSource, UIPageViewControllerDelegate { | ||
180 | - | ||
181 | - public func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -> UIViewController? { | ||
182 | - | ||
183 | - if let analysisVC = viewController as? AnalysisChildViewController { | ||
184 | - var index = analysisVC.index | ||
185 | - if (index == 0) { | ||
186 | - return nil; | ||
187 | - } | ||
188 | - | ||
189 | - index -= 1; | ||
190 | - return viewControllerAt(index); | ||
191 | - } | ||
192 | - | ||
193 | - return nil; | ||
194 | - } | ||
195 | - | ||
196 | - public func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? { | ||
197 | - | ||
198 | - if let analysisVC = viewController as? AnalysisChildViewController { | ||
199 | - var index = analysisVC.index | ||
200 | - if (index == 1) { | ||
201 | - return nil; | ||
202 | - } | ||
203 | - | ||
204 | - index += 1; | ||
205 | - return viewControllerAt(index); | ||
206 | - } | ||
207 | - | ||
208 | - return nil; | ||
209 | - } | ||
210 | - | ||
211 | - | ||
212 | - public func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) { | ||
213 | - | ||
214 | - if (!completed) { | ||
215 | - return; | ||
216 | - } | ||
217 | - | ||
218 | - if let childVCs = pageViewController.viewControllers as? [AnalysisChildViewController] { | ||
219 | - let currentIndex = childVCs[0].index | ||
220 | - if (currentIndex == 0) { | ||
221 | - self.leftButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15) | ||
222 | - self.rightButton.titleLabel?.font = UIFont(name: "PeridotPE-SBold", size: 15) | ||
223 | - self.leftButton.setTitleColor(UIColor(rgb: 0x212121), for:.normal) | ||
224 | - self.rightButton.setTitleColor(UIColor(rgb: 0x848484), for:.normal) | ||
225 | - self.tabSelected = 0 | ||
226 | - self.leftLineView.isHidden = false | ||
227 | - self.rightLineView.isHidden = true | ||
228 | - | ||
229 | - } else { | ||
230 | - self.leftButton.titleLabel?.font = UIFont(name: "PeridotPE-SBold", size: 15) | ||
231 | - self.rightButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15) | ||
232 | - self.rightButton.setTitleColor(UIColor(rgb: 0x212121), for:.normal) | ||
233 | - self.leftButton.setTitleColor(UIColor(rgb: 0x848484), for:.normal) | ||
234 | - self.tabSelected = 1 | ||
235 | - self.leftLineView.isHidden = true | ||
236 | - self.rightLineView.isHidden = false | ||
237 | - } | ||
238 | - } | ||
239 | - } | ||
240 | -} |
1 | -// | ||
2 | -// MFYInboxTableViewCell.swift | ||
3 | -// SwiftWarplyFramework | ||
4 | -// | ||
5 | -// Created by Manos Chorianopoulos on 24/6/22. | ||
6 | -// | ||
7 | - | ||
8 | -import UIKit | ||
9 | - | ||
10 | -@objc public class MFYInboxTableViewCell: UITableViewCell { | ||
11 | - @IBOutlet weak var inboxView: UIView! | ||
12 | - @IBOutlet weak var campaignImage: UIImageView! | ||
13 | - @IBOutlet weak var newBadgeImage: UIImageView! | ||
14 | - @IBOutlet weak var campaignTitleLabel: UILabel! | ||
15 | - @IBOutlet weak var curvedBgImage: UIImageView! | ||
16 | - @IBOutlet weak var subtitleLabel: UILabel! | ||
17 | - @IBOutlet weak var descriptionLabel: UILabel! | ||
18 | - | ||
19 | - var postImageURL: String? { | ||
20 | - didSet { | ||
21 | - if let url = postImageURL { | ||
22 | - self.campaignImage.image = UIImage() // UIImage(named: "loading") | ||
23 | - | ||
24 | - UIImage.loadImageUsingCacheWithUrlString(url) { image in | ||
25 | - // set the image only when we are still displaying the content for the image we finished downloading | ||
26 | - if url == self.postImageURL { | ||
27 | - self.campaignImage.image = image | ||
28 | - } | ||
29 | - } | ||
30 | - } | ||
31 | - else { | ||
32 | - self.campaignImage.image = nil | ||
33 | - } | ||
34 | - } | ||
35 | - } | ||
36 | - | ||
37 | - public override func awakeFromNib() { | ||
38 | - super.awakeFromNib() | ||
39 | - | ||
40 | -// inboxView.layer.cornerRadius = 5.0 | ||
41 | -// inboxView.clipsToBounds = true | ||
42 | - | ||
43 | - // Add shadow | ||
44 | - self.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.2).cgColor | ||
45 | - self.layer.shadowOffset = CGSize(width: 0.0, height: 1.0) | ||
46 | - self.layer.shadowOpacity = 1.0 | ||
47 | - self.layer.shadowRadius = 1.0 | ||
48 | - | ||
49 | - newBadgeImage.image = UIImage(named: "new_icon_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
50 | - curvedBgImage.image = UIImage(named: "curved_bg_white_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
51 | - | ||
52 | - newBadgeImage.isHidden = true | ||
53 | - } | ||
54 | - | ||
55 | - public override func setSelected(_ selected: Bool, animated: Bool) { | ||
56 | - super.setSelected(selected, animated: animated) | ||
57 | - | ||
58 | - // Configure the view for the selected state | ||
59 | - } | ||
60 | - | ||
61 | - public override func layoutSubviews() { | ||
62 | - super.layoutSubviews() | ||
63 | - //set the values for top,left,bottom,right margins | ||
64 | - let margins = UIEdgeInsets(top: 0, left: 0, bottom: 10, right: 0) | ||
65 | - contentView.frame = contentView.frame.inset(by: margins) | ||
66 | - | ||
67 | - // Add different corner radius - Do it here, otherwise it won't be applied to all cells | ||
68 | - inboxView.roundCorners(topLeft: 20, topRight: 45, bottomLeft: 20, bottomRight: 0) | ||
69 | - | ||
70 | -// // Delete extra borderLayers added | ||
71 | -// for layer in (inboxView.layer.sublayers ?? []) { | ||
72 | -// if(layer.name == "MFYItemBorderLayer"){ | ||
73 | -// layer.removeFromSuperlayer() | ||
74 | -// } | ||
75 | -// } | ||
76 | -// | ||
77 | -// // Add borderLayer | ||
78 | -// let borderLayer = CAShapeLayer() | ||
79 | -// borderLayer.path = (inboxView.layer.mask! as! CAShapeLayer).path! // Reuse the Bezier path | ||
80 | -// borderLayer.strokeColor = UIColor(red: 0.90, green: 0.90, blue: 0.90, alpha: 1.00).cgColor | ||
81 | -// borderLayer.fillColor = UIColor.clear.cgColor | ||
82 | -// borderLayer.lineWidth = 1 | ||
83 | -// borderLayer.frame = inboxView.bounds | ||
84 | -// borderLayer.name = "MFYItemBorderLayer" | ||
85 | -// inboxView.layer.addSublayer(borderLayer) | ||
86 | - } | ||
87 | - | ||
88 | - | ||
89 | - func configureCell(campaign: swiftApi.CampaignItemModel) { | ||
90 | - // campaignImage.load(link: campaign.logo_url ?? "", placeholder: UIImage(), cache: URLCache()) | ||
91 | - self.postImageURL = campaign.logo_url ?? "" | ||
92 | - | ||
93 | - campaignTitleLabel.text = campaign.title ?? "" | ||
94 | - campaignTitleLabel.font = UIFont(name: "BTCosmo-Bold", size: 17) | ||
95 | - subtitleLabel.text = campaign.subtitle ?? "" | ||
96 | - subtitleLabel.font = UIFont(name: "PeridotPE-Regular", size: 15) | ||
97 | - descriptionLabel.text = campaign.message ?? "" | ||
98 | - descriptionLabel.font = UIFont(name: "PeridotPE-SBold", size: 15) | ||
99 | - | ||
100 | - if (campaign.is_new == true) { | ||
101 | - newBadgeImage.isHidden = false | ||
102 | - } else{ | ||
103 | - newBadgeImage.isHidden = true | ||
104 | - } | ||
105 | - } | ||
106 | - | ||
107 | - func configureCell(ccms: swiftApi.LoyaltyContextualOfferModel) { | ||
108 | - // campaignImage.load(link: ccms._imageUrl , placeholder: UIImage(), cache: URLCache()) | ||
109 | - self.postImageURL = ccms._imageUrl | ||
110 | - | ||
111 | - campaignTitleLabel.text = ccms._title | ||
112 | - campaignTitleLabel.font = UIFont(name: "BTCosmo-Bold", size: 17) | ||
113 | - subtitleLabel.text = ccms._subtitle | ||
114 | - subtitleLabel.font = UIFont(name: "PeridotPE-Regular", size: 15) | ||
115 | - descriptionLabel.text = ccms._description | ||
116 | - descriptionLabel.font = UIFont(name: "PeridotPE-SBold", size: 15) | ||
117 | - | ||
118 | - newBadgeImage.isHidden = true | ||
119 | - } | ||
120 | - | ||
121 | -} |
1 | -// | ||
2 | -// MakeItAPresentViewController.swift | ||
3 | -// SwiftWarplyFramework | ||
4 | -// | ||
5 | -// Created by Βασιλης Σκουρας on 11/5/22. | ||
6 | -// | ||
7 | - | ||
8 | -import Foundation | ||
9 | -import UIKit | ||
10 | - | ||
11 | -@objc public class MakeItAPresentViewController: UIViewController { | ||
12 | - | ||
13 | - public override func viewWillAppear(_ animated: Bool) { | ||
14 | - super.viewWillAppear(animated) | ||
15 | - | ||
16 | - self.hidesBottomBarWhenPushed = true | ||
17 | - setBackButton() | ||
18 | - setNavigationTitle("Κάνε δώρο") | ||
19 | - } | ||
20 | - | ||
21 | - | ||
22 | -} |
1 | -// | ||
2 | -// MarketAnalysisItemViewCell.swift | ||
3 | -// SwiftWarplyFramework | ||
4 | -// | ||
5 | -// Created by Manos Chorianopoulos on 14/1/25. | ||
6 | -// | ||
7 | - | ||
8 | -import UIKit | ||
9 | - | ||
10 | -class MarketAnalysisItemViewCell: UITableViewCell { | ||
11 | - | ||
12 | - @IBOutlet weak var dateLabel: UILabel! | ||
13 | - @IBOutlet weak var itemImage: UIImageView! | ||
14 | - @IBOutlet weak var titleLabel: UILabel! | ||
15 | - @IBOutlet weak var priceLabel: UILabel! | ||
16 | - @IBOutlet weak var subtitleLabel: UILabel! | ||
17 | - @IBOutlet weak var productTitleLabel: UILabel! | ||
18 | - | ||
19 | - var postImageURL: String? { | ||
20 | - didSet { | ||
21 | - if let url = postImageURL { | ||
22 | - self.itemImage.image = UIImage() // UIImage(named: "loading") | ||
23 | - | ||
24 | - UIImage.loadImageUsingCacheWithUrlString(url) { image in | ||
25 | - // set the image only when we are still displaying the content for the image we finished downloading | ||
26 | - if url == self.postImageURL { | ||
27 | - self.itemImage.image = image | ||
28 | - } | ||
29 | - } | ||
30 | - } | ||
31 | - else { | ||
32 | - self.itemImage.image = nil | ||
33 | - } | ||
34 | - } | ||
35 | - } | ||
36 | - | ||
37 | - // lifecycle | ||
38 | - override func awakeFromNib() { | ||
39 | - super.awakeFromNib() | ||
40 | - | ||
41 | - // date | ||
42 | - dateLabel.textColor = UIColor(rgb: 0x212121) | ||
43 | - dateLabel.font = UIFont(name: "PeridotPE-Bold", size: 12.0) | ||
44 | - | ||
45 | - // title | ||
46 | - titleLabel.textColor = UIColor(rgb: 0x212121) | ||
47 | - titleLabel.font = UIFont(name: "PeridotPE-SBold", size: 17.0) | ||
48 | - | ||
49 | - // price | ||
50 | - priceLabel.textColor = UIColor(rgb: 0x212121) | ||
51 | - priceLabel.font = UIFont(name: "PeridotPE-Bold", size: 17.0) | ||
52 | - | ||
53 | - // subtitle | ||
54 | -// subtitleLabel.textColor = UIColor(rgb: 0x9D9D9C) | ||
55 | - subtitleLabel.textColor = UIColor(rgb: 0x212121) | ||
56 | - subtitleLabel.font = UIFont(name: "PeridotPE-SBold", size: 14.0) | ||
57 | - | ||
58 | - // productTitleLabel | ||
59 | - productTitleLabel.textColor = UIColor(rgb: 0x212121) | ||
60 | - productTitleLabel.font = UIFont(name: "PeridotPE-Regular", size: 14.0) | ||
61 | - } | ||
62 | -} | ||
63 | - | ||
64 | -extension MarketAnalysisItemViewCell { | ||
65 | - func configureCell(item: swiftApi.CouponItemModel) { | ||
66 | - | ||
67 | -// COUPONSET: desc, img_preview, name, terms, merchant_uuid | ||
68 | -// COUPON: coupon, expiration, discount, status | ||
69 | -// MERCHANT: _img_preview,_admin_name | ||
70 | - | ||
71 | - let merchantList:Array<swiftApi.MerchantModel> = swiftApi().getMerchantList() | ||
72 | - let couponSetData: swiftApi.CouponSetItemModel? = item.couponset_data | ||
73 | - | ||
74 | - titleLabel.text = "" | ||
75 | - | ||
76 | - // for merchant in merchantList { | ||
77 | - // // if (merchant._uuid == couponSetData?.merchant_uuid) { | ||
78 | - // if (merchant._uuid == item.merchant_uuid) { | ||
79 | - // // itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache()) | ||
80 | - // self.postImageURL = merchant._img_preview | ||
81 | - // titleLabel.text = merchant._admin_name | ||
82 | - // break; | ||
83 | - // } | ||
84 | - // } | ||
85 | - | ||
86 | - let merchantDetails: swiftApi.MerchantModel? = item.merchant_details | ||
87 | - self.postImageURL = merchantDetails?._img_preview | ||
88 | - titleLabel.text = merchantDetails?._admin_name | ||
89 | - | ||
90 | - dateLabel.text = item.redeemed ?? "" // expiration | ||
91 | -// itemImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache()) | ||
92 | -// titleLabel.text = couponSetData?.name ?? "" | ||
93 | - | ||
94 | - let priceFloat = Float(round(100 * (Float(couponSetData?.final_price ?? 0.0) )) / 100) | ||
95 | - var priceString = "0" | ||
96 | - priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil) | ||
97 | - priceLabel.text = priceString + "€" | ||
98 | - | ||
99 | -// subtitleLabel.text = "Έκπτωτικό κουπόνι" | ||
100 | - subtitleLabel.text = item.redeemed_merchant_details?._name ?? "" | ||
101 | -// subtitleLabel.text = couponSetData?.short_description ?? "" | ||
102 | - // OR | ||
103 | -// let htmlText = couponSetData?.inner_text ?? "" | ||
104 | -// subtitleLabel.text = htmlText.htmlToString | ||
105 | - | ||
106 | - let htmlText = couponSetData?.inner_text ?? "" | ||
107 | - productTitleLabel.text = htmlText.htmlToString | ||
108 | - | ||
109 | - } | ||
110 | - | ||
111 | - func configureCell(item: swiftApi.CouponItemModel, isMarket: Bool) { | ||
112 | - | ||
113 | -// COUPONSET: desc, img_preview, name, terms, merchant_uuid | ||
114 | -// COUPON: coupon, expiration, discount, status | ||
115 | -// MERCHANT: _img_preview,_admin_name | ||
116 | - | ||
117 | - let merchantList:Array<swiftApi.MerchantModel> = swiftApi().getMerchantList() | ||
118 | -// let couponSetData: swiftApi.CouponSetItemModel? = item.couponset_data | ||
119 | - | ||
120 | - titleLabel.text = "" | ||
121 | - | ||
122 | - // for merchant in merchantList { | ||
123 | - // if (merchant._uuid == item.merchant_uuid) { | ||
124 | - // // itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache()) | ||
125 | - // self.postImageURL = merchant._img_preview | ||
126 | - // titleLabel.text = merchant._admin_name | ||
127 | - // break; | ||
128 | - // } | ||
129 | - // } | ||
130 | - | ||
131 | - let merchantDetails: swiftApi.MerchantModel? = item.merchant_details | ||
132 | - self.postImageURL = merchantDetails?._img_preview | ||
133 | - titleLabel.text = merchantDetails?._admin_name | ||
134 | - | ||
135 | -// titleLabel.text = item.name | ||
136 | -// self.postImageURL = item.image | ||
137 | - | ||
138 | - dateLabel.text = item.redeemed ?? "" | ||
139 | - | ||
140 | - let priceFloat = Float(round(100 * (Float(item.discount ?? "0.0") ?? 0.0 )) / 100) | ||
141 | - var priceString = "0" | ||
142 | - priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil) | ||
143 | - priceLabel.text = priceString + "€" | ||
144 | - | ||
145 | -// subtitleLabel.text = "Έκπτωτικό κουπόνι" | ||
146 | - subtitleLabel.text = item.redeemed_merchant_details?._name ?? "" | ||
147 | -// subtitleLabel.text = couponSetData?.short_description ?? "" | ||
148 | - // OR | ||
149 | -// let htmlText = couponSetData?.inner_text ?? "" | ||
150 | -// subtitleLabel.text = htmlText.htmlToString | ||
151 | - | ||
152 | - } | ||
153 | -} | ||
154 | - |
1 | -// | ||
2 | -// MarketHistoryViewController.swift | ||
3 | -// SwiftWarplyFramework | ||
4 | -// | ||
5 | -// Created by Manos Chorianopoulos on 5/4/23. | ||
6 | -// | ||
7 | - | ||
8 | -import UIKit | ||
9 | - | ||
10 | -class MarketHistoryViewController: AnalysisChildViewController { | ||
11 | - var loading: Bool = false | ||
12 | - var items: Array<swiftApi.CouponItemModel> = swiftApi().getOldUnifiedCouponList() | ||
13 | - var showMore = false | ||
14 | - | ||
15 | - // TODO: remove this when configuring model | ||
16 | - let hasMessage = true | ||
17 | - | ||
18 | - // lifecycle | ||
19 | - override func viewDidLoad() { | ||
20 | - | ||
21 | - super.viewDidLoad() | ||
22 | - | ||
23 | - self.tableView.delegate = self | ||
24 | - self.tableView.dataSource = self | ||
25 | - | ||
26 | - // Add shadow | ||
27 | - self.tableView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.2).cgColor | ||
28 | - self.tableView.layer.shadowOffset = CGSize(width: 0.0, height: 1.0) | ||
29 | - self.tableView.layer.shadowOpacity = 1.0 | ||
30 | - self.tableView.layer.shadowRadius = 1.0 | ||
31 | - | ||
32 | - self.refreshControl = UIRefreshControl() | ||
33 | - self.refreshControl?.addTarget(self, action: #selector(handleRefresh(_:)), for: .valueChanged) | ||
34 | - | ||
35 | - handleRefresh(self.refreshControl!) | ||
36 | - } | ||
37 | - | ||
38 | - // mvp | ||
39 | - @objc func load() { | ||
40 | - | ||
41 | - if (loading) { | ||
42 | - return; | ||
43 | - } | ||
44 | - | ||
45 | - showLoading() | ||
46 | - | ||
47 | -// items = swiftApi().getOldUnifiedCouponList() | ||
48 | - items = swiftApi().getOldUnifiedCouponList() | ||
49 | - | ||
50 | - self.showMore = (self.items.count > 3) | ||
51 | - | ||
52 | - if (self.showMore == true) { | ||
53 | - self.items = Array(self.items[0...2]) | ||
54 | - } | ||
55 | - | ||
56 | - showContent() | ||
57 | - self.tableView.reloadData() | ||
58 | - } | ||
59 | - | ||
60 | - private func showLoading() { | ||
61 | - | ||
62 | - loading = true | ||
63 | - if (self.refreshControl!.isRefreshing) { | ||
64 | - return; | ||
65 | - } | ||
66 | - | ||
67 | - self.refreshControl!.beginRefreshing() | ||
68 | - } | ||
69 | - | ||
70 | - private func showError() { | ||
71 | - } | ||
72 | - | ||
73 | - private func showContent() { | ||
74 | - | ||
75 | - loading = false | ||
76 | - self.refreshControl!.endRefreshing() | ||
77 | - } | ||
78 | - | ||
79 | - // private | ||
80 | - func responseCallback (_ data: Array<swiftApi.CouponItemModel>?) -> Void { | ||
81 | - | ||
82 | - self.items = data! | ||
83 | - self.showMore = (self.items.count > 3) | ||
84 | - | ||
85 | - if (self.showMore == true) { | ||
86 | - self.items = Array(self.items[0...2]) | ||
87 | - } | ||
88 | - showContent() | ||
89 | - DispatchQueue.main.async { | ||
90 | - self.tableView.reloadData() | ||
91 | - } | ||
92 | - } | ||
93 | - | ||
94 | - @objc func handleRefresh(_ refreshControl: UIRefreshControl) { | ||
95 | - | ||
96 | - self.perform(_: #selector(load), with: nil, afterDelay: 0.5) | ||
97 | - } | ||
98 | - | ||
99 | - // MARK: - Table view data source | ||
100 | - override func numberOfSections(in tableView: UITableView) -> Int { | ||
101 | - return 2 | ||
102 | - } | ||
103 | - | ||
104 | - override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
105 | - if (section == 0) { | ||
106 | - return 1 | ||
107 | - } | ||
108 | - | ||
109 | - if (self.showMore == true) { | ||
110 | - return 4 | ||
111 | - } | ||
112 | - return items.count | ||
113 | - } | ||
114 | - | ||
115 | - override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
116 | -// if (indexPath.section == 0) { | ||
117 | -// return hasMessage ? (items.count > 0 ? 380.0 : 480.0) : 280 | ||
118 | -// } | ||
119 | -// | ||
120 | -// return 140.0 | ||
121 | - return UITableView.automaticDimension | ||
122 | - } | ||
123 | - | ||
124 | - override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
125 | - | ||
126 | - // header | ||
127 | - if (indexPath.section == 0) { | ||
128 | - if (hasMessage) { | ||
129 | - let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisHeaderMessageViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisHeaderMessageViewCell | ||
130 | - cell.configureCell(isEmpty: items.count == 0, isMarket: true) | ||
131 | - return cell | ||
132 | - } | ||
133 | - | ||
134 | - return tableView.dequeueReusableCell(withIdentifier: "AnalysisHeaderViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisHeaderViewCell | ||
135 | - } | ||
136 | - | ||
137 | - if (self.showMore && indexPath.row == 3) { | ||
138 | - let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisMoreViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisMoreViewCell | ||
139 | - return cell | ||
140 | - } | ||
141 | - | ||
142 | - let cell = tableView.dequeueReusableCell(withIdentifier: "MarketAnalysisItemViewCell", for: indexPath) as! SwiftWarplyFramework.MarketAnalysisItemViewCell | ||
143 | -// cell.configureCell(item: items[indexPath.row], isMarket: true) | ||
144 | - cell.configureCell(item: items[indexPath.row]) | ||
145 | - | ||
146 | - return cell | ||
147 | - } | ||
148 | - | ||
149 | - override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
150 | - if (indexPath.section == 0) { | ||
151 | - return | ||
152 | - } | ||
153 | - | ||
154 | - if (self.showMore && indexPath.row == 3) { | ||
155 | - self.items = swiftApi().getOldUnifiedCouponList() | ||
156 | - self.showMore = false | ||
157 | - self.tableView.reloadData() | ||
158 | - } | ||
159 | - } | ||
160 | - | ||
161 | - override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { | ||
162 | - if (section == 0){ | ||
163 | - return nil | ||
164 | - | ||
165 | - } else if (section == 1) { | ||
166 | - if (self.items.count > 0) { | ||
167 | - let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 50)) | ||
168 | - | ||
169 | - let viewBorder = UIView(frame: CGRect(x: 10, y: 0, width: view.frame.width-20, height: view.frame.height)) | ||
170 | - viewBorder.backgroundColor = .white | ||
171 | - // viewBorder.backgroundColor = UIColor(red: 0.90, green: 0.90, blue: 0.90, alpha: 1.00) | ||
172 | - | ||
173 | - viewBorder.layer.cornerRadius = 16.5 | ||
174 | - viewBorder.layer.maskedCorners = [ .layerMinXMinYCorner, .layerMaxXMinYCorner] // Top left, bottom right corner radius | ||
175 | - | ||
176 | - let viewInner = UIView(frame: CGRect(x: 1, y: 1, width: viewBorder.frame.width-2, height: viewBorder.frame.height-1)) | ||
177 | - viewInner.backgroundColor = .white | ||
178 | - | ||
179 | - viewInner.layer.cornerRadius = 16.5 | ||
180 | - viewInner.layer.maskedCorners = [ .layerMinXMinYCorner, .layerMaxXMinYCorner] // Top left, bottom right corner radius | ||
181 | - | ||
182 | - let titleLabel = UILabel(frame: CGRect(x: 20, y: 20, width: viewInner.frame.width - 40, height: 20)) | ||
183 | - titleLabel.font = UIFont(name: "BTCosmo-Bold", size: 20) | ||
184 | - titleLabel.textColor = UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00) | ||
185 | - titleLabel.text = "Αναλυτικά" | ||
186 | - | ||
187 | - view.addSubview(viewBorder) | ||
188 | - viewBorder.addSubview(viewInner) | ||
189 | - viewInner.addSubview(titleLabel) | ||
190 | - return view | ||
191 | - } else { | ||
192 | - return nil | ||
193 | - } | ||
194 | - | ||
195 | - | ||
196 | - } else { | ||
197 | - return nil | ||
198 | - } | ||
199 | - } | ||
200 | - | ||
201 | - override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { | ||
202 | - if (section == 0) { | ||
203 | - return 0.0 | ||
204 | - | ||
205 | - } else if (section == 1) { | ||
206 | - if (self.items.count > 0) { | ||
207 | - return 50.0 | ||
208 | - } else { | ||
209 | - return 0.0 | ||
210 | - } | ||
211 | - | ||
212 | - } else { | ||
213 | - return 0.0 | ||
214 | - } | ||
215 | - } | ||
216 | - | ||
217 | - override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { | ||
218 | -// return CGFloat.leastNormalMagnitude | ||
219 | - if (section == 1 && self.items.count > 0) { | ||
220 | - return 20.0 | ||
221 | - } else { | ||
222 | - return 0.0 | ||
223 | - } | ||
224 | - } | ||
225 | - | ||
226 | - override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { | ||
227 | - if (section == 1) { | ||
228 | - if (self.items.count > 0) { | ||
229 | - let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 30)) | ||
230 | - | ||
231 | - let viewBorder = UIView(frame: CGRect(x: 10, y: 0, width: view.frame.width-20, height: view.frame.height)) | ||
232 | - viewBorder.backgroundColor = .white | ||
233 | - // viewBorder.backgroundColor = UIColor(red: 0.90, green: 0.90, blue: 0.90, alpha: 1.00) | ||
234 | - | ||
235 | - viewBorder.layer.cornerRadius = 16.5 | ||
236 | - viewBorder.layer.maskedCorners = [ .layerMinXMaxYCorner, .layerMaxXMaxYCorner] // bottom left, bottom right corner radius | ||
237 | - | ||
238 | - let viewInner = UIView(frame: CGRect(x: 1, y: 0, width: viewBorder.frame.width-2, height: viewBorder.frame.height-1)) | ||
239 | - viewInner.backgroundColor = .white | ||
240 | - | ||
241 | - viewInner.layer.cornerRadius = 16.5 | ||
242 | - viewInner.layer.maskedCorners = [ .layerMinXMaxYCorner, .layerMaxXMaxYCorner] // bottom left, bottom right corner radius | ||
243 | - | ||
244 | - view.addSubview(viewBorder) | ||
245 | - viewBorder.addSubview(viewInner) | ||
246 | - return view | ||
247 | - } else { | ||
248 | - return nil | ||
249 | - } | ||
250 | - | ||
251 | - } else { | ||
252 | - return nil | ||
253 | - } | ||
254 | - } | ||
255 | -} |
1 | -// | ||
2 | -// MarketPassInfoViewController.swift | ||
3 | -// SwiftWarplyFramework | ||
4 | -// | ||
5 | -// Created by Manos Chorianopoulos on 14/1/25. | ||
6 | -// | ||
7 | - | ||
8 | -import UIKit | ||
9 | - | ||
10 | -@objc public class MarketPassInfoViewController: UIViewController { | ||
11 | - @IBOutlet weak var heroImage: UIImageView! | ||
12 | - @IBOutlet weak var heroTitleLabel: UILabel! | ||
13 | - @IBOutlet weak var storeInfoImage: UIImageView! | ||
14 | - @IBOutlet weak var storeInfoTitleLabel: UILabel! | ||
15 | - @IBOutlet weak var storeInfoSubtitleLabel: UILabel! | ||
16 | - @IBOutlet weak var eshopInfoImage: UIImageView! | ||
17 | - @IBOutlet weak var eshopInfoTitleLabel: UILabel! | ||
18 | - @IBOutlet weak var eshopInfoSubtitleLabel: UILabel! | ||
19 | - @IBOutlet weak var abInfoImage: UIImageView! | ||
20 | - @IBOutlet weak var abInfoTitleLabel: UILabel! | ||
21 | - @IBOutlet weak var abInfoSubtitleLabel: UILabel! | ||
22 | - @IBOutlet weak var okButton: UIButton! | ||
23 | - | ||
24 | - public override func viewDidLoad() { | ||
25 | - super.viewDidLoad() | ||
26 | - | ||
27 | - self.hidesBottomBarWhenPushed = true | ||
28 | - | ||
29 | - setBackButton() | ||
30 | - setNavigationTitle("Οδηγίες χρήσης") | ||
31 | - | ||
32 | - setupUI() | ||
33 | - } | ||
34 | - | ||
35 | - public override func viewWillAppear(_ animated: Bool) { | ||
36 | - super.viewWillAppear(animated) | ||
37 | - | ||
38 | - swiftApi().logTrackersEvent("screen", "MarketPassInfoScreen") | ||
39 | - | ||
40 | - self.navigationController?.hideHairline() | ||
41 | - } | ||
42 | - | ||
43 | - // MARK: - Functions | ||
44 | - func setupUI() { | ||
45 | - heroImage.image = UIImage(named: "pass_info_hero", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
46 | - storeInfoImage.image = UIImage(named: "pass_info_cart", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
47 | - eshopInfoImage.image = UIImage(named: "pass_info_globe", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
48 | - abInfoImage.image = UIImage(named: "pass_info_ab", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
49 | - | ||
50 | - heroTitleLabel.text = "Πως λειτουργεί:" | ||
51 | - heroTitleLabel.font = UIFont(name: "BTCosmo-Bold", size: 24) | ||
52 | - heroTitleLabel.textColor = UIColor(rgb: 0x212121) | ||
53 | - | ||
54 | - // StoreInfoView | ||
55 | - storeInfoTitleLabel.text = "Εξαργύρωση σε φυσικά καταστήματα" | ||
56 | - storeInfoTitleLabel.font = UIFont(name: "PeridotPE-Bold", size: 19.0) | ||
57 | - storeInfoTitleLabel.textColor = UIColor(rgb: 0x212121) | ||
58 | - | ||
59 | - storeInfoSubtitleLabel.text = "Σκάναρε το barcode από το κινητό σου στο ταμείο του καταστήματος και κέρδισε απευθείας έκπτωση από τα διαθέσιμα κουπόνια." | ||
60 | - storeInfoSubtitleLabel.font = UIFont(name: "PeridotPE-Regular", size: 17.0) | ||
61 | - storeInfoSubtitleLabel.textColor = UIColor(rgb: 0x212121) | ||
62 | - | ||
63 | - // EshopInfoView | ||
64 | - eshopInfoTitleLabel.text = "Εξαργύρωση στο eshop" | ||
65 | - eshopInfoTitleLabel.font = UIFont(name: "PeridotPE-Bold", size: 19.0) | ||
66 | - eshopInfoTitleLabel.textColor = UIColor(rgb: 0x212121) | ||
67 | - | ||
68 | - eshopInfoSubtitleLabel.text = "Πληκτρολόγησε τον κωδικό σου στο αντίστοιχο πεδίο κατά το checkout στο eshop και κέρδισε απευθείας έκπτωση από τα διαθέσιμα κουπόνια." | ||
69 | - eshopInfoSubtitleLabel.font = UIFont(name: "PeridotPE-Regular", size: 17.0) | ||
70 | - eshopInfoSubtitleLabel.textColor = UIColor(rgb: 0x212121) | ||
71 | - | ||
72 | - // ABInfoView | ||
73 | - abInfoTitleLabel.text = "Ειδικά για τον ΑΒ" | ||
74 | - abInfoTitleLabel.font = UIFont(name: "PeridotPE-Bold", size: 19.0) | ||
75 | - abInfoTitleLabel.textColor = UIColor(rgb: 0x212121) | ||
76 | - | ||
77 | - abInfoSubtitleLabel.text = "1. Eνεργοποίησε τον κωδικό στην κάρτα ΑΒ PLUS στο kiosk του καταστήματος ή μέσω eshop / app στην ενοτητα στην ενότητα Συνεργασίες – SUPERMARKET DEALS.\n\n2. Κάνε τις αγορές σου και κέρδισε απευθείας έκπτωση με χρήση της AB PLUS από τα διαθέσιμα κουπόνια." | ||
78 | - abInfoSubtitleLabel.font = UIFont(name: "PeridotPE-Regular", size: 17.0) | ||
79 | - abInfoSubtitleLabel.textColor = UIColor(rgb: 0x212121) | ||
80 | - | ||
81 | - // okButton | ||
82 | - okButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15) | ||
83 | - okButton.setTitle("Επιστροφή στο Supermarket Deals", for: .normal) | ||
84 | - okButton.setTitleColor(.white, for: .normal) | ||
85 | - okButton.backgroundColor = UIColor(rgb: 0x0EA600) | ||
86 | - okButton.layer.cornerRadius = 10.0 | ||
87 | - } | ||
88 | - | ||
89 | - // MARK: - Actions | ||
90 | - @IBAction func okButtonAction(_ sender: Any) { | ||
91 | - self.navigationController?.popViewController(animated: true) | ||
92 | - } | ||
93 | -} |
1 | -// | ||
2 | -// MarketSharingHistoryViewController.swift | ||
3 | -// SwiftWarplyFramework | ||
4 | -// | ||
5 | -// Created by Manos Chorianopoulos on 5/4/23. | ||
6 | -// | ||
7 | - | ||
8 | -import UIKit | ||
9 | - | ||
10 | -class MarketSharingHistoryViewController: AnalysisChildViewController { | ||
11 | - | ||
12 | - var loading: Bool = false | ||
13 | - var items: Array<swiftApi.SharingCouponModel> = Array() | ||
14 | - var allItems: Array<swiftApi.SharingCouponModel> = Array() | ||
15 | - var showMore = false | ||
16 | - | ||
17 | - // TODO: remove this when configuring model | ||
18 | - let hasMessage = false | ||
19 | - | ||
20 | - // lifecycle | ||
21 | - override func viewDidLoad() { | ||
22 | - | ||
23 | - super.viewDidLoad() | ||
24 | - | ||
25 | - self.tableView.delegate = self | ||
26 | - self.tableView.dataSource = self | ||
27 | - | ||
28 | - // Add shadow | ||
29 | - self.tableView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.2).cgColor | ||
30 | - self.tableView.layer.shadowOffset = CGSize(width: 0.0, height: 1.0) | ||
31 | - self.tableView.layer.shadowOpacity = 1.0 | ||
32 | - self.tableView.layer.shadowRadius = 1.0 | ||
33 | - | ||
34 | - self.refreshControl = UIRefreshControl() | ||
35 | - self.refreshControl?.addTarget(self, action: #selector(handleRefresh(_:)), for: .valueChanged) | ||
36 | - | ||
37 | - handleRefresh(self.refreshControl!) | ||
38 | - } | ||
39 | - | ||
40 | - // mvp | ||
41 | - @objc func load() { | ||
42 | - | ||
43 | - if (loading) { | ||
44 | - return; | ||
45 | - } | ||
46 | - | ||
47 | - showLoading() | ||
48 | - | ||
49 | - swiftApi().getSharingHistoryAsync(isMarketHistory: true, getSharingHistoryCallback: responseCallback, failureCallback: {errorCode in }) | ||
50 | - } | ||
51 | - | ||
52 | - private func showLoading() { | ||
53 | - | ||
54 | - loading = true | ||
55 | - if (self.refreshControl!.isRefreshing) { | ||
56 | - return; | ||
57 | - } | ||
58 | - | ||
59 | - self.refreshControl!.beginRefreshing() | ||
60 | - } | ||
61 | - | ||
62 | - private func showError() { | ||
63 | - } | ||
64 | - | ||
65 | - private func showContent() { | ||
66 | - | ||
67 | - loading = false | ||
68 | - self.refreshControl!.endRefreshing() | ||
69 | - } | ||
70 | - | ||
71 | - // private | ||
72 | - func responseCallback (_ data: Array<swiftApi.SharingCouponModel>?) -> Void { | ||
73 | - | ||
74 | - self.items = data! | ||
75 | - self.allItems = data! | ||
76 | - self.showMore = (self.items.count > 3) | ||
77 | - | ||
78 | - if (self.showMore == true) { | ||
79 | - self.items = Array(self.items[0...2]) | ||
80 | - } | ||
81 | - showContent() | ||
82 | - DispatchQueue.main.async { | ||
83 | - self.tableView.reloadData() | ||
84 | - } | ||
85 | - } | ||
86 | - | ||
87 | - @objc func handleRefresh(_ refreshControl: UIRefreshControl) { | ||
88 | - | ||
89 | - self.perform(_: #selector(load), with: nil, afterDelay: 0.5) | ||
90 | - } | ||
91 | - | ||
92 | - // MARK: - Table view data source | ||
93 | - override func numberOfSections(in tableView: UITableView) -> Int { | ||
94 | - return 2 | ||
95 | - } | ||
96 | - | ||
97 | - override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
98 | - if (section == 0) { | ||
99 | - return 1; | ||
100 | - } | ||
101 | - | ||
102 | - if (self.showMore == true) { | ||
103 | - return 4 | ||
104 | - } | ||
105 | - return items.count | ||
106 | - } | ||
107 | - | ||
108 | - override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
109 | -// if (indexPath.section == 0) { | ||
110 | -// return hasMessage ? 380.0 : (items.count > 0 ? 280 : 380) | ||
111 | -// } | ||
112 | -// | ||
113 | -// return 140.0 | ||
114 | - return UITableView.automaticDimension | ||
115 | - } | ||
116 | - | ||
117 | - override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
118 | - | ||
119 | - // header | ||
120 | - if (indexPath.section == 0) { | ||
121 | - if (hasMessage) { | ||
122 | - return tableView.dequeueReusableCell(withIdentifier: "AnalysisHeaderMessageViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisHeaderMessageViewCell | ||
123 | - } | ||
124 | - | ||
125 | - let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisHeaderViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisHeaderViewCell | ||
126 | - cell.configureCell(isEmpty: items.count == 0, isMarket: true) | ||
127 | - return cell | ||
128 | - } | ||
129 | - | ||
130 | - if ((self.showMore == true) && (indexPath.row == 3)) { | ||
131 | - let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisMoreViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisMoreViewCell | ||
132 | - return cell | ||
133 | - } | ||
134 | - | ||
135 | - let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisItemViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisItemViewCell | ||
136 | - cell.configureCell(item: items[indexPath.row], isMarket: true) | ||
137 | - | ||
138 | - return cell | ||
139 | - } | ||
140 | - | ||
141 | - override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
142 | - if (indexPath.section == 0) { | ||
143 | - return | ||
144 | - } | ||
145 | - | ||
146 | - if ((self.showMore == true) && (indexPath.row == 3)) { | ||
147 | - self.items = self.allItems | ||
148 | - self.showMore = false | ||
149 | - self.tableView.reloadData() | ||
150 | - } | ||
151 | - } | ||
152 | - | ||
153 | - override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { | ||
154 | - if (section == 0){ | ||
155 | - return nil | ||
156 | - | ||
157 | - } else if (section == 1) { | ||
158 | - if (self.items.count > 0) { | ||
159 | - let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 50)) | ||
160 | - | ||
161 | - let viewBorder = UIView(frame: CGRect(x: 10, y: 0, width: view.frame.width-20, height: view.frame.height)) | ||
162 | - viewBorder.backgroundColor = .white | ||
163 | - // viewBorder.backgroundColor = UIColor(red: 0.90, green: 0.90, blue: 0.90, alpha: 1.00) | ||
164 | - | ||
165 | - viewBorder.layer.cornerRadius = 16.5 | ||
166 | - viewBorder.layer.maskedCorners = [ .layerMinXMinYCorner, .layerMaxXMinYCorner] // Top left, bottom right corner radius | ||
167 | - | ||
168 | - let viewInner = UIView(frame: CGRect(x: 1, y: 1, width: viewBorder.frame.width-2, height: viewBorder.frame.height-1)) | ||
169 | - viewInner.backgroundColor = .white | ||
170 | - | ||
171 | - viewInner.layer.cornerRadius = 16.5 | ||
172 | - viewInner.layer.maskedCorners = [ .layerMinXMinYCorner, .layerMaxXMinYCorner] // Top left, bottom right corner radius | ||
173 | - | ||
174 | - let titleLabel = UILabel(frame: CGRect(x: 20, y: 20, width: viewInner.frame.width - 40, height: 20)) | ||
175 | - titleLabel.font = UIFont(name: "BTCosmo-Bold", size: 20) | ||
176 | - titleLabel.textColor = UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00) | ||
177 | - titleLabel.text = "Αναλυτικά" | ||
178 | - | ||
179 | - view.addSubview(viewBorder) | ||
180 | - viewBorder.addSubview(viewInner) | ||
181 | - viewInner.addSubview(titleLabel) | ||
182 | - return view | ||
183 | - } else { | ||
184 | - return nil | ||
185 | - } | ||
186 | - | ||
187 | - | ||
188 | - } else { | ||
189 | - return nil | ||
190 | - } | ||
191 | - } | ||
192 | - | ||
193 | - override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { | ||
194 | - if (section == 0) { | ||
195 | - return 0.0 | ||
196 | - | ||
197 | - } else if (section == 1) { | ||
198 | - if (self.items.count > 0) { | ||
199 | - return 50.0 | ||
200 | - } else { | ||
201 | - return 0.0 | ||
202 | - } | ||
203 | - | ||
204 | - } else { | ||
205 | - return 0.0 | ||
206 | - } | ||
207 | - } | ||
208 | - | ||
209 | - override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { | ||
210 | -// return CGFloat.leastNormalMagnitude | ||
211 | - if (section == 1 && self.items.count > 0) { | ||
212 | - return 20.0 | ||
213 | - } else { | ||
214 | - return 0.0 | ||
215 | - } | ||
216 | - } | ||
217 | - | ||
218 | - override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { | ||
219 | - if (section == 1) { | ||
220 | - if (self.items.count > 0) { | ||
221 | - let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 30)) | ||
222 | - | ||
223 | - let viewBorder = UIView(frame: CGRect(x: 10, y: 0, width: view.frame.width-20, height: view.frame.height)) | ||
224 | - viewBorder.backgroundColor = .white | ||
225 | - // viewBorder.backgroundColor = UIColor(red: 0.90, green: 0.90, blue: 0.90, alpha: 1.00) | ||
226 | - | ||
227 | - viewBorder.layer.cornerRadius = 16.5 | ||
228 | - viewBorder.layer.maskedCorners = [ .layerMinXMaxYCorner, .layerMaxXMaxYCorner] // bottom left, bottom right corner radius | ||
229 | - | ||
230 | - let viewInner = UIView(frame: CGRect(x: 1, y: 0, width: viewBorder.frame.width-2, height: viewBorder.frame.height-1)) | ||
231 | - viewInner.backgroundColor = .white | ||
232 | - | ||
233 | - viewInner.layer.cornerRadius = 16.5 | ||
234 | - viewInner.layer.maskedCorners = [ .layerMinXMaxYCorner, .layerMaxXMaxYCorner] // bottom left, bottom right corner radius | ||
235 | - | ||
236 | - view.addSubview(viewBorder) | ||
237 | - viewBorder.addSubview(viewInner) | ||
238 | - return view | ||
239 | - } else { | ||
240 | - return nil | ||
241 | - } | ||
242 | - | ||
243 | - } else { | ||
244 | - return nil | ||
245 | - } | ||
246 | - } | ||
247 | -} |
1 | -{ | ||
2 | - "images" : [ | ||
3 | - { | ||
4 | - "filename" : "active_code_logo.png", | ||
5 | - "idiom" : "universal", | ||
6 | - "scale" : "1x" | ||
7 | - }, | ||
8 | - { | ||
9 | - "filename" : "active_code_logo-1.png", | ||
10 | - "idiom" : "universal", | ||
11 | - "scale" : "2x" | ||
12 | - }, | ||
13 | - { | ||
14 | - "filename" : "active_code_logo-2.png", | ||
15 | - "idiom" : "universal", | ||
16 | - "scale" : "3x" | ||
17 | - } | ||
18 | - ], | ||
19 | - "info" : { | ||
20 | - "author" : "xcode", | ||
21 | - "version" : 1 | ||
22 | - } | ||
23 | -} |

38.7 KB

38.7 KB

38.7 KB
1 | -{ | ||
2 | - "images" : [ | ||
3 | - { | ||
4 | - "filename" : "active_code_logo_2.png", | ||
5 | - "idiom" : "universal", | ||
6 | - "scale" : "1x" | ||
7 | - }, | ||
8 | - { | ||
9 | - "filename" : "active_code_logo_2 1.png", | ||
10 | - "idiom" : "universal", | ||
11 | - "scale" : "2x" | ||
12 | - }, | ||
13 | - { | ||
14 | - "filename" : "active_code_logo_2 2.png", | ||
15 | - "idiom" : "universal", | ||
16 | - "scale" : "3x" | ||
17 | - } | ||
18 | - ], | ||
19 | - "info" : { | ||
20 | - "author" : "xcode", | ||
21 | - "version" : 1 | ||
22 | - } | ||
23 | -} |

5.38 KB

5.38 KB

5.38 KB
1 | -{ | ||
2 | - "images" : [ | ||
3 | - { | ||
4 | - "filename" : "arrow_right_black.png", | ||
5 | - "idiom" : "universal", | ||
6 | - "scale" : "1x" | ||
7 | - }, | ||
8 | - { | ||
9 | - "filename" : "arrow_right_black 1.png", | ||
10 | - "idiom" : "universal", | ||
11 | - "scale" : "2x" | ||
12 | - }, | ||
13 | - { | ||
14 | - "filename" : "arrow_right_black 2.png", | ||
15 | - "idiom" : "universal", | ||
16 | - "scale" : "3x" | ||
17 | - } | ||
18 | - ], | ||
19 | - "info" : { | ||
20 | - "author" : "xcode", | ||
21 | - "version" : 1 | ||
22 | - } | ||
23 | -} |

860 Bytes

860 Bytes

860 Bytes
1 | -{ | ||
2 | - "images" : [ | ||
3 | - { | ||
4 | - "filename" : "circle_checked.png", | ||
5 | - "idiom" : "universal", | ||
6 | - "scale" : "1x" | ||
7 | - }, | ||
8 | - { | ||
9 | - "filename" : "circle_checked 1.png", | ||
10 | - "idiom" : "universal", | ||
11 | - "scale" : "2x" | ||
12 | - }, | ||
13 | - { | ||
14 | - "filename" : "circle_checked 2.png", | ||
15 | - "idiom" : "universal", | ||
16 | - "scale" : "3x" | ||
17 | - } | ||
18 | - ], | ||
19 | - "info" : { | ||
20 | - "author" : "xcode", | ||
21 | - "version" : 1 | ||
22 | - } | ||
23 | -} |

1.18 KB

1.18 KB

1.18 KB
1 | -{ | ||
2 | - "images" : [ | ||
3 | - { | ||
4 | - "filename" : "circle_unchecked.png", | ||
5 | - "idiom" : "universal", | ||
6 | - "scale" : "1x" | ||
7 | - }, | ||
8 | - { | ||
9 | - "filename" : "circle_unchecked 1.png", | ||
10 | - "idiom" : "universal", | ||
11 | - "scale" : "2x" | ||
12 | - }, | ||
13 | - { | ||
14 | - "filename" : "circle_unchecked 2.png", | ||
15 | - "idiom" : "universal", | ||
16 | - "scale" : "3x" | ||
17 | - } | ||
18 | - ], | ||
19 | - "info" : { | ||
20 | - "author" : "xcode", | ||
21 | - "version" : 1 | ||
22 | - } | ||
23 | -} |

1.73 KB

1.73 KB

1.73 KB
1 | -{ | ||
2 | - "images" : [ | ||
3 | - { | ||
4 | - "filename" : "coupon_bg.png", | ||
5 | - "idiom" : "universal", | ||
6 | - "scale" : "1x" | ||
7 | - }, | ||
8 | - { | ||
9 | - "filename" : "coupon_bg-1.png", | ||
10 | - "idiom" : "universal", | ||
11 | - "scale" : "2x" | ||
12 | - }, | ||
13 | - { | ||
14 | - "filename" : "coupon_bg-2.png", | ||
15 | - "idiom" : "universal", | ||
16 | - "scale" : "3x" | ||
17 | - } | ||
18 | - ], | ||
19 | - "info" : { | ||
20 | - "author" : "xcode", | ||
21 | - "version" : 1 | ||
22 | - } | ||
23 | -} |

2.28 KB

2.28 KB

2.28 KB
1 | -{ | ||
2 | - "images" : [ | ||
3 | - { | ||
4 | - "filename" : "coupon_bg_2.png", | ||
5 | - "idiom" : "universal", | ||
6 | - "scale" : "1x" | ||
7 | - }, | ||
8 | - { | ||
9 | - "filename" : "coupon_bg_2 1.png", | ||
10 | - "idiom" : "universal", | ||
11 | - "scale" : "2x" | ||
12 | - }, | ||
13 | - { | ||
14 | - "filename" : "coupon_bg_2 2.png", | ||
15 | - "idiom" : "universal", | ||
16 | - "scale" : "3x" | ||
17 | - } | ||
18 | - ], | ||
19 | - "info" : { | ||
20 | - "author" : "xcode", | ||
21 | - "version" : 1 | ||
22 | - } | ||
23 | -} |

3.83 KB

3.83 KB

3.83 KB
1 | -{ | ||
2 | - "images" : [ | ||
3 | - { | ||
4 | - "filename" : "coupon_bg_2_selected.png", | ||
5 | - "idiom" : "universal", | ||
6 | - "scale" : "1x" | ||
7 | - }, | ||
8 | - { | ||
9 | - "filename" : "coupon_bg_2_selected 1.png", | ||
10 | - "idiom" : "universal", | ||
11 | - "scale" : "2x" | ||
12 | - }, | ||
13 | - { | ||
14 | - "filename" : "coupon_bg_2_selected 2.png", | ||
15 | - "idiom" : "universal", | ||
16 | - "scale" : "3x" | ||
17 | - } | ||
18 | - ], | ||
19 | - "info" : { | ||
20 | - "author" : "xcode", | ||
21 | - "version" : 1 | ||
22 | - } | ||
23 | -} |

4.97 KB

4.97 KB

4.97 KB
1 | -{ | ||
2 | - "images" : [ | ||
3 | - { | ||
4 | - "filename" : "coupon_bg_grey.png", | ||
5 | - "idiom" : "universal", | ||
6 | - "scale" : "1x" | ||
7 | - }, | ||
8 | - { | ||
9 | - "filename" : "coupon_bg_grey 1.png", | ||
10 | - "idiom" : "universal", | ||
11 | - "scale" : "2x" | ||
12 | - }, | ||
13 | - { | ||
14 | - "filename" : "coupon_bg_grey 2.png", | ||
15 | - "idiom" : "universal", | ||
16 | - "scale" : "3x" | ||
17 | - } | ||
18 | - ], | ||
19 | - "info" : { | ||
20 | - "author" : "xcode", | ||
21 | - "version" : 1 | ||
22 | - } | ||
23 | -} |

2.37 KB

2.37 KB

2.37 KB
1 | -{ | ||
2 | - "images" : [ | ||
3 | - { | ||
4 | - "filename" : "coupon_bg_shadow.png", | ||
5 | - "idiom" : "universal", | ||
6 | - "scale" : "1x" | ||
7 | - }, | ||
8 | - { | ||
9 | - "filename" : "coupon_bg_shadow 1.png", | ||
10 | - "idiom" : "universal", | ||
11 | - "scale" : "2x" | ||
12 | - }, | ||
13 | - { | ||
14 | - "filename" : "coupon_bg_shadow 2.png", | ||
15 | - "idiom" : "universal", | ||
16 | - "scale" : "3x" | ||
17 | - } | ||
18 | - ], | ||
19 | - "info" : { | ||
20 | - "author" : "xcode", | ||
21 | - "version" : 1 | ||
22 | - } | ||
23 | -} |

4.84 KB

4.84 KB

4.84 KB
1 | -{ | ||
2 | - "images" : [ | ||
3 | - { | ||
4 | - "filename" : "coupon_bg_shadow_grey.png", | ||
5 | - "idiom" : "universal", | ||
6 | - "scale" : "1x" | ||
7 | - }, | ||
8 | - { | ||
9 | - "filename" : "coupon_bg_shadow_grey 1.png", | ||
10 | - "idiom" : "universal", | ||
11 | - "scale" : "2x" | ||
12 | - }, | ||
13 | - { | ||
14 | - "filename" : "coupon_bg_shadow_grey 2.png", | ||
15 | - "idiom" : "universal", | ||
16 | - "scale" : "3x" | ||
17 | - } | ||
18 | - ], | ||
19 | - "info" : { | ||
20 | - "author" : "xcode", | ||
21 | - "version" : 1 | ||
22 | - } | ||
23 | -} |

3.4 KB

3.4 KB

3.4 KB
1 | -{ | ||
2 | - "images" : [ | ||
3 | - { | ||
4 | - "filename" : "coupon_market.png", | ||
5 | - "idiom" : "universal", | ||
6 | - "scale" : "1x" | ||
7 | - }, | ||
8 | - { | ||
9 | - "filename" : "coupon_market 1.png", | ||
10 | - "idiom" : "universal", | ||
11 | - "scale" : "2x" | ||
12 | - }, | ||
13 | - { | ||
14 | - "filename" : "coupon_market 2.png", | ||
15 | - "idiom" : "universal", | ||
16 | - "scale" : "3x" | ||
17 | - } | ||
18 | - ], | ||
19 | - "info" : { | ||
20 | - "author" : "xcode", | ||
21 | - "version" : 1 | ||
22 | - } | ||
23 | -} |

5.14 KB

5.14 KB

5.14 KB
1 | -{ | ||
2 | - "images" : [ | ||
3 | - { | ||
4 | - "filename" : "coupon_market_2.png", | ||
5 | - "idiom" : "universal", | ||
6 | - "scale" : "1x" | ||
7 | - }, | ||
8 | - { | ||
9 | - "filename" : "coupon_market_2 1.png", | ||
10 | - "idiom" : "universal", | ||
11 | - "scale" : "2x" | ||
12 | - }, | ||
13 | - { | ||
14 | - "filename" : "coupon_market_2 2.png", | ||
15 | - "idiom" : "universal", | ||
16 | - "scale" : "3x" | ||
17 | - } | ||
18 | - ], | ||
19 | - "info" : { | ||
20 | - "author" : "xcode", | ||
21 | - "version" : 1 | ||
22 | - } | ||
23 | -} |

6.61 KB

6.61 KB

6.61 KB
1 | -{ | ||
2 | - "images" : [ | ||
3 | - { | ||
4 | - "filename" : "coupons_scrollview_dark.png", | ||
5 | - "idiom" : "universal", | ||
6 | - "scale" : "1x" | ||
7 | - }, | ||
8 | - { | ||
9 | - "filename" : "coupons_scrollview_dark-1.png", | ||
10 | - "idiom" : "universal", | ||
11 | - "scale" : "2x" | ||
12 | - }, | ||
13 | - { | ||
14 | - "filename" : "coupons_scrollview_dark-2.png", | ||
15 | - "idiom" : "universal", | ||
16 | - "scale" : "3x" | ||
17 | - } | ||
18 | - ], | ||
19 | - "info" : { | ||
20 | - "author" : "xcode", | ||
21 | - "version" : 1 | ||
22 | - } | ||
23 | -} |

9.93 KB

9.93 KB

9.93 KB
1 | -{ | ||
2 | - "images" : [ | ||
3 | - { | ||
4 | - "filename" : "coupons_scrollview_white.png", | ||
5 | - "idiom" : "universal", | ||
6 | - "scale" : "1x" | ||
7 | - }, | ||
8 | - { | ||
9 | - "filename" : "coupons_scrollview_white-1.png", | ||
10 | - "idiom" : "universal", | ||
11 | - "scale" : "2x" | ||
12 | - }, | ||
13 | - { | ||
14 | - "filename" : "coupons_scrollview_white-2.png", | ||
15 | - "idiom" : "universal", | ||
16 | - "scale" : "3x" | ||
17 | - } | ||
18 | - ], | ||
19 | - "info" : { | ||
20 | - "author" : "xcode", | ||
21 | - "version" : 1 | ||
22 | - } | ||
23 | -} |

10.8 KB

10.8 KB

10.8 KB
1 | -{ | ||
2 | - "images" : [ | ||
3 | - { | ||
4 | - "filename" : "curved_bg_white.png", | ||
5 | - "idiom" : "universal", | ||
6 | - "scale" : "1x" | ||
7 | - }, | ||
8 | - { | ||
9 | - "filename" : "curved_bg_white-1.png", | ||
10 | - "idiom" : "universal", | ||
11 | - "scale" : "2x" | ||
12 | - }, | ||
13 | - { | ||
14 | - "filename" : "curved_bg_white-2.png", | ||
15 | - "idiom" : "universal", | ||
16 | - "scale" : "3x" | ||
17 | - } | ||
18 | - ], | ||
19 | - "info" : { | ||
20 | - "author" : "xcode", | ||
21 | - "version" : 1 | ||
22 | - } | ||
23 | -} |

3.3 KB

3.3 KB

3.3 KB

2.81 KB

2.81 KB

2.81 KB

22.4 KB

22.4 KB

22.4 KB

4.75 KB

4.75 KB

4.75 KB

5.82 KB

5.82 KB

5.82 KB

28.4 KB

28.4 KB

28.4 KB

6.71 KB

6.71 KB

6.71 KB

5.45 KB

5.45 KB

5.45 KB

6.04 KB

6.04 KB

6.04 KB

4.32 KB

4.32 KB

4.32 KB

5.95 KB

5.95 KB

5.95 KB

3.9 KB

3.9 KB

3.9 KB

4.05 KB

4.05 KB

4.05 KB

3.35 KB

3.35 KB

3.35 KB

757 Bytes

757 Bytes

757 Bytes

4.02 KB

4.02 KB

4.02 KB

2.59 KB

2.59 KB

2.59 KB

997 Bytes

997 Bytes

997 Bytes

908 Bytes

908 Bytes

908 Bytes

772 Bytes

772 Bytes

772 Bytes

4.34 KB

4.34 KB

4.34 KB

2.97 KB

2.97 KB

2.97 KB

3.45 KB

3.45 KB

3.45 KB

22.6 KB

22.6 KB

22.6 KB

21 KB

21 KB

21 KB

5.11 KB

5.11 KB

5.11 KB

20.4 KB

20.4 KB

20.4 KB

5.84 KB

5.84 KB

5.84 KB

657 Bytes

657 Bytes

657 Bytes

2.08 KB

2.08 KB

2.08 KB

1.66 KB

1.66 KB

1.66 KB

1.37 KB

1.37 KB

1.37 KB

985 Bytes

985 Bytes

985 Bytes

4.01 KB

4.01 KB

4.01 KB

456 KB

456 KB

456 KB

1.9 KB

1.9 KB

1.9 KB

1.18 KB

1.18 KB

1.18 KB

3.65 KB

3.65 KB

3.65 KB

3.35 KB

3.35 KB

3.35 KB

3.49 KB

3.49 KB

3.49 KB

53.6 KB

53.6 KB

53.6 KB

2.09 KB

2.09 KB

2.09 KB

6.31 KB

6.31 KB

6.31 KB

5.1 KB

5.1 KB

5.1 KB

6.48 KB

6.48 KB

6.48 KB

1.28 KB

1.28 KB

1.28 KB

903 Bytes

903 Bytes

903 Bytes

4.06 KB

4.06 KB

4.06 KB

4.44 KB

4.44 KB

4.44 KB

5.28 KB

5.28 KB

5.28 KB

1.99 KB

1.99 KB

1.99 KB

2.16 KB

2.16 KB

2.16 KB

12.5 KB

12.5 KB

12.5 KB

15.1 KB

15.1 KB

15.1 KB

12.3 KB

12.3 KB

12.3 KB

3.12 KB

3.12 KB

3.12 KB

13 KB

13 KB

13 KB

15.6 KB

15.6 KB

15.6 KB

5.05 KB

5.05 KB

5.05 KB

15.3 KB

15.3 KB

15.3 KB

16.3 KB

16.3 KB

16.3 KB

1.22 KB

1.22 KB

1.22 KB

1.81 KB

1.81 KB

1.81 KB

11.6 KB

11.6 KB

11.6 KB

3.51 KB

3.51 KB

3.51 KB

11.8 KB

11.8 KB

11.8 KB

429 Bytes

429 Bytes

429 Bytes

386 Bytes

386 Bytes

386 Bytes

12 KB

12 KB

12 KB

3.09 KB

3.09 KB

3.09 KB

3 KB

3 KB

3 KB
-
Please register or login to post a comment