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:02:04 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e16ba816b07d09a8ec2277929e9c0508341507b3
e16ba816
1 parent
6aaafc44
fixed CampaignItemModel urls
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
SwiftWarplyFramework/SwiftWarplyFramework/models/Campaign.swift
SwiftWarplyFramework/SwiftWarplyFramework/models/Campaign.swift
View file @
e16ba81
...
...
@@ -13,6 +13,13 @@ import Foundation
public
class
CampaignItemModel
{
public
let
index_url
:
String
?
public
var
logo_url
:
String
?
// MARK: - URL Cleaning Helper
/// Cleans escaped forward slashes from URLs (e.g., "https:\/\/example.com" -> "https://example.com")
private
func
cleanEscapedUrl
(
_
url
:
String
?)
->
String
?
{
return
url
?
.
replacingOccurrences
(
of
:
"
\\
/"
,
with
:
"/"
)
}
public
let
offer_category
:
String
?
public
var
title
:
String
?
public
var
subtitle
:
String
?
...
...
@@ -98,8 +105,8 @@ public class CampaignItemModel {
}
public
init
(
dictionary
:
[
String
:
Any
])
{
self
.
index_url
=
dictionary
[
"index_url"
]
as?
String
?
??
""
self
.
logo_url
=
dictionary
[
"logo_url"
]
as?
String
?
??
""
self
.
index_url
=
cleanEscapedUrl
(
dictionary
[
"index_url"
]
as?
String
?
??
""
)
self
.
logo_url
=
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
?
??
""
...
...
@@ -152,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
=
extra_fields
[
"Banner_img"
]
as?
String
??
""
self
.
banner_img
=
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
=
extra_fields
[
"coupon_img"
]
as?
String
?
??
""
self
.
coupon_img
=
cleanEscapedUrl
(
extra_fields
[
"coupon_img"
]
as?
String
?
??
""
)
// Parse new extra_fields
self
.
campaign_url
=
extra_fields
[
"campaign_url"
]
as?
String
?
??
""
self
.
banner_img_mobile
=
extra_fields
[
"banner_img_mobile"
]
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
?
??
""
)
}
else
{
self
.
subcategory
=
""
self
.
loyaltyCampaignId
=
""
...
...
Please
register
or
login
to post a comment