Showing
2 changed files
with
20 additions
and
10 deletions
| ... | @@ -284,18 +284,23 @@ import SwiftEventBus | ... | @@ -284,18 +284,23 @@ import SwiftEventBus |
| 284 | DispatchQueue.main.async { | 284 | DispatchQueue.main.async { |
| 285 | if (response?.getStatus == 1) { | 285 | if (response?.getStatus == 1) { |
| 286 | self.showSuccessDialog("Συγχαρητήρια!","Μόλις έκανες δώρο ένα κουπόνι!") | 286 | self.showSuccessDialog("Συγχαρητήρια!","Μόλις έκανες δώρο ένα κουπόνι!") |
| 287 | + | ||
| 288 | + if let tempCoupon = self.coupon { | ||
| 289 | + swiftApi().removeCouponItem(couponArg: tempCoupon) | ||
| 290 | + SwiftEventBus.post("coupons_fetched") | ||
| 291 | + } | ||
| 287 | 292 | ||
| 288 | - swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in }) | 293 | + // swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in }) |
| 289 | 294 | ||
| 290 | - func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { | 295 | + // func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { |
| 291 | - if (couponsData != nil) { | 296 | + // if (couponsData != nil) { |
| 292 | 297 | ||
| 293 | - DispatchQueue.main.async { | 298 | + // DispatchQueue.main.async { |
| 294 | - SwiftEventBus.post("coupons_fetched") | 299 | + // SwiftEventBus.post("coupons_fetched") |
| 295 | - } | 300 | + // } |
| 296 | - } else { | 301 | + // } else { |
| 297 | - } | 302 | + // } |
| 298 | - } | 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