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
2024-04-10 18:23:37 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a080d3144c53b315cfb692b21a134e2cc32f8d1f
a080d314
1 parent
0fccc0e7
fix WebviewVC (add webviewDidFocusRefresh script)
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletions
SwiftWarplyFramework/SwiftWarplyFramework/CampaignViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/CampaignViewController.swift
View file @
a080d31
...
...
@@ -30,6 +30,7 @@ var timer2: DispatchSourceTimer?
var
listenersCount
=
0
;
var
webViewLoaded
:
Bool
=
false
var
mWebviewSupermarket
:
Bool
=
false
public
override
func
loadView
()
{
super
.
loadView
();
...
...
@@ -95,6 +96,10 @@ var timer2: DispatchSourceTimer?
sendWebviewDidFocus
()
}
if
(
mWebviewSupermarket
)
{
sendWebviewDidFocusRefresh
()
}
}
public
override
func
viewWillDisappear
(
_
animated
:
Bool
)
{
...
...
@@ -142,6 +147,7 @@ var timer2: DispatchSourceTimer?
// Handle code when the application is about to enter the foreground
sendWebviewDidFocus
()
sendWebviewDidFocusRefresh
()
}
@objc
func
applicationDidEnterBackground
()
{
...
...
@@ -162,6 +168,18 @@ var timer2: DispatchSourceTimer?
})
}
func
sendWebviewDidFocusRefresh
()
{
let
scriptSource2
=
"webviewDidFocusRefresh(
\(
self
.
webviewDidFocusRefresh
)
);"
webView
.
evaluateJavaScript
(
scriptSource2
,
completionHandler
:
{
(
object
,
error
)
in
self
.
mWebviewSupermarket
=
false
// print("==== webviewDidFocus object ====")
// print(object)
// print("==== webviewDidFocus error ====")
// print(error)
})
}
func
addApplicationObservers
()
{
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
applicationWillEnterForeground
)
,
name
:
UIApplication
.
willEnterForegroundNotification
,
object
:
nil
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
applicationDidEnterBackground
)
,
name
:
UIApplication
.
didEnterBackgroundNotification
,
object
:
nil
)
...
...
@@ -493,7 +511,7 @@ var timer2: DispatchSourceTimer?
if
(
eventArray
[
0
]
==
"event"
)
{
if
(
eventArray
[
1
]
==
"closeArtwork"
)
{
self
.
mWebviewSupermarket
=
false
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
else
if
(
eventArray
[
1
]
==
"addUserTag"
)
{
...
...
@@ -842,6 +860,9 @@ var timer2: DispatchSourceTimer?
}
}
}
else
if
(
eventArray
[
1
]
==
"webviewRefresh"
)
{
self
.
mWebviewSupermarket
=
true
}
}
...
...
Please
register
or
login
to post a comment