Skip to content

Commit

Permalink
fix uidlegate
Browse files Browse the repository at this point in the history
  • Loading branch information
bparrishMines committed Dec 19, 2024
1 parent 644c204 commit 56d57b4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ extension NavigationDelegateImpl {
registrar.dispatchOnMainThread { onFailure in
self.api.decidePolicyForNavigationResponse(
pigeonInstance: self, webView: webView, navigationResponse: navigationResponse
) { @MainActor result in
) { result in
DispatchQueue.main.async {
switch result {
case .success(let policy):
Expand Down Expand Up @@ -161,7 +161,7 @@ extension NavigationDelegateImpl {
registrar.dispatchOnMainThread { onFailure in
self.api.didReceiveAuthenticationChallenge(
pigeonInstance: self, webView: webView, challenge: challenge
) { @MainActor result in
) { result in
DispatchQueue.main.async {
switch result {
case .success(let response):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,22 @@ extension UIDelegateImpl {
self.api.requestMediaCapturePermission(
pigeonInstance: self, webView: webView, origin: origin, frame: frame,
type: wrapperCaptureType
) { @MainActor result in
switch result {
case .success(let decision):
switch decision {
case .deny:
) { result in
DispatchQueue.main.async {
switch result {
case .success(let decision):
switch decision {
case .deny:
decisionHandler(.deny)
case .grant:
decisionHandler(.grant)
case .prompt:
decisionHandler(.prompt)
}
case .failure(let error):
decisionHandler(.deny)
case .grant:
decisionHandler(.grant)
case .prompt:
decisionHandler(.prompt)
onFailure("WKUIDelegate.requestMediaCapturePermission", error)
}
case .failure(let error):
decisionHandler(.deny)
onFailure("WKUIDelegate.requestMediaCapturePermission", error)
}
}
}
Expand All @@ -81,11 +83,13 @@ extension UIDelegateImpl {
registrar.dispatchOnMainThread { onFailure in
self.api.runJavaScriptAlertPanel(
pigeonInstance: self, webView: webView, message: message, frame: frame
) { @MainActor result in
if case .failure(let error) = result {
onFailure("WKUIDelegate.runJavaScriptAlertPanel", error)
) { result in
DispatchQueue.main.async {
if case .failure(let error) = result {
onFailure("WKUIDelegate.runJavaScriptAlertPanel", error)
}
completionHandler()
}
completionHandler()
}
}
}
Expand All @@ -97,13 +101,15 @@ extension UIDelegateImpl {
registrar.dispatchOnMainThread { onFailure in
self.api.runJavaScriptConfirmPanel(
pigeonInstance: self, webView: webView, message: message, frame: frame
) { @MainActor result in
switch result {
case .success(let confirmed):
completionHandler(confirmed)
case .failure(let error):
completionHandler(false)
onFailure("WKUIDelegate.runJavaScriptConfirmPanel", error)
) { result in
DispatchQueue.main.async {
switch result {
case .success(let confirmed):
completionHandler(confirmed)
case .failure(let error):
completionHandler(false)
onFailure("WKUIDelegate.runJavaScriptConfirmPanel", error)
}
}
}
}
Expand All @@ -118,13 +124,15 @@ extension UIDelegateImpl {
self.api.runJavaScriptTextInputPanel(
pigeonInstance: self, webView: webView, prompt: prompt, defaultText: defaultText,
frame: frame
) { @MainActor result in
switch result {
case .success(let response):
completionHandler(response)
case .failure(let error):
completionHandler(nil)
onFailure("WKUIDelegate.runJavaScriptTextInputPanel", error)
) { result in
DispatchQueue.main.async {
switch result {
case .success(let response):
completionHandler(response)
case .failure(let error):
completionHandler(nil)
onFailure("WKUIDelegate.runJavaScriptTextInputPanel", error)
}
}
}
}
Expand Down

0 comments on commit 56d57b4

Please sign in to comment.