Skip to content

fix(#280): increase cookie expiration from 60s to 24h#286

Merged
cassio-rossi merged 1 commit intorelease/v5from
fix/cookie-expiration-ads
Apr 30, 2026
Merged

fix(#280): increase cookie expiration from 60s to 24h#286
cassio-rossi merged 1 commit intorelease/v5from
fix/cookie-expiration-ads

Conversation

@cassio-rossi
Copy link
Copy Markdown
Collaborator

Summary

  • Ad banners were reappearing despite valid subscriptions because the patr cookie expired after just 60 seconds
  • In v4 (UIKit), this worked because HTTPCookieStorage.shared kept cookies alive process-wide. In v5 (SwiftUI native WebView), cookies are scoped to WKWebsiteDataStore and truly expire after the set interval
  • Deferred/lazy-loaded ads that fire after 60s no longer saw the patr cookie, causing banners to reappear
  • Increased expiration to 24 hours (86,400s) — cookies are still re-created fresh on every page load, so there's no stale-data risk
  • Extracted the expiration value into a cookieExpiration constant for maintainability

Closes #280

Test plan

  • Open an article as a subscriber — verify no ads appear
  • Stay on the article for >60 seconds — verify ads don't reappear
  • Scroll through the article (trigger lazy-loaded content) — verify no ads
  • Open multiple articles in sequence — verify no ads on any
  • Test without subscription — verify ads DO appear (cookie value is "false")
  • Run MacMagazineUILibraryTests — all cookie tests pass ✅

🤖 Generated with Claude Code

The 60-second cookie expiration caused the `patr` ad-removal cookie to
expire during browsing sessions. Deferred/lazy-loaded ads that fire
after the initial page render would no longer see the cookie, causing
banners to reappear. 24 hours ensures coverage for the entire session
while cookies are still refreshed on every new page load.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cassio-rossi cassio-rossi merged commit db9e7ba into release/v5 Apr 30, 2026
2 checks passed
@cassio-rossi cassio-rossi deleted the fix/cookie-expiration-ads branch April 30, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Banners voltando mesmo logado ou com assinatura interna

2 participants