Skip to content

CircleCI: fix snapshot generation for iOS 14#3431

Merged
NachoSoto merged 1 commit into
mainfrom
generate-snapshots-ios-14
Nov 17, 2023
Merged

CircleCI: fix snapshot generation for iOS 14#3431
NachoSoto merged 1 commit into
mainfrom
generate-snapshots-ios-14

Conversation

@NachoSoto

Copy link
Copy Markdown
Contributor

See #2421.

iOS 14 + Snapshots needs a new test plan that doesn't run StoreKit tests.

@NachoSoto NachoSoto added the ci label Nov 16, 2023
@NachoSoto NachoSoto requested a review from a team November 16, 2023 22:02
See #2421.

iOS 14 + Snapshots needs a new test plan that doesn't run StoreKit tests.
@NachoSoto NachoSoto force-pushed the generate-snapshots-ios-14 branch from ff1386b to 1ed949b Compare November 16, 2023 23:07
@NachoSoto NachoSoto merged commit 352cd97 into main Nov 17, 2023
@NachoSoto NachoSoto deleted the generate-snapshots-ios-14 branch November 17, 2023 15:37
tonidero pushed a commit that referenced this pull request Nov 30, 2023
**This is an automatic release.**

### RevenueCatUI
* Paywalls: Fix navigation with close button in UIKit (#3466) via Andy
Boedo (@aboedo)
* `Paywalls`: `watchOS` support (#3291) via NachoSoto (@NachoSoto)
### Dependency Updates
* Bump cocoapods from 1.14.2 to 1.14.3 (#3464) via dependabot[bot]
(@dependabot[bot])
* Bump fastlane from 2.216.0 to 2.217.0 (#3415) via dependabot[bot]
(@dependabot[bot])
* Bump danger from 9.3.2 to 9.4.0 (#3414) via dependabot[bot]
(@dependabot[bot])
### Other Changes
* Some `APITester` fixes (#3444) via NachoSoto (@NachoSoto)
* `HTTPClient`: test all request headers (#3425) via NachoSoto
(@NachoSoto)
* `CircleCI`: fix snapshot generation for iOS 14 (#3431) via NachoSoto
(@NachoSoto)
* Remove `MockStoreMessagesHelper` from SDK (#3417) via NachoSoto
(@NachoSoto)
* Enable explicit_init lint rule and fix issues (#3418) via Mark
Villacampa (@MarkVillacampa)
facumenzella added a commit that referenced this pull request May 14, 2026
Each workflow step now gets its own cached PackageContext. Package-bearing
steps use their own package selection; packageless steps fall back to the
workflow's singleStepFallbackId context. Sheet dismissal restores the
step-local selection rather than resetting to the workflow-global fallback.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
facumenzella added a commit that referenced this pull request May 25, 2026
* Propagate default package per workflow step (parity with Android #3431)

Each workflow step now gets its own cached PackageContext. Package-bearing
steps use their own package selection; packageless steps fall back to the
workflow's singleStepFallbackId context. Sheet dismissal restores the
step-local selection rather than resetting to the workflow-global fallback.

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

* Fix P1: broadcast step-local workflowPackageContext per page

Add WorkflowContext.effectivePackageContext(for:) which returns the
step's own package context when it has package components, falling back
to the global workflowPackageContext otherwise. WorkflowPaywallView now
stores this per-page and sets it as the workflowPackageContext env value,
so TabsComponentView and any other consumer automatically gets the
step-scoped default rather than the global workflow fallback.

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

* Fix P2: remove mutable override from defaultPackage derivation

After the P1 fix, workflowPackageContext in the env is the step-local
stable WorkflowPackageContext struct. selectedPackageContextOverride.package
is a @published var that mutates on user selection, so using it as
defaultPackage caused planSelectionDefaultPackage to track the user's
current selection rather than the page's configured default. Removing
the override prefix restores correct, stable defaultPackage derivation.

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

* Remove redundant fallback in buildPackageContext

effectivePackageContext already falls back to workflowPackageContext internally,
so the trailing ?? workflowPackageContext was unreachable.

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

* Carry forward package selection on forward workflow navigation

When navigating forward from step N to step N+1, step N+1 now opens with
step N's current selection if that package is available there. Falls back to
the workflow-global default (singleStepFallbackId), then the step's own
authored default as last resort.

Backward navigation is unchanged: the cached PackageContext for the previous
step is returned as-is, so selection does not propagate back. Revisiting a
step via forward navigation always re-derives from the current step's live
selection (not a stale first-visit cache).

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

* Don't overwrite cached step selection on revisit

Once a step's PackageContext has been initialized (first visit), subsequent
forward navigations to that step return the cached context unchanged. This
matches Android's setDefaultPackage idempotency: a step that has already
been visited keeps its selection — whether that came from a prior carry-forward
or from the user tapping a package on that step.

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

* Test: guard PackageContext reference-type invariant and buildPackageContext carry-forward

- Make `buildPackageContext` internal so tests can call it directly
- `testPackageContextMutationsPropagateThroughStepCacheReference`: catches any
  future refactoring of PackageContext from class to struct, which would silently
  break back-navigation selection preservation
- `testBuildPackageContextCarriesForwardPreferredPackageWhenAvailableInStep`:
  end-to-end forward carry-forward at the WorkflowPaywallView layer
- `testBuildPackageContextReturnsEmptyContextForPackagelessStepWithNoFallback`:
  guards the nil-effectiveContext → empty PackageContext path

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

* Test: cache hit takes precedence over carry-forward on step revisit

Documents that `WorkflowPaywallView.renderedPageForStep` uses the cache-hit
path (ignoring `carryForwardPackage`) when a step already has a `PackageContext`
in `stepPackageContexts`, preserving the user's own prior selection over a new
carry-forward from the previous step.

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

* Avoid redundant workflowPackageContext scans in effectivePackageContext(for:preferring:)

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

* Remove redundant reference-type test, consolidate into existing cache test

`testPackageContextMutationsPropagateThroughStepCacheReference` only
tested Swift reference semantics in isolation. The same invariant is
already exercised meaningfully in
`testCachedStepContextTakesPrecedenceOverCarryForwardOnRevisit`, which
now carries a note pointing to the exact mutation line.

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

* Fix: carry-forward selects destination step's Package object, not source step's

In multi-offering workflows where two steps expose the same package identifier
from different offerings, effectivePackageContext(for:preferring:) was returning
the source step's Package instance directly. Switch both the preferredPackage
path and the wfDefault path from contains+direct-return to first(where:) so the
selectedPackage always comes from base.packages (the destination step's list).

Tests: two new WorkflowContextTests cases covering each path with distinct offerings.

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

* Test RootView sheet dismissal: extract static method + add unit tests

Extract sheet-dismissal package restoration into `RootView.restoredPackageAfterSheetDismissal` (static, testable) and add `RootViewSheetDismissalTests` covering workflow-context restore, nil-snapshot fallback, non-workflow-context always-default, and nil-default edge case.

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

* Inline wfPackageContext assignment

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

* Fix workflow package context per page

* Clarify package sheet snapshot naming

* Precompute workflow package context

* Add RootView sheet dismissal tests to Xcode project

* Guard workflow package context cache invariants

* Clarify workflow package context cache inputs

* Guard back navigation cache invariant

* Split back-navigation rendering path

* Avoid crashing on missing back-navigation cache

* Remove dead selectedPackageContextOverride stored property

The property was set in init but never read — the init body at line 149
already uses the parameter directly (still in scope), so self.selectedPackageContextOverride
was unreachable dead weight holding an unnecessary strong reference.

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

* Address workflow navigation review comments

* Remove unused workflow package context overload

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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