Skip to content

Commit

Permalink
feat(ios): Add new iOS15 media capture permission delegate (#5196)
Browse files Browse the repository at this point in the history
Co-authored-by: jcesarmobile <[email protected]>
  • Loading branch information
samydoesit and jcesarmobile authored Jan 5, 2022
1 parent bf215b1 commit d8b54ac
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ios/Capacitor/Capacitor/WebViewDelegationHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@ internal class WebViewDelegationHandler: NSObject, WKNavigationDelegate, WKUIDel
// Reset the bridge on each navigation
bridge?.reset()
}

// TODO: remove once Xcode 12 support is dropped
#if compiler(>=5.5)
@available(iOS 15, *)
func webView(
_ webView: WKWebView,
requestMediaCapturePermissionFor origin: WKSecurityOrigin,
initiatedByFrame frame: WKFrameInfo,
type: WKMediaCaptureType,
decisionHandler: @escaping (WKPermissionDecision) -> Void
) {
decisionHandler(.grant)
}
#endif

public func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
// post a notification for any listeners
Expand Down

0 comments on commit d8b54ac

Please sign in to comment.