Manos Chorianopoulos

ContextualViewController submitOrder optimizations

...@@ -202,7 +202,8 @@ import SwiftEventBus ...@@ -202,7 +202,8 @@ import SwiftEventBus
202 case .default: 202 case .default:
203 self.navigationController?.popViewController(animated: true) 203 self.navigationController?.popViewController(animated: true)
204 204
205 - swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in }) 205 + // swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in })
206 + swiftApi().getCouponsAsyncInternal(getCouponsCallback, failureCallback: {errorCode in })
206 207
207 func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { 208 func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void {
208 if (couponsData != nil) { 209 if (couponsData != nil) {
...@@ -213,7 +214,24 @@ import SwiftEventBus ...@@ -213,7 +214,24 @@ import SwiftEventBus
213 } 214 }
214 } 215 }
215 216
216 - swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in }) 217 + var campaignFound: swiftApi.CampaignItemModel? = nil
218 +
219 + if let ccmLoyaltyCampaignId = self.ccms?._loyaltyCampaignId {
220 + let allCampaigns = swiftApi().getAllCampaignList()
221 + for item in allCampaigns {
222 + if (item.session_uuid == ccmLoyaltyCampaignId) {
223 + campaignFound = item
224 + break;
225 + }
226 + }
227 + }
228 +
229 + if let tempCampaign = campaignFound {
230 + swiftApi().removeCampaignItem(campaignArg: tempCampaign)
231 + swiftApi().getCampaignsAsyncNewInternal(getCampaignsCallback, failureCallback: {errorCode in})
232 + }
233 +
234 + // swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in })
217 235
218 func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void { 236 func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void {
219 if (campaignsData != nil) { 237 if (campaignsData != nil) {
......