Launch Safari when web preview is tapped. Issue #1090
This commit is contained in:
parent
f4d58bd7a7
commit
608da70e8e
|
@ -101,6 +101,7 @@ class ArticleViewController: UIViewController {
|
|||
self.webView = webView
|
||||
self.webViewContainer.addChildAndPin(webView)
|
||||
webView.navigationDelegate = self
|
||||
webView.uiDelegate = self
|
||||
|
||||
// Even though page.html should be loaded into this webview, we have to do it again
|
||||
// to work around this bug: http://www.openradar.me/22855188
|
||||
|
@ -325,6 +326,17 @@ extension ArticleViewController: WKNavigationDelegate {
|
|||
|
||||
}
|
||||
|
||||
// MARK: WKUIDelegate
|
||||
|
||||
extension ArticleViewController: WKUIDelegate {
|
||||
func webView(_ webView: WKWebView, contextMenuForElement elementInfo: WKContextMenuElementInfo, willCommitWithAnimator animator: UIContextMenuInteractionCommitAnimating) {
|
||||
// We need to have at least an unimplemented WKUIDelegate assigned to the WKWebView. This makes the
|
||||
// link preview launch Safari when the link preview is tapped. In theory, you shoud be able to get
|
||||
// the link from the elementInfo above and transition to SFSafariViewController instead of launching
|
||||
// Safari. As the time of this writing, the link in elementInfo is always nil. ¯\_(ツ)_/¯
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Private
|
||||
|
||||
private extension ArticleViewController {
|
||||
|
|
Loading…
Reference in New Issue