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-02-26 10:24:55 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
021349162fce4fcbdac80077edec138b94ea9106
02134916
1 parent
3e1f4ddb
add webviewDidFocus at CampaignViewController
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
4 deletions
SwiftWarplyFramework/SwiftWarplyFramework/CampaignViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/CampaignViewController.swift
View file @
0213491
...
...
@@ -28,6 +28,8 @@ var timer2: DispatchSourceTimer?
var
webView
:
WKWebView
!
var
locationManager
:
CLLocationManager
!
var
listenersCount
=
0
;
var
webViewLoaded
:
Bool
=
false
public
override
func
loadView
()
{
super
.
loadView
();
...
...
@@ -85,6 +87,18 @@ var timer2: DispatchSourceTimer?
}
else
{
self
.
navigationController
?
.
hideHairline
()
}
if
(
webViewLoaded
)
{
let
scriptSource2
=
"webviewDidFocus(
\(
self
.
webViewLoaded
)
);"
webView
.
evaluateJavaScript
(
scriptSource2
,
completionHandler
:
{
(
object
,
error
)
in
// print("==== object viewWillAppear ====")
// print(object)
// print("==== error viewWillAppear ====")
// print(error)
})
}
}
public
override
func
viewWillDisappear
(
_
animated
:
Bool
)
{
...
...
@@ -158,10 +172,10 @@ var timer2: DispatchSourceTimer?
let
scriptSource
=
"passMeters(
\(
metersParam
)
);"
self
?
.
webview
.
evaluateJavaScript
(
scriptSource
,
completionHandler
:
{
(
object
,
error
)
in
// print("==== object
====")
//
print(object)
// print("==== error
====")
//
print(error)
// print("==== object passMeters
====")
//
print(object)
// print("==== error passMeters
====")
//
print(error)
swiftApi
()
.
setSavedStepsWebview
(
swiftApi
()
.
getSavedStepsWebview
()
+
swiftApi
()
.
getStepsWebview
())
swiftApi
()
.
setStepsWebview
(
0
)
...
...
@@ -336,6 +350,7 @@ var timer2: DispatchSourceTimer?
// MARK: - WKNavigationDelegate
public
func
webView
(
_
webView
:
WKWebView
,
didFinish
navigation
:
WKNavigation
!
)
{
self
.
webViewLoaded
=
true
let
scriptSource
=
"passParams(
\(
params
)
);"
...
...
@@ -349,7 +364,15 @@ var timer2: DispatchSourceTimer?
self
.
startTimer
()
}
})
let
scriptSource2
=
"webviewDidFocus(
\(
self
.
webViewLoaded
)
);"
webView
.
evaluateJavaScript
(
scriptSource2
,
completionHandler
:
{
(
object
,
error
)
in
// print("==== object webView ====")
// print(object)
// print("==== error webView ====")
// print(error)
})
}
public
func
webView
(
_
webView
:
WKWebView
,
decidePolicyFor
navigationAction
:
WKNavigationAction
,
decisionHandler
:
@escaping
(
WKNavigationActionPolicy
)
->
Void
)
{
...
...
Please
register
or
login
to post a comment