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-09-14 17:22:17 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c23ecfd05a8659b4381eaee76e0d6cb842b9f7c0
c23ecfd0
1 parent
5bf29770
Added CarouselList functions and functionality
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
1 deletions
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
c23ecfd
...
...
@@ -28,6 +28,7 @@ public struct GlobalVariables {
static
var
metersWebview
:
Double
=
0.0
static
var
merchantList
:
Array
<
swiftApi
.
MerchantModel
>
=
[]
static
var
trackingStepsEnabled
:
Bool
=
false
static
var
carouselList
:
Array
<
swiftApi
.
CampaignItemModel
>
=
[]
}
var
timer
:
DispatchSourceTimer
?
...
...
@@ -102,6 +103,19 @@ public class swiftApi {
GlobalVariables
.
trackingStepsEnabled
=
newValue
}
public
func
setCarouselList
(
_
campaigns
:
Array
<
CampaignItemModel
>
)
->
Void
{
// let sortedCampaigns = campaigns.sorted {
// ($0._sorting ?? 0) < ($1._sorting ?? 0)
// }
GlobalVariables
.
carouselList
=
campaigns
}
public
func
getCarouselList
()
->
Array
<
CampaignItemModel
>
{
return
GlobalVariables
.
carouselList
}
public
func
startTrackingSteps
(
_
getStepsCallback
:
@escaping
(
_
steps
:
Int
)
->
Void
)
->
Void
{
...
...
@@ -764,6 +778,7 @@ public class swiftApi {
public
var
type
:
String
?
public
var
sorting
:
Int
?
private
var
ccms
:
LoyaltyContextualOfferModel
?
private
var
carousel
:
String
?
public
init
()
{
self
.
index_url
=
""
...
...
@@ -786,6 +801,7 @@ public class swiftApi {
self
.
type
=
""
self
.
sorting
=
0
self
.
ccms
=
nil
self
.
carousel
=
"false"
}
public
init
(
dictionary
:
[
String
:
Any
])
{
...
...
@@ -810,6 +826,7 @@ public class swiftApi {
self
.
ccms_offer
=
extra_fields
[
"ccms_offer"
]
as?
String
?
??
"false"
self
.
badge
=
extra_fields
[
"badge"
]
as?
String
?
??
""
self
.
type
=
extra_fields
[
"type"
]
as?
String
?
??
""
self
.
carousel
=
extra_fields
[
"carousel"
]
as?
String
?
??
"false"
}
else
{
self
.
subcategory
=
""
self
.
loyaltyCampaignId
=
""
...
...
@@ -817,6 +834,7 @@ public class swiftApi {
self
.
ccms_offer
=
"false"
self
.
badge
=
""
self
.
type
=
""
self
.
carousel
=
"false"
}
// let extra_fields = dictionary["extra_fields"] as AnyObject
...
...
@@ -999,6 +1017,15 @@ public class swiftApi {
self
.
ccms
=
newValue
}
}
public
var
_carousel
:
String
?
{
get
{
// getter
return
self
.
carousel
}
set
(
newValue
)
{
//setter
self
.
carousel
=
newValue
}
}
}
public
class
CampaignDataModel
{
...
...
@@ -1067,6 +1094,7 @@ public class swiftApi {
func
campaignsCallback
(
_
campaignsData
:
[
AnyHashable
:
Any
]?)
->
Void
{
var
campaignsArray
:
Array
<
CampaignItemModel
>
=
[]
var
carouselArray
:
Array
<
CampaignItemModel
>
=
[]
if
let
responseDataDictionary
=
campaignsData
as?
[
String
:
AnyObject
]
{
...
...
@@ -1091,7 +1119,13 @@ public class swiftApi {
swiftApi
()
.
setUniqueCampaignList
(
campaignsArray
)
SwiftEventBus
.
post
(
"campaigns_retrieved"
)
carouselArray
=
campaignsArray
.
filter
{
let
tempCampaign
=
$0
let
isCarouselItem
=
(
tempCampaign
.
_carousel
!=
nil
)
&&
(
tempCampaign
.
_carousel
==
"true"
)
return
(
isCarouselItem
)
}
swiftApi
()
.
setCarouselList
(
carouselArray
)
var
filteredCampaigns
=
campaignsArray
.
filter
{
let
tempCampaign
=
$0
...
...
@@ -1110,6 +1144,8 @@ public class swiftApi {
}
getCampaignsCallback
(
sortedCampaigns
);
SwiftEventBus
.
post
(
"campaigns_retrieved"
)
})
}
else
{
...
...
Please
register
or
login
to post a comment