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-27 19:11:05 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4c482aa7a74f8180846fdca4526743cc6fa3c1b1
4c482aa7
1 parent
07d60ace
add CampaignViewController events
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
6 deletions
SwiftWarplyFramework/SwiftWarplyFramework/CampaignViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/CampaignViewController.swift
View file @
4c482aa
...
...
@@ -29,26 +29,50 @@ import SwiftEventBus
}
public
func
userContentController
(
_
userContentController
:
WKUserContentController
,
didReceive
message
:
WKScriptMessage
)
{
print
(
"=== event callback ==="
)
print
(
message
.
name
,
message
.
body
)
print
(
"=== event callback ==="
)
if
let
event
=
message
.
body
as?
String
{
let
eventArray
=
event
.
split
(
separator
:
":"
)
if
(
eventArray
[
0
]
==
"event"
)
{
if
(
eventArray
[
1
]
==
"closeArtwork"
)
{
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
else
if
(
eventArray
[
1
]
==
"addUserTag"
)
{
let
questionnaireEvent
=
swiftApi
.
QuestionnaireEventModel
()
questionnaireEvent
.
_name
=
String
(
eventArray
[
0
])
questionnaireEvent
.
_parameter
=
String
(
eventArray
[
1
])
questionnaireEvent
.
_name
=
String
(
eventArray
[
1
])
questionnaireEvent
.
_parameter
=
String
(
eventArray
[
2
])
SwiftEventBus
.
post
(
"questionnaire"
,
sender
:
questionnaireEvent
)
swiftApi
()
.
setUserTag
(
String
(
eventArray
[
2
]))
}
else
if
(
eventArray
[
1
]
==
"couponRetrieved"
)
{
let
couponEvent
=
swiftApi
.
CouponEventModel
()
SwiftEventBus
.
post
(
"coupon_retrieved"
,
sender
:
couponEvent
)
}
else
if
(
eventArray
[
2
]
==
"serviceDisabled"
)
{
let
pacingService
=
swiftApi
.
WarplyPacingCardServiceEnabledModel
()
pacingService
.
_isEnabled
=
false
SwiftEventBus
.
post
(
"pacing_service"
,
sender
:
pacingService
)
}
else
if
(
eventArray
[
2
]
==
"serviceEnabled"
)
{
let
pacingService
=
swiftApi
.
WarplyPacingCardServiceEnabledModel
()
pacingService
.
_isEnabled
=
true
SwiftEventBus
.
post
(
"pacing_service"
,
sender
:
pacingService
)
}
else
if
(
eventArray
[
2
]
==
"shortcutEnabled"
)
{
let
pacingEvent
=
swiftApi
.
WarplyPacingCardEventModel
()
pacingEvent
.
_isVisible
=
true
SwiftEventBus
.
post
(
"pacing_visible"
,
sender
:
pacingEvent
)
}
else
if
(
eventArray
[
2
]
==
"shortcutDisabled"
)
{
let
pacingEvent
=
swiftApi
.
WarplyPacingCardEventModel
()
pacingEvent
.
_isVisible
=
false
SwiftEventBus
.
post
(
"pacing_visible"
,
sender
:
pacingEvent
)
}
else
if
(
eventArray
[
1
]
==
"request"
||
eventArray
[
1
]
==
"response"
)
{
print
(
"**************** WARPLY Webview Log START *****************"
)
print
(
eventArray
[
2
])
print
(
"**************** WARPLY Webview Log END *****************"
)
}
}
}
...
...
Please
register
or
login
to post a comment