Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
fix: Fix webkit crash in course discovery (#1658)
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedbashir committed Jul 26, 2022
1 parent 8a1cace commit 7b867ac
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Source/DiscoveryWebViewHelper.swift
Expand Up @@ -200,7 +200,10 @@ extension DiscoveryWebViewHelper: WKNavigationDelegate {
let capturedLink = navigationAction.navigationType == .linkActivated
let outsideLink = (request.mainDocumentURL?.host != self.request?.url?.host)
if let url = request.url, outsideLink || capturedLink {
guard let contrller = delegate?.webViewContainingController(), UIApplication.shared.canOpenURL(url) else { return }
guard let contrller = delegate?.webViewContainingController(), UIApplication.shared.canOpenURL(url) else {
decisionHandler(.cancel)
return
}
environment.analytics.trackEvent(with: .DiscoverExternalLinkOpenAlert, name: .DiscoverExternalLinkOpenAlert, category: .Discovery, info: ["url" : url.absoluteString])
let alertController = UIAlertController().showAlert(withTitle: Strings.leavingAppTitle, message: Strings.leavingAppMessage(platformName: environment.config.platformName()), cancelButtonTitle: nil, onViewController: contrller) { _, _, _ in }

Expand Down

0 comments on commit 7b867ac

Please sign in to comment.