Showing
1 changed file
with
43 additions
and
17 deletions
... | @@ -1279,7 +1279,7 @@ public class swiftApi { | ... | @@ -1279,7 +1279,7 @@ public class swiftApi { |
1279 | public var subtitle: String? | 1279 | public var subtitle: String? |
1280 | public let session_uuid: String? | 1280 | public let session_uuid: String? |
1281 | public let subcategory: String? | 1281 | public let subcategory: String? |
1282 | - public let is_new: Bool? | 1282 | + public var is_new: Bool? |
1283 | public var message: String? | 1283 | public var message: String? |
1284 | public let loyaltyCampaignId: String? | 1284 | public let loyaltyCampaignId: String? |
1285 | public let hasExtraFields: Bool? | 1285 | public let hasExtraFields: Bool? |
... | @@ -8267,16 +8267,19 @@ public class swiftApi { | ... | @@ -8267,16 +8267,19 @@ public class swiftApi { |
8267 | 8267 | ||
8268 | func getSingleCampaignAsyncCallback(_ getSingleCampaignData: [AnyHashable: Any]?) -> Void { | 8268 | func getSingleCampaignAsyncCallback(_ getSingleCampaignData: [AnyHashable: Any]?) -> Void { |
8269 | 8269 | ||
8270 | - swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in }) | 8270 | + // swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in }) |
8271 | 8271 | ||
8272 | - func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void { | 8272 | + // func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void { |
8273 | - if (campaignsData != nil) { | 8273 | + // if (campaignsData != nil) { |
8274 | - DispatchQueue.main.async { | 8274 | + // DispatchQueue.main.async { |
8275 | + // SwiftEventBus.post("campaigns_retrieved") | ||
8276 | + // } | ||
8277 | + // } else { | ||
8278 | + // } | ||
8279 | + // } | ||
8280 | + | ||
8281 | + swiftApi().updateCampaign(sessionUuid: sessionUuid) | ||
8275 | SwiftEventBus.post("campaigns_retrieved") | 8282 | SwiftEventBus.post("campaigns_retrieved") |
8276 | - } | ||
8277 | - } else { | ||
8278 | - } | ||
8279 | - } | ||
8280 | 8283 | ||
8281 | if let getSingleCampaignDataDictionary = getSingleCampaignData as? [String: Any] { | 8284 | if let getSingleCampaignDataDictionary = getSingleCampaignData as? [String: Any] { |
8282 | 8285 | ||
... | @@ -8304,16 +8307,19 @@ public class swiftApi { | ... | @@ -8304,16 +8307,19 @@ public class swiftApi { |
8304 | 8307 | ||
8305 | func getSingleCampaignFailureCallback(_ error: Error?) -> Void { | 8308 | func getSingleCampaignFailureCallback(_ error: Error?) -> Void { |
8306 | 8309 | ||
8307 | - swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in }) | 8310 | + // swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in }) |
8308 | 8311 | ||
8309 | - func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void { | 8312 | + // func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void { |
8310 | - if (campaignsData != nil) { | 8313 | + // if (campaignsData != nil) { |
8311 | - DispatchQueue.main.async { | 8314 | + // DispatchQueue.main.async { |
8315 | + // SwiftEventBus.post("campaigns_retrieved") | ||
8316 | + // } | ||
8317 | + // } else { | ||
8318 | + // } | ||
8319 | + // } | ||
8320 | + | ||
8321 | + swiftApi().updateCampaign(sessionUuid: sessionUuid) | ||
8312 | SwiftEventBus.post("campaigns_retrieved") | 8322 | SwiftEventBus.post("campaigns_retrieved") |
8313 | - } | ||
8314 | - } else { | ||
8315 | - } | ||
8316 | - } | ||
8317 | 8323 | ||
8318 | print("getSingleCampaign error: ") | 8324 | print("getSingleCampaign error: ") |
8319 | print(error) | 8325 | print(error) |
... | @@ -9277,6 +9283,26 @@ public class swiftApi { | ... | @@ -9277,6 +9283,26 @@ public class swiftApi { |
9277 | swiftApi().setCarouselList(carouselArray) | 9283 | swiftApi().setCarouselList(carouselArray) |
9278 | } | 9284 | } |
9279 | 9285 | ||
9286 | + public func updateCampaign(sessionUuid: String) { | ||
9287 | + let allCampaigns = swiftApi().getAllCampaignList() | ||
9288 | + for tempCampaign in allCampaigns { | ||
9289 | + if (tempCampaign.session_uuid == sessionUuid) { | ||
9290 | + tempCampaign.is_new = false | ||
9291 | + break; | ||
9292 | + } | ||
9293 | + } | ||
9294 | + swiftApi().setUniqueCampaignList(allCampaigns) | ||
9295 | + | ||
9296 | + let carouselArray = swiftApi().getCarouselList() | ||
9297 | + for tempCampaign in carouselArray { | ||
9298 | + if (tempCampaign.session_uuid == sessionUuid) { | ||
9299 | + tempCampaign.is_new = false | ||
9300 | + break; | ||
9301 | + } | ||
9302 | + } | ||
9303 | + swiftApi().setCarouselList(carouselArray) | ||
9304 | + } | ||
9305 | + | ||
9280 | public func getCampaignsAsyncNewInternal(_ getCampaignsCallback: @escaping (_ campaignsData: Array<CampaignItemModel>?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void { | 9306 | public func getCampaignsAsyncNewInternal(_ getCampaignsCallback: @escaping (_ campaignsData: Array<CampaignItemModel>?) -> Void, failureCallback: @escaping (_ errorCode: Int) -> Void) -> Void { |
9281 | var campaignsArray = swiftApi().getAllCampaignList() | 9307 | var campaignsArray = swiftApi().getAllCampaignList() |
9282 | swiftApi().getAvailableCouponsAsync({responseDataAvailability in | 9308 | swiftApi().getAvailableCouponsAsync({responseDataAvailability in | ... | ... |
-
Please register or login to post a comment