Skip to content

Commit

Permalink
Merge pull request #5 from HubSpot/remove-duplicate-delegate
Browse files Browse the repository at this point in the history
Remove duplicate method preventing compile.
  • Loading branch information
jasonconnery authored May 22, 2024
2 parents 529300e + ac1a894 commit d90077c
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions Sources/HubspotMobileSDK/Views/ChatView/HubspotChatView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -407,30 +407,6 @@ struct HubspotChatWebView: UIViewRepresentable {
return .allow
}
}

func webView(_: WKWebView, decidePolicyFor navigationAction: WKNavigationAction) async -> WKNavigationActionPolicy {
// Most navigations are allowed, as that matches default behaviour. But for links specifically, we do additional checks
switch navigationAction.navigationType {
case .linkActivated:
if navigationAction.targetFrame?.isMainFrame ?? false {
// For links specifically targeting the main frame, lets assume that's intentional to replace chat?
// If links are incorrectly being sent targeting the main frame handle it like the else branch for all link activated
return .allow
} else if let url = navigationAction.request.url {
// A link not targeting the main frame would be a pop up, other tab type attempt at opening. Use the system open URL and cancel any nav within the webview
urlHandler(url)
return .cancel
} else {
// Not sure what the link type would be without a url - whatever it is , just default to allowing it
return .allow
}

case .formSubmitted, .backForward, .reload, .formResubmitted, .other:
return .allow
@unknown default:
return .allow
}
}
}
}

Expand Down

0 comments on commit d90077c

Please sign in to comment.