Showing
1 changed file
with
23 additions
and
4 deletions
... | @@ -2031,10 +2031,20 @@ public class swiftApi { | ... | @@ -2031,10 +2031,20 @@ public class swiftApi { |
2031 | 2031 | ||
2032 | public func setCampaignList(_ campaigns: Array<CampaignItemModel>) -> Void { | 2032 | public func setCampaignList(_ campaigns: Array<CampaignItemModel>) -> Void { |
2033 | let userTag = self.getUserTag() | 2033 | let userTag = self.getUserTag() |
2034 | + var campaignsArray:Array<CampaignItemModel> = [] | ||
2035 | + | ||
2036 | + for item in campaigns { | ||
2037 | + if (((item._badge == nil) || (item._badge == ""))) { | ||
2038 | + campaignsArray.append(item) | ||
2039 | + } else if (item._badge == userTag) { | ||
2040 | + campaignsArray.append(item) | ||
2041 | + } | ||
2042 | + } | ||
2043 | + | ||
2034 | if ((userTag != nil) && (userTag != "")) { | 2044 | if ((userTag != nil) && (userTag != "")) { |
2035 | - GlobalVariables.campaigns = campaigns.filter { $0.offer_category != "questionnaire" } | 2045 | + GlobalVariables.campaigns = campaignsArray.filter { $0.offer_category != "questionnaire" } |
2036 | } else { | 2046 | } else { |
2037 | - GlobalVariables.campaigns = campaigns | 2047 | + GlobalVariables.campaigns = campaignsArray |
2038 | } | 2048 | } |
2039 | } | 2049 | } |
2040 | 2050 | ||
... | @@ -2165,11 +2175,20 @@ public class swiftApi { | ... | @@ -2165,11 +2175,20 @@ public class swiftApi { |
2165 | 2175 | ||
2166 | public func setUniqueCampaignList(_ campaigns: Array<CampaignItemModel>) -> Void { | 2176 | public func setUniqueCampaignList(_ campaigns: Array<CampaignItemModel>) -> Void { |
2167 | let userTag = self.getUserTag() | 2177 | let userTag = self.getUserTag() |
2178 | + var campaignsArray:Array<CampaignItemModel> = [] | ||
2179 | + | ||
2180 | + for item in campaigns { | ||
2181 | + if (((item._badge == nil) || (item._badge == ""))) { | ||
2182 | + campaignsArray.append(item) | ||
2183 | + } else if (item._badge == userTag) { | ||
2184 | + campaignsArray.append(item) | ||
2185 | + } | ||
2186 | + } | ||
2168 | 2187 | ||
2169 | if ((userTag != nil) && (userTag != "")) { | 2188 | if ((userTag != nil) && (userTag != "")) { |
2170 | - GlobalVariables.campaigns = campaigns.filter { $0.offer_category != "questionnaire" } | 2189 | + GlobalVariables.campaigns = campaignsArray.filter { $0.offer_category != "questionnaire" } |
2171 | } else { | 2190 | } else { |
2172 | - GlobalVariables.campaigns = campaigns | 2191 | + GlobalVariables.campaigns = campaignsArray |
2173 | } | 2192 | } |
2174 | } | 2193 | } |
2175 | 2194 | ... | ... |
-
Please register or login to post a comment