Files
purchases-ios/Sources/Logging/Strings
Facundo MenzellaandClaude Sonnet 4.6 72425656cb Prewarm workflow assets after offerings refresh (#6732)
* Prewarm workflow assets after offerings refresh

After offerings are fetched, fetch the workflow for the current offering
and pre-download images, videos, and fonts across all workflow screens,
so paywall presentation doesn't block on cold network requests.

Gated behind -EnableWorkflowsEndpoint and respects isAppBackgrounded
for appropriate network priority.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Move workflow cache warming into workflow(forOfferingIdentifier:)

Warm workflow assets as a side-effect of fetching the workflow rather
than issuing a redundant second getWorkflow call from warmUpCaches.
This removes the extra background network request after every offerings
refresh and keeps the caching co-located with the only fetch site.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Merge sequential warmUpWorkflowCaches task groups into one

Images, videos, and fonts are independent — no need to wait for each
group to finish before starting the next.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Add Logger.verbose call to warmUpWorkflowCaches

Follows the same pattern as warmUpPaywallImagesCache, warmUpPaywallVideosCache,
and warmUpPaywallFontsCache.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Address review feedback: per-workflow warming ID, guard let self, remove PaywallComponentsData allocation

- Replace hasLoadedWorkflow bool with warmedWorkflowIDs: Set<String> keyed on
  workflow.id so each distinct workflow is warmed exactly once
- Add guard let self in all task group closures to match existing patterns
- Extract imageURLs(from:localizations:) as a shared free function and add
  allImageURLs/allLowResVideoUrls directly on WorkflowScreen, removing the
  intermediate PaywallComponentsData allocation in warmUpWorkflowCaches

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 14:49:00 +02:00
..