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-15 11:33:36 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
45e13731d7bf0d203cd697370841af6b0db2f548
45e13731
1 parent
a3ac3e77
fix pacing campaign opened from widget
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
1 deletions
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
45e1373
...
...
@@ -2843,6 +2843,44 @@ public class swiftApi {
// }
}
public
func
constructCampaignParams
(
_
campaign
:
CampaignItemModel
,
_
from_widget
:
Bool
)
->
String
{
let
instanceOfMyApi
=
MyApi
()
let
campaignInfo
=
instanceOfMyApi
.
provideInfoForCampaign
()
let
jsonObject
:
[
String
:
String
]
=
[
"web_id"
:
(
campaignInfo
?[
"web_id"
]
as!
String
),
"app_uuid"
:
(
campaignInfo
?[
"app_uuid"
]
as!
String
),
"api_key"
:
(
campaignInfo
?[
"api_key"
]
as!
String
),
"session_uuid"
:
(
campaign
.
session_uuid
??
""
),
"access_token"
:
(
campaignInfo
?[
"access_token"
]
as!
String
),
"refresh_token"
:
(
campaignInfo
?[
"refresh_token"
]
as!
String
),
"client_id"
:
(
campaignInfo
?[
"client_id"
]
as!
String
),
"client_secret"
:
(
campaignInfo
?[
"client_secret"
]
as!
String
),
"from_widget"
:
(
from_widget
?
"true"
:
"false"
)
]
let
encoder
=
JSONEncoder
()
encoder
.
outputFormatting
=
.
prettyPrinted
let
data
=
try!
encoder
.
encode
(
jsonObject
)
let
stringData
=
String
(
data
:
data
,
encoding
:
.
utf8
)
??
""
print
(
"constructCampaignParams: "
+
stringData
)
return
stringData
// do {
// let data = try JSONSerialization.data(withJSONObject: jsonObject, options: .prettyPrinted)
// let stringData = String(data: data, encoding: String.Encoding.utf8) ?? ""
// print("constructCampaignParams: " + stringData)
// return stringData
// } catch {
// print("constructCampaignParams: ")
// return ""
// }
}
public
func
constructCcmsParams
(
_
campaign
:
LoyaltyContextualOfferModel
)
->
String
{
...
...
@@ -3440,7 +3478,7 @@ public class swiftApi {
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
let
vc
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"CampaignViewController"
)
as!
SwiftWarplyFramework
.
CampaignViewController
let
url
=
swiftApi
()
.
constructCampaignUrl
(
item
)
let
params
=
swiftApi
()
.
constructCampaignParams
(
item
)
let
params
=
swiftApi
()
.
constructCampaignParams
(
item
,
true
)
print
(
"openPacing url: "
+
url
)
vc
.
campaignUrl
=
url
vc
.
params
=
params
...
...
Please
register
or
login
to post a comment