Skip to content

Commit

Permalink
fix(ios): only open a URL when the application is active (#3382)
Browse files Browse the repository at this point in the history
Co-authored-by: Ian Keith <iankeith@gmail.com>
  • Loading branch information
imhoffd and ikeith committed Aug 4, 2020
1 parent b92a887 commit f1792ff
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ios/Capacitor/Capacitor/CAPBridgeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ public class CAPBridgeViewController: UIViewController, CAPBridgeDelegate, WKScr
}

if navUrl.absoluteString.range(of: hostname!) == nil && (navigationAction.targetFrame == nil || (navigationAction.targetFrame?.isMainFrame)!) {
UIApplication.shared.open(navUrl, options: [:], completionHandler: nil)
if UIApplication.shared.applicationState == .active {
UIApplication.shared.open(navUrl, options: [:], completionHandler: nil)
}
decisionHandler(.cancel)
return
}
Expand Down

0 comments on commit f1792ff

Please sign in to comment.