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-24 18:52:33 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ca9006ba4468e576d42f735b2bc9dddeb242582d
ca9006ba
1 parent
d66d31d9
add QuestionnaireEventModel and handle Event
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
2 deletions
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
SwiftWarplyFramework/SwiftWarplyFramework/CampaignViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
ca9006b
No preview for this file type
SwiftWarplyFramework/SwiftWarplyFramework/CampaignViewController.swift
View file @
ca9006b
...
...
@@ -8,6 +8,7 @@
import
Foundation
import
UIKit
import
WebKit
import
SwiftEventBus
@objc
public
class
CampaignViewController
:
UIViewController
,
WKNavigationDelegate
,
WKScriptMessageHandler
{
@IBOutlet
weak
var
webview
:
WKWebView
!
...
...
@@ -31,6 +32,26 @@ import WebKit
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"
)
{
}
else
if
(
eventArray
[
1
]
==
"addUserTag"
)
{
let
questionnaireEvent
=
swiftApi
.
QuestionnaireEventModel
()
questionnaireEvent
.
_name
=
String
(
eventArray
[
0
])
questionnaireEvent
.
_parameter
=
String
(
eventArray
[
1
])
SwiftEventBus
.
post
(
"questionnaire"
,
sender
:
questionnaireEvent
)
swiftApi
()
.
setUserTag
(
String
(
eventArray
[
2
]))
}
else
if
(
eventArray
[
1
]
==
"couponRetrieved"
)
{
}
}
}
}
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
ca9006b
...
...
@@ -21,11 +21,11 @@ public class swiftApi {
}
public
func
getUserTag
()
->
String
{
return
GlobalVariables
.
userTag
return
UserDefaults
.
standard
.
string
(
forKey
:
"userTag"
)
??
""
}
public
func
setUserTag
(
_
newUserTag
:
String
)
->
Void
{
GlobalVariables
.
userTag
=
newUserTag
UserDefaults
.
standard
.
set
(
newUserTag
,
forKey
:
"userTag"
)
}
public
class
DFY
{
...
...
@@ -1639,5 +1639,36 @@ public class swiftApi {
public
func
getCampaignList
()
->
Array
<
CampaignItemModel
>
{
return
GlobalVariables
.
campaigns
}
public
class
QuestionnaireEventModel
{
private
var
name
:
String
private
var
parameter
:
String
public
init
()
{
self
.
name
=
""
self
.
parameter
=
""
}
public
var
_name
:
String
{
get
{
// getter
return
self
.
name
}
set
(
newValue
)
{
//setter
self
.
name
=
newValue
}
}
public
var
_parameter
:
String
{
get
{
// getter
return
self
.
parameter
}
set
(
newValue
)
{
//setter
self
.
parameter
=
newValue
}
}
}
}
...
...
Please
register
or
login
to post a comment