Fix: handle sms: and tel: links and support regular navigations#5
Fix: handle sms: and tel: links and support regular navigations#5Coleton (Locrian24) wants to merge 2 commits into
sms: and tel: links and support regular navigations#5Conversation
…egular navigations The WebView previously only handled mailto: (and only for target="_blank" navigations via WKUIDelegate). This adds WKNavigationDelegate with decidePolicyFor to intercept mailto:, sms:, and tel: links on all navigations, handing them off to the OS. The existing createWebViewWith handler now only covers http/https new-window navigations to avoid double-opening external scheme URLs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates SaaSquatchWebView’s navigation handling so mailto:, sms:, and tel: links are intercepted on all navigations and opened via the OS, while keeping target="_blank" http/https navigations opening externally.
Changes:
- Add
WKNavigationDelegateand adecidePolicyForimplementation to interceptmailto:,sms:, andtel:schemes. - Restrict
createWebViewWithhandling to only http/https new-window navigations to avoid double-opening external scheme URLs.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if let url = navigationAction.request.url, | ||
| let scheme = url.scheme, | ||
| Self.externalSchemes.contains(scheme) { | ||
| UIApplication.shared.open(url) |
There was a problem hiding this comment.
URL.scheme is case-insensitive by spec, but the externalSchemes lookup is currently case-sensitive. This can fail to intercept links like TEL:/MailTo: coming from HTML. Consider normalizing the scheme (e.g., compare scheme.lowercased() against the set) before checking membership.
…="_blank" links WKWebView skips decidePolicyFor entirely for target="_blank" navigations, routing them directly to createWebViewWith. External schemes (mailto, sms, tel) must be handled in both delegates to cover both navigation paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Coleton (@Locrian24) We are running into this exact issue while integrating the Impact SDK into our iOS app. Do you have any idea what you'd expect the turnaround time to be on getting this fix merged? |
Description of the change
The WebView previously only handled mailto: (and only for target="_blank" navigations via WKUIDelegate). This adds WKNavigationDelegate with decidePolicyFor to intercept mailto:, sms:, and tel: links on all navigations, handing them off to the OS. The existing createWebViewWith handler now only covers http/https new-window navigations to avoid double-opening external scheme URLs.
Type of change
Links
Checklists
Development
Paperwork
Code review