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-08-02 15:17:21 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
40eed66f710bf4b4fcc6a39f0a945a269a010da3
40eed66f
1 parent
61578d7f
add sorting to campaigns
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
7 deletions
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
40eed66
...
...
@@ -179,7 +179,7 @@ public class swiftApi {
self
.
description
=
dictionary
[
"description"
]
as?
String
?
??
""
self
.
short_description
=
dictionary
[
"short_description"
]
as?
String
?
??
""
self
.
discount
=
dictionary
[
"discount"
]
as?
String
?
??
""
self
.
sorting
=
dictionary
[
"sorting"
]
as?
Int
?
??
nil
self
.
sorting
=
dictionary
[
"sorting"
]
as?
Int
?
??
0
self
.
inner_text
=
dictionary
[
"inner_text"
]
as?
String
?
??
""
self
.
buyable
=
dictionary
[
"buyable"
]
as?
Bool
?
??
false
self
.
visible
=
dictionary
[
"visible"
]
as?
Bool
?
??
false
...
...
@@ -523,7 +523,7 @@ public class swiftApi {
// self.campaign_type_settings = [String: Any]()
self
.
couponset
=
""
self
.
type
=
""
self
.
sorting
=
nil
self
.
sorting
=
0
}
public
init
(
dictionary
:
[
String
:
Any
])
{
...
...
@@ -537,7 +537,7 @@ public class swiftApi {
self
.
message
=
dictionary
[
"message"
]
as?
String
?
??
""
self
.
loyaltyPackageId
=
""
self
.
campaign_type
=
dictionary
[
"campaign_type"
]
as?
String
?
??
""
self
.
sorting
=
dictionary
[
"sorting"
]
as?
Int
?
??
nil
self
.
sorting
=
dictionary
[
"sorting"
]
as?
Int
?
??
0
// let extra_fields = dictionary["extra_fields"] as? [String: Any]? ?? ["":""]
if
let
extra_fields
=
dictionary
[
"extra_fields"
]
as?
[
String
:
Any
]
{
...
...
@@ -745,7 +745,12 @@ public class swiftApi {
return
(
!
isCcmsOffer
)
}
getCampaignsCallback
(
filteredCampaigns
);
let
sortedCampaigns
=
filteredCampaigns
.
sorted
{
$0
.
_sorting
<
$1
.
_sorting
}
getCampaignsCallback
(
sortedCampaigns
);
}
func
campaignsFailureCallback
(
_
error
:
Error
?)
->
Void
{
...
...
@@ -810,7 +815,11 @@ public class swiftApi {
filteredCampaigns
=
filteredCampaigns
.
filter
{
$0
.
offer_category
!=
"questionnaire"
}
}
getCampaignsCallback
(
filteredCampaigns
);
let
sortedCampaigns
=
filteredCampaigns
.
sorted
{
$0
.
_sorting
<
$1
.
_sorting
}
getCampaignsCallback
(
sortedCampaigns
);
})
}
else
{
...
...
@@ -2760,7 +2769,11 @@ public class swiftApi {
// }
// }
GlobalVariables
.
campaigns
=
campaigns
let
sortedCampaigns
=
campaigns
.
sorted
{
$0
.
_sorting
<
$1
.
_sorting
}
GlobalVariables
.
campaigns
=
sortedCampaigns
}
...
...
@@ -2900,7 +2913,11 @@ public class swiftApi {
// }
// }
GlobalVariables
.
campaigns
=
campaigns
let
sortedCampaigns
=
campaigns
.
sorted
{
$0
.
_sorting
<
$1
.
_sorting
}
GlobalVariables
.
campaigns
=
sortedCampaigns
}
...
...
Please
register
or
login
to post a comment