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
2023-07-13 11:40:57 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3e3c76e270bc66d16a1432c111d1446ab19bdb81
3e3c76e2
1 parent
40d6257d
fix campaign webview deeplinks
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
SwiftWarplyFramework/SwiftWarplyFramework/CampaignViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/CampaignViewController.swift
View file @
3e3c76e
...
...
@@ -146,6 +146,35 @@ var timer2: DispatchSourceTimer?
}
})
}
public
func
webView
(
_
webView
:
WKWebView
,
decidePolicyFor
navigationAction
:
WKNavigationAction
,
decisionHandler
:
@escaping
(
WKNavigationActionPolicy
)
->
Void
)
{
// if(navigationAction.navigationType == .linkActivated) {
if
let
redirectedUrl
=
navigationAction
.
request
.
url
{
// Example Deeplink: https://cosmote.page.link/loyaltyWallet
// Example Deeplink: https://preview.page.link/cosmote.page.link/loyaltyWallet
// Example Deeplink: https://apps.apple.com/app/id482889196?mt=8
if
redirectedUrl
.
absoluteString
.
contains
(
"cosmote.page.link"
)
{
// check if link can be opened.
guard
UIApplication
.
shared
.
canOpenURL
(
redirectedUrl
)
else
{
decisionHandler
(
.
cancel
)
return
}
UIApplication
.
shared
.
open
(
redirectedUrl
,
options
:
[:],
completionHandler
:
nil
)
decisionHandler
(
.
cancel
)
return
}
}
// }
decisionHandler
(
.
allow
)
}
// MARK: - WKScriptMessageHandler
public
func
userContentController
(
_
userContentController
:
WKUserContentController
,
didReceive
message
:
WKScriptMessage
)
{
...
...
Please
register
or
login
to post a comment