Manos Chorianopoulos

fix smCouponsets data

...@@ -78,6 +78,8 @@ import AVFoundation ...@@ -78,6 +78,8 @@ import AVFoundation
78 public var isMarket: Bool? = false 78 public var isMarket: Bool? = false
79 public var isSMCoupon: Bool? = false 79 public var isSMCoupon: Bool? = false
80 80
81 + let smCouponsetsList = swiftApi().getCouponSetsDealsList()
82 +
81 public override func viewDidLoad() { 83 public override func viewDidLoad() {
82 super.viewDidLoad() 84 super.viewDidLoad()
83 85
...@@ -120,7 +122,19 @@ import AVFoundation ...@@ -120,7 +122,19 @@ import AVFoundation
120 // NEW COUPON KEYS (from couponset): inner_text, merchant_uuid 122 // NEW COUPON KEYS (from couponset): inner_text, merchant_uuid
121 // MISSING KEYS (from couponset): img_preview, name, short_description, terms 123 // MISSING KEYS (from couponset): img_preview, name, short_description, terms
122 124
123 - let couponSetData: swiftApi.CouponSetItemModel? = coupon?.couponset_data 125 +// let couponSetData: swiftApi.CouponSetItemModel? = coupon?.couponset_data
126 + var couponSetData: swiftApi.CouponSetItemModel?
127 + if (isMarket == true) {
128 + for item in smCouponsetsList {
129 + if (item.uuid == coupon?.couponset_uuid) {
130 + couponSetData = item
131 + break;
132 + }
133 + }
134 +
135 + } else {
136 + couponSetData = coupon?.couponset_data
137 + }
124 138
125 if (isMarket == true) { 139 if (isMarket == true) {
126 couponImage.load(link: coupon?.image ?? "", placeholder: UIImage(), cache: URLCache()) 140 couponImage.load(link: coupon?.image ?? "", placeholder: UIImage(), cache: URLCache())
...@@ -185,7 +199,8 @@ import AVFoundation ...@@ -185,7 +199,8 @@ import AVFoundation
185 if (isMarket == true) { 199 if (isMarket == true) {
186 couponImage.contentMode = .scaleAspectFit 200 couponImage.contentMode = .scaleAspectFit
187 201
188 - nameLabel.text = coupon?.name ?? "" 202 +// nameLabel.text = coupon?.name ?? ""
203 + nameLabel.text = couponSetData?.name ?? ""
189 // discriptionLabel.text = coupon?.short_description ?? "" 204 // discriptionLabel.text = coupon?.short_description ?? ""
190 205
191 // let htmlName = coupon?.inner_text ?? "" 206 // let htmlName = coupon?.inner_text ?? ""
......
...@@ -3588,7 +3588,11 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -3588,7 +3588,11 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
3588 3588
3589 [data setValue:active forKey:@"active"]; 3589 [data setValue:active forKey:@"active"];
3590 [data setValue:@"retrieve_multilingual" forKey:@"action"]; 3590 [data setValue:@"retrieve_multilingual" forKey:@"action"];
3591 - [data setValue:visible forKey:@"visible"]; 3591 + if (visible == nil) {
3592 + [data setValue:[NSNull null] forKey:@"visible"];
3593 + } else {
3594 + [data setValue:visible forKey:@"visible"];
3595 + }
3592 [data setValue:LANG forKey:@"language"]; 3596 [data setValue:LANG forKey:@"language"];
3593 if (uuids && [uuids count] > 0) { 3597 if (uuids && [uuids count] > 0) {
3594 [data setValue:uuids forKey:@"uuids"]; 3598 [data setValue:uuids forKey:@"uuids"];
......
...@@ -660,7 +660,7 @@ public class swiftApi { ...@@ -660,7 +660,7 @@ public class swiftApi {
660 var couponSets: [AnyHashable : Any]? 660 var couponSets: [AnyHashable : Any]?
661 var couponSetsArray:Array<CouponSetItemModel> = [] 661 var couponSetsArray:Array<CouponSetItemModel> = []
662 662
663 - instanceOfMyApi.getCouponsetsDealsAsync(true, andVisible: true, andUuids: nil, couponSetsCallback, failureBlock: couponSetsFailureCallback) 663 + instanceOfMyApi.getCouponsetsDealsAsync(true, andVisible: nil, andUuids: nil, couponSetsCallback, failureBlock: couponSetsFailureCallback)
664 664
665 func couponSetsCallback(_ couponSetsData: [AnyHashable : Any]?) -> Void { 665 func couponSetsCallback(_ couponSetsData: [AnyHashable : Any]?) -> Void {
666 666
......