Skip to content

Commit

Permalink
fix(ios): only open a URL when the application is active (#3328)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikeith authored Jul 24, 2020
1 parent 27a8bcb commit 8d7c58b
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 @@ -311,7 +311,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 8d7c58b

Please # to comment.