fix(#312): deep linking for widgets, custom URLs, and Universal Links#313
Merged
Conversation
Widget taps opened the app but nothing happened, on every widget size. The app uses the UIKit scene lifecycle (AppDelegate configures a SceneDelegate that hosts SceneView in a UIHostingController), so SwiftUI's .onOpenURL never fires — incoming URLs are delivered to the scene delegate instead. SceneDelegate handled only shortcut items, so the post URL was dropped. Handle URLs in SceneDelegate for both cold launch (connectionOptions .urlContexts) and warm launch (scene(_:openURLContexts:)), routing them into MainViewModel.openDeepLink, which sets deepLinkPostURL and tracks the existing widget deep-link analytics. Co-Authored-By: Claude <noreply@anthropic.com>
Tapping a macmagazine.com.br link in Safari or another app opened the browser instead of the app. The app declared no Associated Domains and handled no browsing-web user activity, so it could not claim its URLs. - Add com.apple.developer.associated-domains (apex + www) to the debug and release entitlements. - Handle Universal Links in SceneDelegate for cold launch (connectionOptions.userActivities) and warm launch (scene(_:continue:)), routing the webpageURL into openDeepLink. - Parameterize MainViewModel.openDeepLink with a source so universal links track distinctly from widget opens. Which URLs open the app (/post/*) is gated server-side by the AASA file; the app trusts that classification and reuses the existing DeepLinkNewsDetailView path to render the post. Co-Authored-By: Claude <noreply@anthropic.com>
Ready-to-host apple-app-site-association (Team ID A5VW9QUF9L, appID A5VW9QUF9L.com.brit.macmagazine) scoped to /post/* only, plus a README documenting the hosting requirements for macmagazine.com.br and www. Co-Authored-By: Claude <noreply@anthropic.com>
cassio-rossi
added a commit
that referenced
this pull request
Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes deep linking end-to-end for MacMagazine post URLs. Covers three entry points under #312: widget taps, custom URLs, and Universal Links (web links opening the app instead of Safari).
Problem
macmagazine.com.brpost link in Safari/Messages/Mail opened the browser, never the app.Root cause
The app runs on the UIKit scene lifecycle (
AppDelegateinstalls aSceneDelegatethat hostsSceneViewin aUIHostingController; the@mainWindowGroupisEmptyView()). Under aUISceneDelegate, SwiftUI's.onOpenURLnever fires, andSceneDelegatehandled only shortcut items — so widget URLs were dropped. Separately, the app declared no Associated Domains and handled no browsing-webNSUserActivity, so it could not claim its own web URLs.Fix
SceneDelegatenow handlesscene(_:openURLContexts:)(warm) andconnectionOptions.urlContexts(cold).SceneDelegatehandlesscene(_:continue:)(warm) andconnectionOptions.userActivities(cold), filtering forNSUserActivityTypeBrowsingWeb.MainViewModel.openDeepLink(_:source:), which setsdeepLinkPostURLand tracks analytics per source (widgetvsuniversal_link). Reuses the existingDeepLinkNewsDetailView→MMWebViewpath — no new routing.com.apple.developer.associated-domains(apex +www) to debug and release entitlements.Support/AssociatedDomains/(Team IDA5VW9QUF9L), scoped to/post/*so only article URLs open the app.Verification
--stricton all changed Swift files — 0 violations./post/*link and confirm it opens the article in-app.Required outside this repo (server / portal)
Support/AssociatedDomains/apple-app-site-associationathttps://macmagazine.com.br/.well-known/apple-app-site-association(andwww) — HTTPS,application/json, no redirect, no extension. See the README in that folder.com.brit.macmagazineApp ID and regenerate provisioning profiles (device/TestFlight signing; simulator doesn't enforce it).Notes / deviations
developbranch exists — branch is based onrelease/v5; PR targetsrelease/v5.WidgetViewstamps a container-wide.widgetURL(content.first?.url)under.accessibilityElement(children: .combine), which limits VoiceOver users to only the first post.🤖 Generated with Claude Code