Showing
5 changed files
with
113 additions
and
117 deletions
... | @@ -127,14 +127,19 @@ extension AnalysisItemViewCell { | ... | @@ -127,14 +127,19 @@ extension AnalysisItemViewCell { |
127 | 127 | ||
128 | titleLabel.text = "" | 128 | titleLabel.text = "" |
129 | 129 | ||
130 | - for merchant in merchantList { | 130 | + // for merchant in merchantList { |
131 | - if (merchant._uuid == couponSetData?.merchant_uuid) { | 131 | + // // if (merchant._uuid == couponSetData?.merchant_uuid) { |
132 | - // itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache()) | 132 | + // if (merchant._uuid == item.merchant_uuid) { |
133 | - self.postImageURL = merchant._img_preview | 133 | + // // itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache()) |
134 | - titleLabel.text = merchant._admin_name | 134 | + // self.postImageURL = merchant._img_preview |
135 | - break; | 135 | + // titleLabel.text = merchant._admin_name |
136 | - } | 136 | + // break; |
137 | - } | 137 | + // } |
138 | + // } | ||
139 | + | ||
140 | + let merchantDetails: swiftApi.MerchantModel? = item.merchant_details | ||
141 | + self.postImageURL = merchantDetails?._img_preview | ||
142 | + titleLabel.text = merchantDetails?._admin_name | ||
138 | 143 | ||
139 | dateLabel.text = item.redeemed ?? "" // expiration | 144 | dateLabel.text = item.redeemed ?? "" // expiration |
140 | // itemImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache()) | 145 | // itemImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache()) |
... | @@ -164,14 +169,18 @@ extension AnalysisItemViewCell { | ... | @@ -164,14 +169,18 @@ extension AnalysisItemViewCell { |
164 | 169 | ||
165 | titleLabel.text = "" | 170 | titleLabel.text = "" |
166 | 171 | ||
167 | - for merchant in merchantList { | 172 | + // for merchant in merchantList { |
168 | - if (merchant._uuid == item.merchant_uuid) { | 173 | + // if (merchant._uuid == item.merchant_uuid) { |
169 | - // itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache()) | 174 | + // // itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache()) |
170 | - self.postImageURL = merchant._img_preview | 175 | + // self.postImageURL = merchant._img_preview |
171 | - titleLabel.text = merchant._admin_name | 176 | + // titleLabel.text = merchant._admin_name |
172 | - break; | 177 | + // break; |
173 | - } | 178 | + // } |
174 | - } | 179 | + // } |
180 | + | ||
181 | + let merchantDetails: swiftApi.MerchantModel? = item.merchant_details | ||
182 | + self.postImageURL = merchantDetails?._img_preview | ||
183 | + titleLabel.text = merchantDetails?._admin_name | ||
175 | 184 | ||
176 | // titleLabel.text = item.name | 185 | // titleLabel.text = item.name |
177 | // self.postImageURL = item.image | 186 | // self.postImageURL = item.image | ... | ... |
... | @@ -144,15 +144,18 @@ import AVFoundation | ... | @@ -144,15 +144,18 @@ import AVFoundation |
144 | 144 | ||
145 | let merchantList:Array<swiftApi.MerchantModel> = swiftApi().getMerchantList() | 145 | let merchantList:Array<swiftApi.MerchantModel> = swiftApi().getMerchantList() |
146 | var merchantUuid: String = "" | 146 | var merchantUuid: String = "" |
147 | - if (isMarket == true) { | 147 | + // if (isMarket == true) { |
148 | merchantUuid = coupon?.merchant_uuid ?? "" | 148 | merchantUuid = coupon?.merchant_uuid ?? "" |
149 | - } else { | 149 | + // } else { |
150 | - merchantUuid = couponSetData?.merchant_uuid ?? "" | 150 | + // merchantUuid = couponSetData?.merchant_uuid ?? "" |
151 | - } | 151 | + // } |
152 | + | ||
153 | + // for merchant in merchantList { | ||
154 | + // if (merchant._uuid == merchantUuid) { | ||
155 | + // let htmlMerchDescrText = merchant._body | ||
152 | 156 | ||
153 | - for merchant in merchantList { | 157 | + let merchantDetails: swiftApi.MerchantModel? = coupon?.merchant_details |
154 | - if (merchant._uuid == merchantUuid) { | 158 | + let htmlMerchDescrText = merchantDetails?._body ?? "" |
155 | - let htmlMerchDescrText = merchant._body | ||
156 | 159 | ||
157 | if (isMarket != true && htmlMerchDescrText != "") { | 160 | if (isMarket != true && htmlMerchDescrText != "") { |
158 | merchantDescrTextView.attributedText = htmlMerchDescrText.htmlToAttributedString | 161 | merchantDescrTextView.attributedText = htmlMerchDescrText.htmlToAttributedString |
... | @@ -173,9 +176,9 @@ import AVFoundation | ... | @@ -173,9 +176,9 @@ import AVFoundation |
173 | couponCodeLabelTopSpace.constant = CGFloat(0) | 176 | couponCodeLabelTopSpace.constant = CGFloat(0) |
174 | } | 177 | } |
175 | 178 | ||
176 | - break; | 179 | + // break; |
177 | - } | 180 | + // } |
178 | - } | 181 | + // } |
179 | 182 | ||
180 | couponView.layer.cornerRadius = 16 | 183 | couponView.layer.cornerRadius = 16 |
181 | couponNumberLabel.text = coupon?.coupon ?? "" | 184 | couponNumberLabel.text = coupon?.coupon ?? "" |
... | @@ -518,7 +521,7 @@ import AVFoundation | ... | @@ -518,7 +521,7 @@ import AVFoundation |
518 | if (isMarket == true) { | 521 | if (isMarket == true) { |
519 | vc.isMarket = true | 522 | vc.isMarket = true |
520 | } else { | 523 | } else { |
521 | - vc.couponSet = coupon?.couponset_data | 524 | + vc.coupon = coupon |
522 | } | 525 | } |
523 | 526 | ||
524 | self.navigationController?.pushViewController(vc, animated: true) | 527 | self.navigationController?.pushViewController(vc, animated: true) | ... | ... |
... | @@ -23,6 +23,9 @@ import UIKit | ... | @@ -23,6 +23,9 @@ import UIKit |
23 | var postImageURL: String? { | 23 | var postImageURL: String? { |
24 | didSet { | 24 | didSet { |
25 | if let url = postImageURL { | 25 | if let url = postImageURL { |
26 | + // TODO: DELETE LOGS | ||
27 | + print("=== postImageURL: ",url) | ||
28 | + | ||
26 | self.couponImage.image = UIImage() // UIImage(named: "loading") | 29 | self.couponImage.image = UIImage() // UIImage(named: "loading") |
27 | 30 | ||
28 | UIImage.loadImageUsingCacheWithUrlString(url) { image in | 31 | UIImage.loadImageUsingCacheWithUrlString(url) { image in |
... | @@ -79,14 +82,19 @@ import UIKit | ... | @@ -79,14 +82,19 @@ import UIKit |
79 | 82 | ||
80 | nameLabel.text = "" | 83 | nameLabel.text = "" |
81 | 84 | ||
82 | - for merchant in merchantList { | 85 | + // for merchant in merchantList { |
83 | - if (merchant._uuid == couponSetData?.merchant_uuid) { | 86 | + // // if (merchant._uuid == couponSetData?.merchant_uuid) { |
84 | - // couponImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache()) | 87 | + // if (merchant._uuid == coupon.merchant_uuid) { |
85 | - self.postImageURL = merchant._img_preview | 88 | + // // couponImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache()) |
86 | - nameLabel.text = merchant._admin_name | 89 | + // self.postImageURL = merchant._img_preview |
87 | - break; | 90 | + // nameLabel.text = merchant._admin_name |
88 | - } | 91 | + // break; |
89 | - } | 92 | + // } |
93 | + // } | ||
94 | + | ||
95 | + let merchantDetails: swiftApi.MerchantModel? = coupon.merchant_details | ||
96 | + self.postImageURL = merchantDetails?._img_preview | ||
97 | + nameLabel.text = merchantDetails?._admin_name | ||
90 | 98 | ||
91 | // couponImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache()) | 99 | // couponImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache()) |
92 | // nameLabel.text = couponSetData?.name ?? "" | 100 | // nameLabel.text = couponSetData?.name ?? "" | ... | ... |
... | @@ -28,7 +28,7 @@ import MapKit | ... | @@ -28,7 +28,7 @@ import MapKit |
28 | @IBOutlet weak var addressImageView: UIImageView! | 28 | @IBOutlet weak var addressImageView: UIImageView! |
29 | 29 | ||
30 | // public | 30 | // public |
31 | - public var couponSet: swiftApi.CouponSetItemModel? | 31 | + public var coupon: swiftApi.CouponItemModel? |
32 | public var isMarket: Bool? = false | 32 | public var isMarket: Bool? = false |
33 | var merchantsArray:Array<swiftApi.MerchantModel> = [] | 33 | var merchantsArray:Array<swiftApi.MerchantModel> = [] |
34 | var selectedMerchant: swiftApi.MerchantModel? | 34 | var selectedMerchant: swiftApi.MerchantModel? |
... | @@ -132,8 +132,8 @@ import MapKit | ... | @@ -132,8 +132,8 @@ import MapKit |
132 | } | 132 | } |
133 | showLoading() | 133 | showLoading() |
134 | 134 | ||
135 | - if (couponSet != nil) { | 135 | + if (coupon != nil) { |
136 | - if let merchantUuid: String = couponSet?.merchant_uuid { | 136 | + if let merchantUuid: String = coupon?.merchant_uuid { |
137 | swiftApi().getMultilingualMerchantsAsync([], false, 0.0, [], "", 0, [merchantUuid], getMerchantsCallback) | 137 | swiftApi().getMultilingualMerchantsAsync([], false, 0.0, [], "", 0, [merchantUuid], getMerchantsCallback) |
138 | showContent() | 138 | showContent() |
139 | } | 139 | } |
... | @@ -209,12 +209,34 @@ import MapKit | ... | @@ -209,12 +209,34 @@ import MapKit |
209 | alert.addAction(UIAlertAction(title: "Δες το eshop", style: .default, handler: { action in | 209 | alert.addAction(UIAlertAction(title: "Δες το eshop", style: .default, handler: { action in |
210 | switch action.style{ | 210 | switch action.style{ |
211 | case .default: | 211 | case .default: |
212 | - if (self.couponSet != nil) { | 212 | + if (self.coupon != nil) { |
213 | - if let merchantUuid: String = self.couponSet?.merchant_uuid { | 213 | + // if let merchantUuid: String = self.coupon?.merchant_uuid { |
214 | - for item in swiftApi().getMerchantList() { | 214 | + // for item in swiftApi().getMerchantList() { |
215 | - if (item._uuid == merchantUuid) { | 215 | + // if (item._uuid == merchantUuid) { |
216 | - | 216 | + |
217 | - let eshopWebsite = item._website | 217 | + // let eshopWebsite = item._website |
218 | + | ||
219 | + // if (eshopWebsite != "") { | ||
220 | + // guard let websiteUrl = URL(string: eshopWebsite) else { | ||
221 | + // print("Error creating URL") | ||
222 | + // return | ||
223 | + // } | ||
224 | + | ||
225 | + // // check if link can be opened. | ||
226 | + // guard UIApplication.shared.canOpenURL(websiteUrl) else { | ||
227 | + // return | ||
228 | + // } | ||
229 | + | ||
230 | + // swiftApi().logTrackersEvent("click", "SeeShopWebsite") | ||
231 | + // UIApplication.shared.open(websiteUrl, options: [:], completionHandler: nil) | ||
232 | + // break; | ||
233 | + // } | ||
234 | + // } | ||
235 | + // } | ||
236 | + // } | ||
237 | + | ||
238 | + let merchantDetails: swiftApi.MerchantModel? = self.coupon?.merchant_details | ||
239 | + let eshopWebsite = merchantDetails?._website ?? "" | ||
218 | 240 | ||
219 | if (eshopWebsite != "") { | 241 | if (eshopWebsite != "") { |
220 | guard let websiteUrl = URL(string: eshopWebsite) else { | 242 | guard let websiteUrl = URL(string: eshopWebsite) else { |
... | @@ -232,9 +254,6 @@ import MapKit | ... | @@ -232,9 +254,6 @@ import MapKit |
232 | break; | 254 | break; |
233 | } | 255 | } |
234 | } | 256 | } |
235 | - } | ||
236 | - } | ||
237 | - } | ||
238 | // if (self.merchantsArray.count > 0) { | 257 | // if (self.merchantsArray.count > 0) { |
239 | // for item in self.merchantsArray { | 258 | // for item in self.merchantsArray { |
240 | // let eshopWebsite = item._website | 259 | // let eshopWebsite = item._website | ... | ... |
... | @@ -513,6 +513,9 @@ public class swiftApi { | ... | @@ -513,6 +513,9 @@ public class swiftApi { |
513 | public let discount_type: String? // "value" / "percentage" / "plus_one" | 513 | public let discount_type: String? // "value" / "percentage" / "plus_one" |
514 | public let final_price: Float? | 514 | public let final_price: Float? |
515 | 515 | ||
516 | + // Universal Coupons | ||
517 | + public let couponset_type: String? | ||
518 | + | ||
516 | public init(dictionary: [String: Any]) { | 519 | public init(dictionary: [String: Any]) { |
517 | self.uuid = dictionary["uuid"] as? String? ?? "" | 520 | self.uuid = dictionary["uuid"] as? String? ?? "" |
518 | self.admin_name = dictionary["admin_name"] as? String? ?? "" | 521 | self.admin_name = dictionary["admin_name"] as? String? ?? "" |
... | @@ -531,6 +534,9 @@ public class swiftApi { | ... | @@ -531,6 +534,9 @@ public class swiftApi { |
531 | self.discount_type = dictionary["discount_type"] as? String? ?? "" | 534 | self.discount_type = dictionary["discount_type"] as? String? ?? "" |
532 | // self.final_price = dictionary["final_price"] as? Float? ?? 0.0 | 535 | // self.final_price = dictionary["final_price"] as? Float? ?? 0.0 |
533 | 536 | ||
537 | + // Universal Coupons | ||
538 | + self.couponset_type = dictionary["couponset_type"] as? String? ?? "" | ||
539 | + | ||
534 | if let double_final_price = dictionary["final_price"] as? Double { | 540 | if let double_final_price = dictionary["final_price"] as? Double { |
535 | self.final_price = Float(double_final_price) | 541 | self.final_price = Float(double_final_price) |
536 | } | 542 | } |
... | @@ -738,6 +744,9 @@ public class swiftApi { | ... | @@ -738,6 +744,9 @@ public class swiftApi { |
738 | public let short_description: String? | 744 | public let short_description: String? |
739 | public let terms: String? | 745 | public let terms: String? |
740 | 746 | ||
747 | + // Universal Coupons | ||
748 | + public let merchant_details: MerchantModel? | ||
749 | + | ||
741 | 750 | ||
742 | public init(dictionary: [String: Any]) { | 751 | public init(dictionary: [String: Any]) { |
743 | self.couponset_uuid = dictionary["couponset_uuid"] as? String? ?? "" | 752 | self.couponset_uuid = dictionary["couponset_uuid"] as? String? ?? "" |
... | @@ -775,33 +784,30 @@ public class swiftApi { | ... | @@ -775,33 +784,30 @@ public class swiftApi { |
775 | self.short_description = dictionary["short_description"] as? String? ?? "" | 784 | self.short_description = dictionary["short_description"] as? String? ?? "" |
776 | self.terms = dictionary["terms"] as? String? ?? "" | 785 | self.terms = dictionary["terms"] as? String? ?? "" |
777 | 786 | ||
778 | - // TODO: DELETE | ||
779 | -// if let couponSetData = dictionary["couponset_data"] as? [String: Any]? ?? ["":""] { | ||
780 | -// | ||
781 | -// let tempCouponset = CouponSetItemModel(dictionary: couponSetData) | ||
782 | -// | ||
783 | -// self.couponset_data = tempCouponset | ||
784 | -// } else { | ||
785 | -// self.couponset_data = nil | ||
786 | -// } | ||
787 | - | ||
788 | if let couponSetData = dictionary["couponset_data"] as? [String: Any] { | 787 | if let couponSetData = dictionary["couponset_data"] as? [String: Any] { |
789 | 788 | ||
790 | let tempCouponset = CouponSetItemModel(dictionary: couponSetData) | 789 | let tempCouponset = CouponSetItemModel(dictionary: couponSetData) |
791 | 790 | ||
792 | self.couponset_data = tempCouponset | 791 | self.couponset_data = tempCouponset |
792 | + | ||
793 | + // Universal Coupons ==> | ||
794 | + } else if let couponSetDetails = dictionary["couponset_details"] as? [String: Any] { | ||
795 | + let tempCouponset = CouponSetItemModel(dictionary: couponSetDetails) | ||
796 | + | ||
797 | + self.couponset_data = tempCouponset | ||
793 | } else { | 798 | } else { |
794 | self.couponset_data = nil | 799 | self.couponset_data = nil |
795 | } | 800 | } |
796 | 801 | ||
797 | - if let couponSetDetails = dictionary["couponset_details"] as? [String: Any] { | 802 | + if let merchantDetails = dictionary["merchant_details"] as? [String: Any] { |
798 | 803 | ||
799 | - let tempCouponset = CouponSetItemModel(dictionary: couponSetDetails) | 804 | + let tempMerchantDetails = MerchantModel(dictionary: merchantDetails) |
800 | 805 | ||
801 | - self.couponset_data = tempCouponset | 806 | + self.merchant_details = tempMerchantDetails |
802 | } else { | 807 | } else { |
803 | - self.couponset_data = nil | 808 | + self.merchant_details = nil |
804 | } | 809 | } |
810 | + // <== | ||
805 | 811 | ||
806 | 812 | ||
807 | let expirationString = dictionary["expiration"] as? String? ?? "" | 813 | let expirationString = dictionary["expiration"] as? String? ?? "" |
... | @@ -1087,6 +1093,7 @@ public class swiftApi { | ... | @@ -1087,6 +1093,7 @@ public class swiftApi { |
1087 | }) | 1093 | }) |
1088 | } | 1094 | } |
1089 | 1095 | ||
1096 | + // Old implementation | ||
1090 | // public func getCouponsAsync(_ getCouponsCallback: @escaping (_ couponsData: Array<CouponItemModel>?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void { | 1097 | // public func getCouponsAsync(_ getCouponsCallback: @escaping (_ couponsData: Array<CouponItemModel>?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void { |
1091 | // CouponsDataModel().getCouponsData(getCouponsCallback, failureCallback: failureCallback) | 1098 | // CouponsDataModel().getCouponsData(getCouponsCallback, failureCallback: failureCallback) |
1092 | // } | 1099 | // } |
... | @@ -1107,46 +1114,6 @@ public class swiftApi { | ... | @@ -1107,46 +1114,6 @@ public class swiftApi { |
1107 | 1114 | ||
1108 | swiftApi().getCouponsUniversalAsync(language: "el", getCouponsCallback, failureCallback: failureCallback) | 1115 | swiftApi().getCouponsUniversalAsync(language: "el", getCouponsCallback, failureCallback: failureCallback) |
1109 | 1116 | ||
1110 | - // swiftApi().getCouponsUniversalAsync(language: "el", getCouponsUniversalCallback) { errorCode in | ||
1111 | - // // TODO: DELETE LOGS | ||
1112 | - // print("========= getCouponsUniversalRequest ERROR CODE =========", errorCode) | ||
1113 | - | ||
1114 | - // failureCallback(errorCode) | ||
1115 | - // } | ||
1116 | - | ||
1117 | - // func getCouponsUniversalCallback (_ responseData: Array<swiftApi.CouponItemModel>?) -> Void { | ||
1118 | - // if (responseData != nil) { | ||
1119 | - // DispatchQueue.main.async { | ||
1120 | - // // TODO: DELETE LOGS | ||
1121 | - // print("========= getCouponsUniversalRequest responseData =========") | ||
1122 | - // print(responseData) | ||
1123 | - | ||
1124 | - // var activeCoupons = responseData.filter({ return $0.status == 1 }) | ||
1125 | - // // sort activeCoupons by expiration date | ||
1126 | - // let dateFormatter = DateFormatter() | ||
1127 | - // dateFormatter.dateFormat = "dd/MM/yyyy" | ||
1128 | - | ||
1129 | - // activeCoupons.sort(by: { | ||
1130 | - // let date1 = dateFormatter.date(from: $0.expiration ?? "") | ||
1131 | - // let date2 = dateFormatter.date(from: $1.expiration ?? "") | ||
1132 | - | ||
1133 | - // if ((date1 != nil) && (date2 != nil)) { | ||
1134 | - // return date1!.compare(date2!) == .orderedAscending | ||
1135 | - // } else { | ||
1136 | - // return false | ||
1137 | - // } | ||
1138 | - | ||
1139 | - // }) | ||
1140 | - // getCouponsCallback(activeCoupons) | ||
1141 | - // } | ||
1142 | - // } else { | ||
1143 | - // // TODO: DELETE LOGS | ||
1144 | - // print("========= getCouponsUniversalRequest ERROR =========") | ||
1145 | - | ||
1146 | - // getCouponsCallback(nil) | ||
1147 | - // } | ||
1148 | - // } | ||
1149 | - | ||
1150 | instanceOfMyApi.getCouponsetsAsync(true, andVisible: true, andUuids: nil, couponSetsCallback, failureBlock: couponSetsFailureCallback) | 1117 | instanceOfMyApi.getCouponsetsAsync(true, andVisible: true, andUuids: nil, couponSetsCallback, failureBlock: couponSetsFailureCallback) |
1151 | 1118 | ||
1152 | func couponSetsCallback(_ couponSetsData: [AnyHashable : Any]?) -> Void { | 1119 | func couponSetsCallback(_ couponSetsData: [AnyHashable : Any]?) -> Void { |
... | @@ -8391,15 +8358,6 @@ public class swiftApi { | ... | @@ -8391,15 +8358,6 @@ public class swiftApi { |
8391 | 8358 | ||
8392 | if let responseDataDictionary = responseData as? [String: AnyObject] { | 8359 | if let responseDataDictionary = responseData as? [String: AnyObject] { |
8393 | 8360 | ||
8394 | - // TODO: DELETE LOGS | ||
8395 | - print("=== responseDataDictionary ===") | ||
8396 | - print(responseDataDictionary) | ||
8397 | - print("=== responseDataDictionary result ===") | ||
8398 | - print(responseDataDictionary["result"]) | ||
8399 | - print("=== responseDataDictionary status ===") | ||
8400 | - print(responseDataDictionary["status"]) | ||
8401 | - | ||
8402 | - | ||
8403 | if (responseDataDictionary["status"] as? Int == 1) { | 8361 | if (responseDataDictionary["status"] as? Int == 1) { |
8404 | let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel() | 8362 | let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel() |
8405 | dynatraceEvent._eventName = "custom_success_user_coupons_loyalty" | 8363 | dynatraceEvent._eventName = "custom_success_user_coupons_loyalty" |
... | @@ -8414,17 +8372,16 @@ public class swiftApi { | ... | @@ -8414,17 +8372,16 @@ public class swiftApi { |
8414 | } | 8372 | } |
8415 | } | 8373 | } |
8416 | 8374 | ||
8417 | - // TODO: DELETE LOGS | ||
8418 | - print("=== AllCoupons NEW ===") | ||
8419 | - print(couponsArray.count) | ||
8420 | - | ||
8421 | // setAllOldCouponList uncluding Supermarkets ==> | 8375 | // setAllOldCouponList uncluding Supermarkets ==> |
8422 | swiftApi().setAllOldCouponList(couponsArray) | 8376 | swiftApi().setAllOldCouponList(couponsArray) |
8423 | // <== | 8377 | // <== |
8424 | - swiftApi().setCouponList(couponsArray) | ||
8425 | - swiftApi().setOldCouponList(couponsArray) | ||
8426 | 8378 | ||
8427 | - var activeCoupons = couponsArray.filter({ return $0.status == 1 }) | 8379 | + let noSMCoupons = couponsArray.filter({ return $0.couponset_data?.couponset_type != "supermarket" }) |
8380 | + | ||
8381 | + swiftApi().setCouponList(noSMCoupons) | ||
8382 | + swiftApi().setOldCouponList(noSMCoupons) | ||
8383 | + | ||
8384 | + var activeCoupons = noSMCoupons.filter({ return $0.status == 1 }) | ||
8428 | // sort activeCoupons by expiration date | 8385 | // sort activeCoupons by expiration date |
8429 | let dateFormatter = DateFormatter() | 8386 | let dateFormatter = DateFormatter() |
8430 | dateFormatter.dateFormat = "dd/MM/yyyy" | 8387 | dateFormatter.dateFormat = "dd/MM/yyyy" | ... | ... |
-
Please register or login to post a comment