Manos Chorianopoulos

add MarketAnalysisItemViewCell

...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
7 <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> 7 <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
8 <dict> 8 <dict>
9 <key>orderHint</key> 9 <key>orderHint</key>
10 - <integer>1</integer> 10 + <integer>0</integer>
11 </dict> 11 </dict>
12 </dict> 12 </dict>
13 </dict> 13 </dict>
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
31 1E64E8FD2B8DE457001BA46E /* WalletQuestionnaireBannerTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E64E8FC2B8DE457001BA46E /* WalletQuestionnaireBannerTableViewCell.swift */; }; 31 1E64E8FD2B8DE457001BA46E /* WalletQuestionnaireBannerTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E64E8FC2B8DE457001BA46E /* WalletQuestionnaireBannerTableViewCell.swift */; };
32 1E64E8FF2B8DE487001BA46E /* WalletHistoryBannerTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E64E8FE2B8DE487001BA46E /* WalletHistoryBannerTableViewCell.swift */; }; 32 1E64E8FF2B8DE487001BA46E /* WalletHistoryBannerTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E64E8FE2B8DE487001BA46E /* WalletHistoryBannerTableViewCell.swift */; };
33 1E64E9012B8DE4AC001BA46E /* WalletEmptyViewTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E64E9002B8DE4AC001BA46E /* WalletEmptyViewTableViewCell.swift */; }; 33 1E64E9012B8DE4AC001BA46E /* WalletEmptyViewTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E64E9002B8DE4AC001BA46E /* WalletEmptyViewTableViewCell.swift */; };
34 + 1E6515D52D36A4C300AD80C6 /* MarketAnalysisItemViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E6515D42D36A4C300AD80C6 /* MarketAnalysisItemViewCell.swift */; };
34 1E74838D28378AF40042A589 /* CouponBarcodeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E74838C28378AF40042A589 /* CouponBarcodeViewController.swift */; }; 35 1E74838D28378AF40042A589 /* CouponBarcodeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E74838C28378AF40042A589 /* CouponBarcodeViewController.swift */; };
35 1E7B9A5829F6ACF400B37E13 /* WalletBannersTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7B9A5729F6ACF400B37E13 /* WalletBannersTableViewCell.swift */; }; 36 1E7B9A5829F6ACF400B37E13 /* WalletBannersTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7B9A5729F6ACF400B37E13 /* WalletBannersTableViewCell.swift */; };
36 1E87A9EF28C2021200C79F90 /* ContextualViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E87A9EE28C2021200C79F90 /* ContextualViewController.swift */; }; 37 1E87A9EF28C2021200C79F90 /* ContextualViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E87A9EE28C2021200C79F90 /* ContextualViewController.swift */; };
...@@ -229,6 +230,7 @@ ...@@ -229,6 +230,7 @@
229 1E64E8FC2B8DE457001BA46E /* WalletQuestionnaireBannerTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletQuestionnaireBannerTableViewCell.swift; sourceTree = "<group>"; }; 230 1E64E8FC2B8DE457001BA46E /* WalletQuestionnaireBannerTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletQuestionnaireBannerTableViewCell.swift; sourceTree = "<group>"; };
230 1E64E8FE2B8DE487001BA46E /* WalletHistoryBannerTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletHistoryBannerTableViewCell.swift; sourceTree = "<group>"; }; 231 1E64E8FE2B8DE487001BA46E /* WalletHistoryBannerTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletHistoryBannerTableViewCell.swift; sourceTree = "<group>"; };
231 1E64E9002B8DE4AC001BA46E /* WalletEmptyViewTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletEmptyViewTableViewCell.swift; sourceTree = "<group>"; }; 232 1E64E9002B8DE4AC001BA46E /* WalletEmptyViewTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletEmptyViewTableViewCell.swift; sourceTree = "<group>"; };
233 + 1E6515D42D36A4C300AD80C6 /* MarketAnalysisItemViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarketAnalysisItemViewCell.swift; sourceTree = "<group>"; };
232 1E74838C28378AF40042A589 /* CouponBarcodeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponBarcodeViewController.swift; sourceTree = "<group>"; }; 234 1E74838C28378AF40042A589 /* CouponBarcodeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponBarcodeViewController.swift; sourceTree = "<group>"; };
233 1E7B9A5729F6ACF400B37E13 /* WalletBannersTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletBannersTableViewCell.swift; sourceTree = "<group>"; }; 235 1E7B9A5729F6ACF400B37E13 /* WalletBannersTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletBannersTableViewCell.swift; sourceTree = "<group>"; };
234 1E87A9EE28C2021200C79F90 /* ContextualViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContextualViewController.swift; sourceTree = "<group>"; }; 236 1E87A9EE28C2021200C79F90 /* ContextualViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContextualViewController.swift; sourceTree = "<group>"; };
...@@ -527,6 +529,7 @@ ...@@ -527,6 +529,7 @@
527 1E029A4029E002CF00CC7447 /* UnifiedCouponBCHeaderTableViewCell.swift */, 529 1E029A4029E002CF00CC7447 /* UnifiedCouponBCHeaderTableViewCell.swift */,
528 1E029A4229E0031600CC7447 /* UnifiedCouponBCFooterTableViewCell.swift */, 530 1E029A4229E0031600CC7447 /* UnifiedCouponBCFooterTableViewCell.swift */,
529 1E15B9A329DDD211000A408D /* MarketHistoryViewController.swift */, 531 1E15B9A329DDD211000A408D /* MarketHistoryViewController.swift */,
532 + 1E6515D42D36A4C300AD80C6 /* MarketAnalysisItemViewCell.swift */,
530 1EBC75422922829D004FBE75 /* SpinnerViewController.swift */, 533 1EBC75422922829D004FBE75 /* SpinnerViewController.swift */,
531 1ECA079028D9E3BA00D2BDE0 /* CSMButton.swift */, 534 1ECA079028D9E3BA00D2BDE0 /* CSMButton.swift */,
532 1E108A9728A3FA9B0008B8E7 /* Info.plist */, 535 1E108A9728A3FA9B0008B8E7 /* Info.plist */,
...@@ -1009,6 +1012,7 @@ ...@@ -1009,6 +1012,7 @@
1009 1E479FB329DD948B00C38193 /* WalletBadgesTableViewCell.swift in Sources */, 1012 1E479FB329DD948B00C38193 /* WalletBadgesTableViewCell.swift in Sources */,
1010 1E151F1829DAE48500951FA0 /* UnifiedCouponsTableViewCell.swift in Sources */, 1013 1E151F1829DAE48500951FA0 /* UnifiedCouponsTableViewCell.swift in Sources */,
1011 E6A778F0282933E60045BBA8 /* WLNativeAdsCollectionMode.m in Sources */, 1014 E6A778F0282933E60045BBA8 /* WLNativeAdsCollectionMode.m in Sources */,
1015 + 1E6515D52D36A4C300AD80C6 /* MarketAnalysisItemViewCell.swift in Sources */,
1012 E6A7791C282933E60045BBA8 /* WLSMSActionHandlerDeprecated.m in Sources */, 1016 E6A7791C282933E60045BBA8 /* WLSMSActionHandlerDeprecated.m in Sources */,
1013 E6A77934282933E70045BBA8 /* UIActivityIndicatorView+AFNetworking.m in Sources */, 1017 E6A77934282933E70045BBA8 /* UIActivityIndicatorView+AFNetworking.m in Sources */,
1014 E6A77A34282BB3BB0045BBA8 /* ActiveGiftsViewController.swift in Sources */, 1018 E6A77A34282BB3BB0045BBA8 /* ActiveGiftsViewController.swift in Sources */,
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
7 <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> 7 <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
8 <dict> 8 <dict>
9 <key>orderHint</key> 9 <key>orderHint</key>
10 - <integer>0</integer> 10 + <integer>1</integer>
11 </dict> 11 </dict>
12 </dict> 12 </dict>
13 </dict> 13 </dict>
......
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 +
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 +}
207 +