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-07-25 15:09:50 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0bd0ed9360c7a4fed11d0b17159f1ca6675a4fed
0bd0ed93
1 parent
5ba0354f
fix questionnaire campaign disappear after answer
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
3 deletions
SwiftWarplyFramework/SwiftWarplyFramework/CampaignViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/CampaignViewController.swift
View file @
0bd0ed9
...
...
@@ -41,6 +41,27 @@ import SwiftEventBus
if
(
eventArray
[
0
]
==
"event"
)
{
if
(
eventArray
[
1
]
==
"closeArtwork"
)
{
swiftApi
()
.
getProfileAsync
(
getProfileCallback
)
func
getProfileCallback
(
_
profileData
:
swiftApi
.
ProfileModel
?)
->
Void
{
if
(
profileData
!=
nil
)
{
DispatchQueue
.
main
.
async
{
swiftApi
()
.
getCampaignsAsyncNew
(
language
:
"en"
,
filters
:
[
String
:
Any
](),
getCampaignsCallback
)
func
getCampaignsCallback
(
_
campaignsData
:
Array
<
swiftApi
.
CampaignItemModel
>
?)
->
Void
{
if
(
campaignsData
!=
nil
)
{
DispatchQueue
.
main
.
async
{
}
}
else
{
}
}
}
}
else
{
}
}
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
else
if
(
eventArray
[
1
]
==
"addUserTag"
)
{
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
0bd0ed9
...
...
@@ -797,13 +797,18 @@ public class swiftApi {
SwiftEventBus
.
post
(
"campaigns_retrieved"
)
let
filteredCampaigns
=
campaignsArray
.
filter
{
var
filteredCampaigns
=
campaignsArray
.
filter
{
let
tempCampaign
=
$0
let
isCcmsOffer
=
(
tempCampaign
.
ccms_offer
!=
nil
)
&&
(
tempCampaign
.
ccms_offer
!=
""
)
&&
(
tempCampaign
.
ccms_offer
==
"true"
)
let
isTelco
=
(
tempCampaign
.
_type
!=
nil
&&
tempCampaign
.
_type
==
"telco"
)
return
(
!
(
isCcmsOffer
||
isTelco
))
}
if
(
swiftApi
()
.
getConsumer
()?
.
answered
==
true
)
{
filteredCampaigns
=
filteredCampaigns
.
filter
{
$0
.
offer_category
!=
"questionnaire"
}
}
getCampaignsCallback
(
filteredCampaigns
);
})
...
...
@@ -1400,6 +1405,7 @@ public class swiftApi {
// profile_metadata
public
let
badge
:
String
?
public
let
msisdnList
:
Array
<
String
>
?
public
let
answered
:
Bool
?
public
init
()
{
...
...
@@ -1441,6 +1447,7 @@ public class swiftApi {
// profile_metadata
self
.
badge
=
""
self
.
msisdnList
=
[]
self
.
answered
=
false
}
public
init
(
dictionary
:
[
String
:
Any
])
{
...
...
@@ -1491,16 +1498,19 @@ public class swiftApi {
self
.
profile_metadata
=
profile_metadata_parsed
as?
[
String
:
Any
]?
??
[
String
:
Any
]()
self
.
badge
=
profile_metadata_parsed
[
"badge"
]
as?
String
?
??
""
self
.
msisdnList
=
profile_metadata_parsed
[
"msisdnList"
]
as?
Array
<
String
>
?
??
[]
self
.
answered
=
profile_metadata_parsed
[
"answered"
]
as?
Bool
?
??
false
}
else
{
self
.
profile_metadata
=
[
String
:
Any
]()
self
.
badge
=
""
self
.
msisdnList
=
[]
self
.
answered
=
false
print
(
"bad json"
)
}
}
catch
let
error
as
NSError
{
self
.
profile_metadata
=
[
String
:
Any
]()
self
.
badge
=
""
self
.
msisdnList
=
[]
self
.
answered
=
false
print
(
error
)
}
...
...
@@ -2735,11 +2745,16 @@ public class swiftApi {
public
func
getCampaignList
()
->
Array
<
CampaignItemModel
>
{
let
filteredCampaigns
=
GlobalVariables
.
campaigns
.
filter
{
var
filteredCampaigns
=
GlobalVariables
.
campaigns
.
filter
{
let
tempCampaign
=
$0
let
isCcmsOffer
=
(
tempCampaign
.
ccms_offer
!=
nil
)
&&
(
tempCampaign
.
ccms_offer
!=
""
)
&&
(
tempCampaign
.
ccms_offer
==
"true"
)
let
isTelco
=
(
tempCampaign
.
_type
!=
nil
&&
tempCampaign
.
_type
==
"telco"
)
return
(
!
isCcmsOffer
)
return
(
!
(
isCcmsOffer
||
isTelco
))
}
if
(
swiftApi
()
.
getConsumer
()?
.
answered
==
true
)
{
filteredCampaigns
=
filteredCampaigns
.
filter
{
$0
.
offer_category
!=
"questionnaire"
}
}
return
filteredCampaigns
...
...
Please
register
or
login
to post a comment