Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_sdk_framework
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Manos Chorianopoulos
2025-07-21 18:06:00 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8c0fc0a9e77408c23d76ecd49675914beab0bdd3
8c0fc0a9
1 parent
e16ba816
CampaignItemModel fixes
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
SwiftWarplyFramework/SwiftWarplyFramework/models/Campaign.swift
SwiftWarplyFramework/SwiftWarplyFramework/models/Campaign.swift
View file @
8c0fc0a
...
...
@@ -17,7 +17,7 @@ public class CampaignItemModel {
// MARK: - URL Cleaning Helper
/// Cleans escaped forward slashes from URLs (e.g., "https:\/\/example.com" -> "https://example.com")
private
func
cleanEscapedUrl
(
_
url
:
String
?)
->
String
?
{
private
static
func
cleanEscapedUrl
(
_
url
:
String
?)
->
String
?
{
return
url
?
.
replacingOccurrences
(
of
:
"
\\
/"
,
with
:
"/"
)
}
public
let
offer_category
:
String
?
...
...
@@ -105,8 +105,8 @@ public class CampaignItemModel {
}
public
init
(
dictionary
:
[
String
:
Any
])
{
self
.
index_url
=
cleanEscapedUrl
(
dictionary
[
"index_url"
]
as?
String
?
??
""
)
self
.
logo_url
=
cleanEscapedUrl
(
dictionary
[
"logo_url"
]
as?
String
?
??
""
)
self
.
index_url
=
CampaignItemModel
.
cleanEscapedUrl
(
dictionary
[
"index_url"
]
as?
String
?
??
""
)
self
.
logo_url
=
CampaignItemModel
.
cleanEscapedUrl
(
dictionary
[
"logo_url"
]
as?
String
?
??
""
)
self
.
offer_category
=
dictionary
[
"communication_category"
]
as?
String
?
??
""
self
.
title
=
dictionary
[
"title"
]
as?
String
?
??
""
self
.
subtitle
=
dictionary
[
"subtitle"
]
as?
String
?
??
""
...
...
@@ -159,16 +159,16 @@ public class CampaignItemModel {
self
.
type
=
extra_fields
[
"type"
]
as?
String
?
??
""
self
.
carousel
=
extra_fields
[
"carousel"
]
as?
String
?
??
"false"
self
.
category_title
=
extra_fields
[
"category_title"
]
as?
String
??
""
self
.
banner_img
=
cleanEscapedUrl
(
extra_fields
[
"Banner_img"
]
as?
String
??
""
)
self
.
banner_img
=
CampaignItemModel
.
cleanEscapedUrl
(
extra_fields
[
"Banner_img"
]
as?
String
??
""
)
self
.
banner_title
=
extra_fields
[
"Banner_title"
]
as?
String
??
""
self
.
category_id
=
extra_fields
[
"category_id"
]
as?
String
??
""
self
.
filter
=
extra_fields
[
"filter"
]
as?
String
??
""
self
.
show_expiration
=
extra_fields
[
"show_expiration"
]
as?
String
?
??
"false"
self
.
coupon_img
=
cleanEscapedUrl
(
extra_fields
[
"coupon_img"
]
as?
String
?
??
""
)
self
.
coupon_img
=
CampaignItemModel
.
cleanEscapedUrl
(
extra_fields
[
"coupon_img"
]
as?
String
?
??
""
)
// Parse new extra_fields with URL cleaning
self
.
campaign_url
=
cleanEscapedUrl
(
extra_fields
[
"campaign_url"
]
as?
String
?
??
""
)
self
.
banner_img_mobile
=
cleanEscapedUrl
(
extra_fields
[
"banner_img_mobile"
]
as?
String
?
??
""
)
self
.
campaign_url
=
CampaignItemModel
.
cleanEscapedUrl
(
extra_fields
[
"campaign_url"
]
as?
String
?
??
""
)
self
.
banner_img_mobile
=
CampaignItemModel
.
cleanEscapedUrl
(
extra_fields
[
"banner_img_mobile"
]
as?
String
?
??
""
)
}
else
{
self
.
subcategory
=
""
self
.
loyaltyCampaignId
=
""
...
...
Please
register
or
login
to post a comment