Manos Chorianopoulos

CampaignItemModel fixes

...@@ -17,7 +17,7 @@ public class CampaignItemModel { ...@@ -17,7 +17,7 @@ public class CampaignItemModel {
17 // MARK: - URL Cleaning Helper 17 // MARK: - URL Cleaning Helper
18 18
19 /// Cleans escaped forward slashes from URLs (e.g., "https:\/\/example.com" -> "https://example.com") 19 /// Cleans escaped forward slashes from URLs (e.g., "https:\/\/example.com" -> "https://example.com")
20 - private func cleanEscapedUrl(_ url: String?) -> String? { 20 + private static func cleanEscapedUrl(_ url: String?) -> String? {
21 return url?.replacingOccurrences(of: "\\/", with: "/") 21 return url?.replacingOccurrences(of: "\\/", with: "/")
22 } 22 }
23 public let offer_category: String? 23 public let offer_category: String?
...@@ -105,8 +105,8 @@ public class CampaignItemModel { ...@@ -105,8 +105,8 @@ public class CampaignItemModel {
105 } 105 }
106 106
107 public init(dictionary: [String: Any]) { 107 public init(dictionary: [String: Any]) {
108 - self.index_url = cleanEscapedUrl(dictionary["index_url"] as? String? ?? "") 108 + self.index_url = CampaignItemModel.cleanEscapedUrl(dictionary["index_url"] as? String? ?? "")
109 - self.logo_url = cleanEscapedUrl(dictionary["logo_url"] as? String? ?? "") 109 + self.logo_url = CampaignItemModel.cleanEscapedUrl(dictionary["logo_url"] as? String? ?? "")
110 self.offer_category = dictionary["communication_category"] as? String? ?? "" 110 self.offer_category = dictionary["communication_category"] as? String? ?? ""
111 self.title = dictionary["title"] as? String? ?? "" 111 self.title = dictionary["title"] as? String? ?? ""
112 self.subtitle = dictionary["subtitle"] as? String? ?? "" 112 self.subtitle = dictionary["subtitle"] as? String? ?? ""
...@@ -159,16 +159,16 @@ public class CampaignItemModel { ...@@ -159,16 +159,16 @@ public class CampaignItemModel {
159 self.type = extra_fields["type"] as? String? ?? "" 159 self.type = extra_fields["type"] as? String? ?? ""
160 self.carousel = extra_fields["carousel"] as? String? ?? "false" 160 self.carousel = extra_fields["carousel"] as? String? ?? "false"
161 self.category_title = extra_fields["category_title"] as? String ?? "" 161 self.category_title = extra_fields["category_title"] as? String ?? ""
162 - self.banner_img = cleanEscapedUrl(extra_fields["Banner_img"] as? String ?? "") 162 + self.banner_img = CampaignItemModel.cleanEscapedUrl(extra_fields["Banner_img"] as? String ?? "")
163 self.banner_title = extra_fields["Banner_title"] as? String ?? "" 163 self.banner_title = extra_fields["Banner_title"] as? String ?? ""
164 self.category_id = extra_fields["category_id"] as? String ?? "" 164 self.category_id = extra_fields["category_id"] as? String ?? ""
165 self.filter = extra_fields["filter"] as? String ?? "" 165 self.filter = extra_fields["filter"] as? String ?? ""
166 self.show_expiration = extra_fields["show_expiration"] as? String? ?? "false" 166 self.show_expiration = extra_fields["show_expiration"] as? String? ?? "false"
167 - self.coupon_img = cleanEscapedUrl(extra_fields["coupon_img"] as? String? ?? "") 167 + self.coupon_img = CampaignItemModel.cleanEscapedUrl(extra_fields["coupon_img"] as? String? ?? "")
168 168
169 // Parse new extra_fields with URL cleaning 169 // Parse new extra_fields with URL cleaning
170 - self.campaign_url = cleanEscapedUrl(extra_fields["campaign_url"] as? String? ?? "") 170 + self.campaign_url = CampaignItemModel.cleanEscapedUrl(extra_fields["campaign_url"] as? String? ?? "")
171 - self.banner_img_mobile = cleanEscapedUrl(extra_fields["banner_img_mobile"] as? String? ?? "") 171 + self.banner_img_mobile = CampaignItemModel.cleanEscapedUrl(extra_fields["banner_img_mobile"] as? String? ?? "")
172 } else { 172 } else {
173 self.subcategory = "" 173 self.subcategory = ""
174 self.loyaltyCampaignId = "" 174 self.loyaltyCampaignId = ""
......