Manos Chorianopoulos

refactor getCampaignList, add getAllCampaignList

...@@ -2236,9 +2236,24 @@ public class swiftApi { ...@@ -2236,9 +2236,24 @@ public class swiftApi {
2236 2236
2237 GlobalVariables.campaigns = campaignsArray 2237 GlobalVariables.campaigns = campaignsArray
2238 } 2238 }
2239 - 2239 +
2240 2240
2241 public func getCampaignList() -> Array<CampaignItemModel> { 2241 public func getCampaignList() -> Array<CampaignItemModel> {
2242 +
2243 + let filteredCampaigns = GlobalVariables.campaigns.filter {
2244 + let tempCampaign = $0
2245 + let isCcmsOffer = (tempCampaign.ccms_offer != nil) && (tempCampaign.ccms_offer != "") && (tempCampaign.ccms_offer == "true")
2246 +
2247 + return (!isCcmsOffer)
2248 + }
2249 +
2250 + print("getCampaignList:{" + String(filteredCampaigns.count) + "} campaigns")
2251 +
2252 + return filteredCampaigns
2253 + }
2254 +
2255 +
2256 + public func getAllCampaignList() -> Array<CampaignItemModel> {
2242 return GlobalVariables.campaigns 2257 return GlobalVariables.campaigns
2243 } 2258 }
2244 2259
...@@ -2364,7 +2379,7 @@ public class swiftApi { ...@@ -2364,7 +2379,7 @@ public class swiftApi {
2364 GlobalVariables.loyaltyBadge = loyaltyBadge 2379 GlobalVariables.loyaltyBadge = loyaltyBadge
2365 } 2380 }
2366 2381
2367 - 2382 +
2368 public func getCouponList() -> Array<CouponItemModel> { 2383 public func getCouponList() -> Array<CouponItemModel> {
2369 return GlobalVariables.couponList 2384 return GlobalVariables.couponList
2370 } 2385 }
......