Showing
2 changed files
with
20 additions
and
10 deletions
... | @@ -285,17 +285,22 @@ import SwiftEventBus | ... | @@ -285,17 +285,22 @@ import SwiftEventBus |
285 | if (response?.getStatus == 1) { | 285 | if (response?.getStatus == 1) { |
286 | self.showSuccessDialog("Συγχαρητήρια!","Μόλις έκανες δώρο ένα κουπόνι!") | 286 | self.showSuccessDialog("Συγχαρητήρια!","Μόλις έκανες δώρο ένα κουπόνι!") |
287 | 287 | ||
288 | - swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in }) | 288 | + if let tempCoupon = self.coupon { |
289 | - | 289 | + swiftApi().removeCouponItem(couponArg: tempCoupon) |
290 | - func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { | ||
291 | - if (couponsData != nil) { | ||
292 | - | ||
293 | - DispatchQueue.main.async { | ||
294 | SwiftEventBus.post("coupons_fetched") | 290 | SwiftEventBus.post("coupons_fetched") |
295 | } | 291 | } |
296 | - } else { | 292 | + |
297 | - } | 293 | + // swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in }) |
298 | - } | 294 | + |
295 | + // func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { | ||
296 | + // if (couponsData != nil) { | ||
297 | + | ||
298 | + // DispatchQueue.main.async { | ||
299 | + // SwiftEventBus.post("coupons_fetched") | ||
300 | + // } | ||
301 | + // } else { | ||
302 | + // } | ||
303 | + // } | ||
299 | } else if (response?.getStatus == 4) { | 304 | } else if (response?.getStatus == 4) { |
300 | self.showDialog("Αποτυχία", response?.getMsg ?? "") | 305 | self.showDialog("Αποτυχία", response?.getMsg ?? "") |
301 | 306 | ... | ... |
... | @@ -9259,11 +9259,16 @@ public class swiftApi { | ... | @@ -9259,11 +9259,16 @@ public class swiftApi { |
9259 | } | 9259 | } |
9260 | 9260 | ||
9261 | public func addCouponItem(newCoupon: CouponItemModel) { | 9261 | public func addCouponItem(newCoupon: CouponItemModel) { |
9262 | - var tempCouponList = getCouponList() | 9262 | + var tempCouponList = swiftApi().getCouponList() |
9263 | tempCouponList.append(newCoupon) | 9263 | tempCouponList.append(newCoupon) |
9264 | swiftApi().setCouponList(tempCouponList) | 9264 | swiftApi().setCouponList(tempCouponList) |
9265 | } | 9265 | } |
9266 | 9266 | ||
9267 | + public func removeCouponItem(couponArg: CouponItemModel) { | ||
9268 | + let tempCouponList = swiftApi().getCouponList().filter { $0.coupon != couponArg.coupon } | ||
9269 | + swiftApi().setCouponList(tempCouponList) | ||
9270 | + } | ||
9271 | + | ||
9267 | public func removeCampaignItem(campaignArg: CampaignItemModel) { | 9272 | public func removeCampaignItem(campaignArg: CampaignItemModel) { |
9268 | let allCampaigns = swiftApi().getAllCampaignList().filter { $0.session_uuid != campaignArg.session_uuid } | 9273 | let allCampaigns = swiftApi().getAllCampaignList().filter { $0.session_uuid != campaignArg.session_uuid } |
9269 | swiftApi().setUniqueCampaignList(allCampaigns) | 9274 | swiftApi().setUniqueCampaignList(allCampaigns) | ... | ... |
-
Please register or login to post a comment