Skip to content

fix(settings): fix InApp purchase not updating removeAds environment#294

Merged
cassio-rossi merged 1 commit intorelease/v5from
fix/inapp-removeads-not-updating
May 2, 2026
Merged

fix(settings): fix InApp purchase not updating removeAds environment#294
cassio-rossi merged 1 commit intorelease/v5from
fix/inapp-removeads-not-updating

Conversation

@cassio-rossi
Copy link
Copy Markdown
Collaborator

Summary

  • Replace broken 100ms polling loop in SubscriptionViewModel.setupListeners() with proper withObservationTracking + withCheckedContinuation that suspends until InAppManager.status mutates
  • Make process(purchased:) fully async to eliminate fire-and-forget Task race condition where DB save never completed before status reset
  • Add defensive .onChange(of: viewModel.isValidSubscription) in SubscriptionView to ensure removeAds environment updates even if ModelContext.didSave notification is missed

Test plan

  • Build succeeds on iPhone 17 Pro simulator
  • All 44 tests pass
  • SwiftLint passes with --strict
  • Subscribe via StoreKit sandbox → verify ads disappear immediately without app restart
  • Verify patrão login still works correctly (unchanged path)
  • Verify restore purchase flow still functions

🤖 Generated with Claude Code

Replace broken 100ms polling loop with proper withObservationTracking +
continuation pattern that suspends until InAppManager.status mutates.
Make process(purchased:) async to eliminate fire-and-forget Task race
condition where DB save never completed before status reset.
Add defensive .onChange(of: isValidSubscription) in SubscriptionView
to ensure environment updates even if ModelContext.didSave is missed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cassio-rossi cassio-rossi merged commit c773593 into release/v5 May 2, 2026
1 of 2 checks passed
@cassio-rossi cassio-rossi deleted the fix/inapp-removeads-not-updating branch May 2, 2026 22:49
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.

2 participants