Showing
1 changed file
with
10 additions
and
0 deletions
... | @@ -68,6 +68,16 @@ public class swiftApi { | ... | @@ -68,6 +68,16 @@ public class swiftApi { |
68 | 68 | ||
69 | public func setCCMSLoyaltyCampaigns(campaigns: Array<LoyaltyContextualOfferModel>) { | 69 | public func setCCMSLoyaltyCampaigns(campaigns: Array<LoyaltyContextualOfferModel>) { |
70 | let ccmsCampaign: Array<LoyaltyContextualOfferModel> = campaigns | 70 | let ccmsCampaign: Array<LoyaltyContextualOfferModel> = campaigns |
71 | + | ||
72 | + let mergedGFYCampaigns = GlobalVariables.campaigns.filter { | ||
73 | + let tempCampaign = $0 | ||
74 | + let isGFY = tempCampaign.offer_category == "gifts_for_you" | ||
75 | + let hasExtraFields = tempCampaign.hasExtraFields ?? false | ||
76 | + let loyaltyCampaignIdExists = ccmsCampaign.contains { $0._loyaltyCampaignId == tempCampaign.loyaltyCampaignId } | ||
77 | + return isGFY && (!hasExtraFields || loyaltyCampaignIdExists) | ||
78 | + } | ||
79 | + | ||
80 | + GlobalVariables.campaigns = GlobalVariables.campaigns.filter { $0.offer_category != "gifts_for_you" } + mergedGFYCampaigns | ||
71 | } | 81 | } |
72 | 82 | ||
73 | public func getActiveDFYCoupons() -> Array<ActiveDFYCouponModel> { | 83 | public func getActiveDFYCoupons() -> Array<ActiveDFYCouponModel> { | ... | ... |
-
Please register or login to post a comment