Manos Chorianopoulos

fix smCouponsets data

......@@ -78,6 +78,8 @@ import AVFoundation
public var isMarket: Bool? = false
public var isSMCoupon: Bool? = false
let smCouponsetsList = swiftApi().getCouponSetsDealsList()
public override func viewDidLoad() {
super.viewDidLoad()
......@@ -120,7 +122,19 @@ import AVFoundation
// NEW COUPON KEYS (from couponset): inner_text, merchant_uuid
// MISSING KEYS (from couponset): img_preview, name, short_description, terms
let couponSetData: swiftApi.CouponSetItemModel? = coupon?.couponset_data
// let couponSetData: swiftApi.CouponSetItemModel? = coupon?.couponset_data
var couponSetData: swiftApi.CouponSetItemModel?
if (isMarket == true) {
for item in smCouponsetsList {
if (item.uuid == coupon?.couponset_uuid) {
couponSetData = item
break;
}
}
} else {
couponSetData = coupon?.couponset_data
}
if (isMarket == true) {
couponImage.load(link: coupon?.image ?? "", placeholder: UIImage(), cache: URLCache())
......@@ -185,7 +199,8 @@ import AVFoundation
if (isMarket == true) {
couponImage.contentMode = .scaleAspectFit
nameLabel.text = coupon?.name ?? ""
// nameLabel.text = coupon?.name ?? ""
nameLabel.text = couponSetData?.name ?? ""
// discriptionLabel.text = coupon?.short_description ?? ""
// let htmlName = coupon?.inner_text ?? ""
......
......@@ -3588,7 +3588,11 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
[data setValue:active forKey:@"active"];
[data setValue:@"retrieve_multilingual" forKey:@"action"];
if (visible == nil) {
[data setValue:[NSNull null] forKey:@"visible"];
} else {
[data setValue:visible forKey:@"visible"];
}
[data setValue:LANG forKey:@"language"];
if (uuids && [uuids count] > 0) {
[data setValue:uuids forKey:@"uuids"];
......
......@@ -660,7 +660,7 @@ public class swiftApi {
var couponSets: [AnyHashable : Any]?
var couponSetsArray:Array<CouponSetItemModel> = []
instanceOfMyApi.getCouponsetsDealsAsync(true, andVisible: true, andUuids: nil, couponSetsCallback, failureBlock: couponSetsFailureCallback)
instanceOfMyApi.getCouponsetsDealsAsync(true, andVisible: nil, andUuids: nil, couponSetsCallback, failureBlock: couponSetsFailureCallback)
func couponSetsCallback(_ couponSetsData: [AnyHashable : Any]?) -> Void {
......