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
2022-06-29 15:11:03 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8d546d5584251d235e6cadd799c76799aa9a509b
8d546d55
1 parent
4eb66804
fix CampaignItemModel, setCCMSLoyaltyCampaigns
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
8d546d5
...
...
@@ -76,9 +76,10 @@ public class swiftApi {
let
mergedGFYCampaigns
=
GlobalVariables
.
campaigns
.
filter
{
let
tempCampaign
=
$0
let
isGFY
=
tempCampaign
.
offer_category
==
"gifts_for_you"
let
hasExtraFields
=
tempCampaign
.
hasExtraFields
??
false
let
loyaltyCampaignIdExists
=
ccmsCampaign
.
contains
{
$0
.
_loyaltyCampaignId
==
tempCampaign
.
loyaltyCampaignId
}
return
isGFY
&&
(
!
hasExtraFields
||
loyaltyCampaignIdExists
)
let
hasExtraFields
=
(
tempCampaign
.
hasExtraFields
!=
nil
)
&&
(
tempCampaign
.
hasExtraFields
==
true
)
let
isCcmsOffer
=
(
tempCampaign
.
ccms_offer
!=
nil
)
&&
(
tempCampaign
.
ccms_offer
!=
""
)
&&
(
tempCampaign
.
ccms_offer
==
"true"
)
let
loyaltyCampaignIdExists
=
ccmsCampaign
.
contains
{
$0
.
_loyaltyCampaignId
==
tempCampaign
.
session_uuid
}
return
isGFY
&&
(
!
isCcmsOffer
||
(
isCcmsOffer
&&
loyaltyCampaignIdExists
))
}
GlobalVariables
.
campaigns
=
GlobalVariables
.
campaigns
.
filter
{
$0
.
offer_category
!=
"gifts_for_you"
}
+
mergedGFYCampaigns
...
...
@@ -415,7 +416,7 @@ public class swiftApi {
public
let
message
:
String
?
public
let
loyaltyCampaignId
:
String
?
public
let
hasExtraFields
:
Bool
?
public
let
ccms_offer
:
Bool
?
public
let
ccms_offer
:
String
?
init
(
dictionary
:
[
String
:
Any
])
{
self
.
index_url
=
dictionary
[
"index_url"
]
as?
String
?
??
""
...
...
@@ -439,19 +440,19 @@ public class swiftApi {
self
.
subcategory
=
extra_fields_parsed
[
"subcategory"
]
as?
String
?
??
""
self
.
loyaltyCampaignId
=
extra_fields_parsed
[
"loyaltyCampaignId"
]
as?
String
?
??
""
self
.
hasExtraFields
=
true
self
.
ccms_offer
=
extra_fields_parsed
[
"ccms_offer"
]
as?
Bool
?
??
false
self
.
ccms_offer
=
extra_fields_parsed
[
"ccms_offer"
]
as?
String
?
??
"false"
}
else
{
self
.
subcategory
=
""
self
.
loyaltyCampaignId
=
""
self
.
hasExtraFields
=
false
self
.
ccms_offer
=
false
self
.
ccms_offer
=
"false"
print
(
"bad json"
)
}
}
catch
let
error
as
NSError
{
self
.
subcategory
=
""
self
.
loyaltyCampaignId
=
""
self
.
hasExtraFields
=
false
self
.
ccms_offer
=
false
self
.
ccms_offer
=
"false"
print
(
error
)
}
...
...
Please
register
or
login
to post a comment