Problem
When a post is opened through the app's normal in-app navigation (tapping a news card), the WebView correctly hides ads for users who purchased ad removal. But when the same post is opened via widget, push notification, deeplink (onOpenURL), or Home Screen shortcut, ads are still shown even for purchasing users.
Root cause
Ad removal is driven by the patr cookie, set by MMWebView from @Environment(\.removeAds) (MMWebView.swift:7, 182-187).
\.removeAds is injected only on the MainView subtree — MacMagazineApp.swift:134. Its default value is false (EnvironmentValuesExtensions.swift:26).
All four external entry points set viewModel.deepLinkPostURL, which is presented by a single .fullScreenCover attached at the SceneView.body level (MacMagazineApp.swift:55-66) — a sibling of MainView, not a descendant. So DeepLinkNewsDetailView → MMWebView reads the default false and the patr cookie is written as "false", showing ads.
(\.theme is injected at the body level, which is why the deeplink article is themed correctly but ads are not hidden.)
Fix
Re-inject \.removeAds on the fullScreenCover content, alongside the modelContainer and analytics dependencies already re-injected there (MacMagazineApp.swift:63-64). A single line fixes all four entry points, since they share one presentation.
Affected paths (all share the same cover)
- Widget / deeplink —
onOpenURL (MacMagazineApp.swift:48)
- Push —
newContentAvailable + cold-launch .task (MacMagazineApp.swift:76,104)
- Shortcut —
shortcutManager.url (MacMagazineApp.swift:85)
Problem
When a post is opened through the app's normal in-app navigation (tapping a news card), the WebView correctly hides ads for users who purchased ad removal. But when the same post is opened via widget, push notification, deeplink (
onOpenURL), or Home Screen shortcut, ads are still shown even for purchasing users.Root cause
Ad removal is driven by the
patrcookie, set byMMWebViewfrom@Environment(\.removeAds)(MMWebView.swift:7,182-187).\.removeAdsis injected only on theMainViewsubtree —MacMagazineApp.swift:134. Its default value isfalse(EnvironmentValuesExtensions.swift:26).All four external entry points set
viewModel.deepLinkPostURL, which is presented by a single.fullScreenCoverattached at theSceneView.bodylevel (MacMagazineApp.swift:55-66) — a sibling ofMainView, not a descendant. SoDeepLinkNewsDetailView→MMWebViewreads the defaultfalseand thepatrcookie is written as"false", showing ads.(
\.themeis injected at the body level, which is why the deeplink article is themed correctly but ads are not hidden.)Fix
Re-inject
\.removeAdson the fullScreenCover content, alongside themodelContainerandanalyticsdependencies already re-injected there (MacMagazineApp.swift:63-64). A single line fixes all four entry points, since they share one presentation.Affected paths (all share the same cover)
onOpenURL(MacMagazineApp.swift:48)newContentAvailable+ cold-launch.task(MacMagazineApp.swift:76,104)shortcutManager.url(MacMagazineApp.swift:85)